query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
450769141165812a33511802fd510c72
Code to add before and after the node for covering purposes
[ { "docid": "3f54cf5d0709ff1745541d005e8abd75", "score": "0.0", "text": "def rewrite\n end", "title": "" } ]
[ { "docid": "e5657ef6328647460a01172218b1611b", "score": "0.697519", "text": "def preceding(node); end", "title": "" }, { "docid": "4e21e856a5b8e79665b3f605843d8246", "score": "0.6800558", "text": "def insert_after(child1, child2); end", "title": "" }, { "docid": "02c73ad7e7bd4da117a87e0dc8df7540", "score": "0.6800463", "text": "def insert_before(child1, child2); end", "title": "" }, { "docid": "8ac0aa297362daea17e01a29734d9adf", "score": "0.67764443", "text": "def insertAfter(node, new_node)\n end", "title": "" }, { "docid": "0db0f7a46ecfdab9b7dd85973c5cc5f6", "score": "0.6739293", "text": "def prepend_child(node_or_tags); end", "title": "" }, { "docid": "0db0f7a46ecfdab9b7dd85973c5cc5f6", "score": "0.6739293", "text": "def prepend_child(node_or_tags); end", "title": "" }, { "docid": "d71c37da0efab0f1f4385a774b9922ca", "score": "0.6599017", "text": "def add_previous_sibling(node_or_tags); end", "title": "" }, { "docid": "511c5eaa66246e301bad6979cb0821ae", "score": "0.6435655", "text": "def precede?(node1, node2); end", "title": "" }, { "docid": "511c5eaa66246e301bad6979cb0821ae", "score": "0.6435655", "text": "def precede?(node1, node2); end", "title": "" }, { "docid": "e56b18e6fb4e16c561e666980041cb6d", "score": "0.6423809", "text": "def before(node)\n @parent.insert_before(node, self)\n end", "title": "" }, { "docid": "80dc74641f57505e468797b82c036b07", "score": "0.64046997", "text": "def before(node_or_tags); end", "title": "" }, { "docid": "80dc74641f57505e468797b82c036b07", "score": "0.64046997", "text": "def before(node_or_tags); end", "title": "" }, { "docid": "2c05703e80f92226afb1e51714c2e9b8", "score": "0.6401024", "text": "def add_next_sibling(node_or_tags); end", "title": "" }, { "docid": "52415c4a24f678db4973cff1e9768804", "score": "0.63999754", "text": "def after(node)\n @parent.insert_after(node, self)\n end", "title": "" }, { "docid": "99fdb16e92a599f448652c36e085666a", "score": "0.6399595", "text": "def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end", "title": "" }, { "docid": "fdbbe5744194dd60b4df08ce93dfd159", "score": "0.6388971", "text": "def after(node_or_tags); end", "title": "" }, { "docid": "fdbbe5744194dd60b4df08ce93dfd159", "score": "0.6388971", "text": "def after(node_or_tags); end", "title": "" }, { "docid": "11e34a6085b094522d4527f54ba6a1b3", "score": "0.6371241", "text": "def before(node_or_tags)\n add_previous_sibling node_or_tags\n self\n end", "title": "" }, { "docid": "855c6eb6c70a164aec5d224c9c842b62", "score": "0.6264437", "text": "def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "162eb22e830c191040c1d01b3dbd1bd7", "score": "0.6259608", "text": "def insert_after(range, content); end", "title": "" }, { "docid": "8be2683a583b6288ba76ec0284a89a6b", "score": "0.6219021", "text": "def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "9b07c58f3e8f2b28ad9e2049bbee77c8", "score": "0.6171866", "text": "def insert_before(range, content); end", "title": "" }, { "docid": "30eecd8b0b8185fe331e1dd86ec1bc47", "score": "0.6137743", "text": "def prepend(node)\n children.prepend(node)\n end", "title": "" }, { "docid": "516a643505b3632c319abedaf4e318be", "score": "0.6084471", "text": "def decorate(node); end", "title": "" }, { "docid": "516a643505b3632c319abedaf4e318be", "score": "0.6084471", "text": "def decorate(node); end", "title": "" }, { "docid": "7cf86f49c1e74450c45a86306fd7fb7a", "score": "0.6035489", "text": "def add_before(node)\n raise \"Can't add #{self} before a node with no parent\" if node.parent.nil?\n raise \"#{node.parent.class} cannot contain nodes of type #{self.class}\" unless node.parent.can_contain?(self.class)\n raise \"Can't add an node before itself\" if node == self\n raise \"#{self} cannot be its own ancestor\" if node.ancestors.include? self\n\n @__parent__.remove(self) if @__parent__\n @__parent__ = node.parent\n @__parent__.first_child = self if @__parent__.first_child == node\n @__next__ = node\n @__prev__ = node.prev\n node.prev = self\n @__prev__.next = self if @__prev__\n end", "title": "" }, { "docid": "e22c08854b5f610da16f1dee83332ba6", "score": "0.59962827", "text": "def attach_node_safely node, relative_to, how=:extend_right\n parent = (how == :before || how == :after) ? relative_to.parent : relative_to\n if node.text?\n anchor_te = node\n prior_count = parent.children.count\n else\n # Use the first text element in the tree as an anchor, if any\n anchor_te = nknode_first_text_element(node)\n end\n # We will know the location (anchor_ix) in our array of at least one text element (anchor_te)\n # This will give us a constant location to ensure that all related text elements\n # (ie., those under the node or its parent) can be renewed\n anchor_ix = find_elmt_index anchor_te\n\n # Now make the move\n as_attached =\n case how\n when :extend_right\n relative_to.add_child node\n relative_to.children.last\n when :extend_left\n if extant = relative_to.children.first\n extant.previous = node\n else\n # Degenerate case of an empty parent\n relative_to.add_child node\n end\n relative_to.children.first\n when :before\n relative_to.previous = node\n relative_to.previous\n when :after\n relative_to.next = node\n relative_to.next\n end\n\n # Finally, repair the element pointers as needed\n if node.text?\n if parent.children.count == prior_count # indicator that Nokogiri has merged adjacent text elements\n if how == :extend_left\n # Under the assumption that the inserted text-element has and will continue to precede\n # the first child, its index must be retained\n delete_at anchor_ix+1\n else\n # They should be adjacent elements in the elmts array\n delete_at anchor_ix\n anchor_ix = anchor_ix - 1\n end\n end\n # The node may have changed after being attached, but we WILL have an anchor_ix\n update_for parent, as_attached, anchor_ix\n else\n # Ensure that the node's text elements are maintained correctly in elmt_bounds\n update_for as_attached, nknode_first_text_element(as_attached), anchor_ix if anchor_ix # There mightn't be a text element \n end\n end", "title": "" }, { "docid": "8501454dce4104be34e29baf2a2732ea", "score": "0.59724367", "text": "def insert_after(node_or_range, content)\n range = to_range(node_or_range)\n @source_rewriter.insert_after(range, content)\n end", "title": "" }, { "docid": "e62e079f0f23f3b0a244cb7ac34240be", "score": "0.5949739", "text": "def after(node_or_tags)\n add_next_sibling node_or_tags\n self\n end", "title": "" }, { "docid": "5e49512f71fda55ff067e6eb36005740", "score": "0.59439164", "text": "def insert_after(value)\n node = Node(value)\n @next = node\n node\n end", "title": "" }, { "docid": "b0053c686d8f0a3a7a2afbbaa9d3c65b", "score": "0.59231186", "text": "def insert_after\r\n @lines.insert(@line_num, TextLineBuffer.new(\"\"))\r\n @line_num = @line_num + 1\r\n end", "title": "" }, { "docid": "7be6e1ccccf201611e533459a1188189", "score": "0.59163433", "text": "def insert_node_between(a, b, new_one)\n a.next = new_one\n new_one.prev = a\n new_one.next = b\n b.prev = new_one\n @length += 1\n end", "title": "" }, { "docid": "88a4ca1852f0699b052962c47e5ce8a3", "score": "0.5907626", "text": "def insert(node, &block); end", "title": "" }, { "docid": "88a4ca1852f0699b052962c47e5ce8a3", "score": "0.5907626", "text": "def insert(node, &block); end", "title": "" }, { "docid": "653b8844f6f783d2dc67a547696cc421", "score": "0.58907837", "text": "def insert_after(sibling)\n CMark.node_insert_before(@pointer, sibling.pointer)\n if res == 0 then raise NodeError, \"could not insert after\" end\n end", "title": "" }, { "docid": "1c32d91fd99a8f00c7dcc8751ae2dbff", "score": "0.58806205", "text": "def take_before(node, source_part); end", "title": "" }, { "docid": "03977aaab4d8a7f0b58a6c0fb09551e7", "score": "0.5869061", "text": "def add_child_node_and_reparent_attrs(node); end", "title": "" }, { "docid": "03977aaab4d8a7f0b58a6c0fb09551e7", "score": "0.5869061", "text": "def add_child_node_and_reparent_attrs(node); end", "title": "" }, { "docid": "bdcda72ac77e0e3b06c8193cf1573034", "score": "0.5867463", "text": "def add_node(node); end", "title": "" }, { "docid": "1db6abf0680e975c3a588b50e385f877", "score": "0.5863186", "text": "def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end", "title": "" }, { "docid": "cd5165d3a574dbea181f9662d8b3b345", "score": "0.5860539", "text": "def insert_before(value)\n node = Node(value)\n node.next = self\n node\n end", "title": "" }, { "docid": "4ac1864b8ed11381575be457541885dc", "score": "0.58346283", "text": "def insert_before(node_or_range, content)\n range = to_range(node_or_range)\n # TODO: Fix Cops using bad ranges instead\n if range.end_pos > @source_buffer.source.size\n range = range.with(end_pos: @source_buffer.source.size)\n end\n\n @source_rewriter.insert_before(range, content)\n end", "title": "" }, { "docid": "af82d3eee3f975955ce603234a72180f", "score": "0.582405", "text": "def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end", "title": "" }, { "docid": "a87e6df339c62f135b5df7fcc966f12b", "score": "0.58115345", "text": "def insert_after(value)\n node = DoublyLinkedListNode(value)\n\n # Need to implement this\n\n node\n end", "title": "" }, { "docid": "4559fc1ef2f01cd1ba25bcd91c0216cd", "score": "0.58076257", "text": "def add_child(node_or_tags); end", "title": "" }, { "docid": "4559fc1ef2f01cd1ba25bcd91c0216cd", "score": "0.58076257", "text": "def add_child(node_or_tags); end", "title": "" }, { "docid": "c414ce09879d6a4a61137edb7eac083c", "score": "0.57746017", "text": "def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end", "title": "" }, { "docid": "6cee62cd85c4670ff0bee18ec3893114", "score": "0.57545817", "text": "def add_node( node )\n super( node )\n __add_node__( node )\n end", "title": "" }, { "docid": "879f8fa02231b91384ee1ccd312aa8ec", "score": "0.56962174", "text": "def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end", "title": "" }, { "docid": "6053443b6f205ff21bcac74b00a0f515", "score": "0.5682345", "text": "def insert_before value\n node = Node.new value, self, @prv\n @prv.nxt = node if @prv\n @prv = node\n end", "title": "" }, { "docid": "a6e0e1758c1b9173c7a4da2715993fe3", "score": "0.5676551", "text": "def on_begin(node); end", "title": "" }, { "docid": "b90015013779411f593415c9659d6bc3", "score": "0.56686026", "text": "def addNodeAtPos(xml, toAdd, nodeOver)\n\n size = xml[\"childCount\"].to_i\n if(xml[\"nodeName\"] == nodeOver)\n\n xml[\"childCount\"] = size+1\n xml[size] = toAdd\n return\n end\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeOver)\n addNodeAtPos(values, toAdd, nodeOver)\n break\n else\n\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n addNodeAtPos(values[k], toAdd,nodeOver)\n end\n end\n end\n end", "title": "" }, { "docid": "2714166660367484f22706a46ee1c367", "score": "0.56628877", "text": "def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end", "title": "" }, { "docid": "8195aa8c50ae3bc9d079ea76e1e30e4d", "score": "0.56527776", "text": "def insert_before_multi(range, content); end", "title": "" }, { "docid": "e3306448e6d59d3aa8490a80a2c55ab4", "score": "0.5650326", "text": "def add_carets(node)\n if node.tag_name == \"li\"\n if node.children(\"ul\").size > 0\n node.prepend('<span class=\"caret caret-down\"></span>')\n else\n node.prepend('<span class=\"caret caret-spacing\"></span>')\n end\n end\n\n node.children.each do |child|\n add_carets(child)\n end\n end", "title": "" }, { "docid": "be18013ef3f942d7ce5aac9440af4704", "score": "0.56476456", "text": "def insert_before(range, content)\n @source_rewriter.insert_before(range, content)\n end", "title": "" }, { "docid": "be18013ef3f942d7ce5aac9440af4704", "score": "0.56476456", "text": "def insert_before(range, content)\n @source_rewriter.insert_before(range, content)\n end", "title": "" }, { "docid": "265178613b9faad1452f64cd9cc3d3fb", "score": "0.560145", "text": "def insert_after(pr)\n unless pr.next.nil?\n nx = pr.next\n set_next(nx)\n nx.set_prev(self)\n end\n\n set_prev(pr)\n pr.set_next(self)\n end", "title": "" }, { "docid": "8aa22473dd2168383876442a1cf1f56d", "score": "0.5591859", "text": "def insert_before(sibling)\n res = CMark.node_insert_before(@pointer, sibling.pointer)\n if res == 0 then raise NodeError, \"could not insert before\" end\n end", "title": "" }, { "docid": "369f7876ff95fb6e7afe568555a4badb", "score": "0.55889493", "text": "def prepend(root); end", "title": "" }, { "docid": "23239238f1d3f38f4ba33fed807a5731", "score": "0.55868125", "text": "def wrap(node_or_range, before, after)\n range = to_range(node_or_range)\n @source_rewriter.wrap(range, before, after)\n end", "title": "" }, { "docid": "fc83153d0f4a4e955c4ed276d8a56da4", "score": "0.55568594", "text": "def before node\n @group = node.group\n send_msg(Message.new( '/n_before', @id, node.id))\n end", "title": "" }, { "docid": "18e63665bdb5a948ab59bb068d6510cb", "score": "0.5546557", "text": "def insert_after(range, content)\n @source_rewriter.insert_after(range, content)\n end", "title": "" }, { "docid": "18e63665bdb5a948ab59bb068d6510cb", "score": "0.5546557", "text": "def insert_after(range, content)\n @source_rewriter.insert_after(range, content)\n end", "title": "" }, { "docid": "81a91a1ac11a03e5b32a5b388c5b184d", "score": "0.5542218", "text": "def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end", "title": "" }, { "docid": "9078652df74c131d8764143d44a1484d", "score": "0.5538535", "text": "def insert(value, after_node)\n # when insert is called with the tail node\n # then it's the same as append method\n if tail == after_node\n append(value)\n return\n end\n\n # otherwise, you just need to link up\n # the new node with the rest of the list\n after_node.next_node = Node.new(value, after_node.next_node)\n after_node.next_node\n end", "title": "" }, { "docid": "3b6bb6bacc5fe4491bf2ab631ff0a0d8", "score": "0.55361843", "text": "def move_to_above_of(node)\n movement(node, :strict => true) do |to|\n self.right_sibling = to.target.record\n end\n end", "title": "" }, { "docid": "8b2cff048f0ffefc3b4c95b3728e9266", "score": "0.55338055", "text": "def push_after(node, new_node)\n new_node.previous_node = node\n new_node.next_node = node.next_node\n node.next_node = new_node\n end", "title": "" }, { "docid": "2f440bbdd1a1f5a20e782757bef0b4c5", "score": "0.5531636", "text": "def insert_after_multi(range, content); end", "title": "" }, { "docid": "c89fff98921d59f75c2f2c7690b145e7", "score": "0.5519085", "text": "def before(datum); end", "title": "" }, { "docid": "c89fff98921d59f75c2f2c7690b145e7", "score": "0.5519085", "text": "def before(datum); end", "title": "" }, { "docid": "350c98c24018dc138c4b5de60fa9fd70", "score": "0.5518104", "text": "def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end", "title": "" }, { "docid": "128d2386bf8878fe2c8ff02899657d17", "score": "0.5517544", "text": "def insert_before(index, *args, **_arg2, &block); end", "title": "" }, { "docid": "cedfd2456115904ae772743448977312", "score": "0.5493841", "text": "def prepend(surname)\n new_node = Node.new(surname)\n add_to_count\n if @head == nil\n @head = new_node\n else\n #attach current head to come after new node, then add new node as head.\n new_node.next_node = head\n @head = new_node\n end\n return new_node\n end", "title": "" }, { "docid": "39b7d76c4b8e18cb0d9ab9da5d177858", "score": "0.54914194", "text": "def wrap(node_or_tags); end", "title": "" }, { "docid": "dd821eb265149091bdbc7a2b5c4e480d", "score": "0.5486259", "text": "def add_child(tag, offset)\n\n while ([email protected]_contain(tag)) do\n finalize(@tip, @lineNumber - 1)\n end \n\n column_number = offset + 1 # offset 0 = column 1\n new_block = NodeTypes.list[tag].new([[@line_number, column_number], [0, 0]])\n new_block.string_content = ''\n @tip.append_child(new_block)\n @tip = new_block\n new_block\n end", "title": "" }, { "docid": "5a763fab5c1782094a4465633b6c327f", "score": "0.54821885", "text": "def insert_above(other)\n self.up, self.down = other.up, other\n reinsert_vertical\n end", "title": "" }, { "docid": "fd1895896d551de93460a6f47440dd40", "score": "0.54762095", "text": "def add_siblings_to(node, rpr_tag = T.unsafe(nil)); end", "title": "" }, { "docid": "d4f4cc973b7b7c7bac4e815bbf96e7f5", "score": "0.54704", "text": "def prepend_child(node_or_tags)\n if first = children.first\n # Mimic the error add_child would raise.\n raise RuntimeError, \"Document already has a root node\" if document? && !(node_or_tags.comment? || node_or_tags.processing_instruction?)\n first.__send__(:add_sibling, :previous, node_or_tags)\n else\n add_child(node_or_tags)\n end\n end", "title": "" }, { "docid": "61f457ce5002b6ccd94e8fb197b64985", "score": "0.54422927", "text": "def preceding_comment?(node1, node2); end", "title": "" }, { "docid": "67bbb238d85dde7fc7c7266859ac4623", "score": "0.54418576", "text": "def tb_highlight_adjacent_pos(x,y)\n @spriteset.remove_group(DISPLAY_TB)\n @spriteset.add_highlight(:x=>x,:y=>y+1, :hloc=>DISPLAY_TB)\n @spriteset.add_highlight(:x=>x,:y=>y-1, :hloc=>DISPLAY_TB)\n @spriteset.add_highlight(:x=>x+1,:y=>y, :hloc=>DISPLAY_TB)\n @spriteset.add_highlight(:x=>x-1,:y=>y, :hloc=>DISPLAY_TB)\n end", "title": "" }, { "docid": "74ef6bf4f6e7753bc88547afc6604a48", "score": "0.5440203", "text": "def before(val) insertion(val, 0) end", "title": "" }, { "docid": "7b56889edccb202dd5d95f8bc5717ac0", "score": "0.54309124", "text": "def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend", "title": "" }, { "docid": "1b46d090b5a75cf8d1a5827b27a07476", "score": "0.54178596", "text": "def insert_predecessor\n insert_node('insert_predecessor')\n end", "title": "" }, { "docid": "4df4381525810555514ede0538c3b0ed", "score": "0.54063165", "text": "def insert_case3(node)\n if node.uncle && node.uncle.red?\n node.parent.color = :black\n node.uncle.color = :black\n node.grandparent.color = :red\n\n insert_case1(node.grandparent)\n else\n insert_case4(node)\n end\n end", "title": "" }, { "docid": "4df4381525810555514ede0538c3b0ed", "score": "0.54063165", "text": "def insert_case3(node)\n if node.uncle && node.uncle.red?\n node.parent.color = :black\n node.uncle.color = :black\n node.grandparent.color = :red\n\n insert_case1(node.grandparent)\n else\n insert_case4(node)\n end\n end", "title": "" }, { "docid": "8c9844725ccda1ac95e2f915507bb393", "score": "0.5404774", "text": "def insert_after_node(node, to_insert)\n return unless node\n\n new_node = Node.new(to_insert, node, node.next)\n\n if node.next\n node.next.prev = new_node\n end\n\n if node == @tail\n @tail = new_node\n end\n\n node.next = new_node\n @length += 1\n return new_node\n end", "title": "" } ]
4f625b56cd2ebb289dadec8f1c78e9eb
Method Name: publisher_hourly_traffic Purpose: this method is used to construct publisher hourly traffic chart Version: 1.0 Author:Md Shujauddeen A Last Modified: 14Oct2008 by Md Shujauddeen Notes: None.
[ { "docid": "cd3d009d16b92a73e5439b74aed001fd", "score": "0.57964194", "text": "def publisher_hourly_traffic\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],5,0)==0\n #initialize start and end date.\n @startdate=Time.parse(session[:report_start_on]).strftime('%Y-%m-%d')\n @enddate=Time.parse(session[:report_end_on]).strftime('%Y-%m-%d')\n @page= params[:page]\n verifyDBconnection\n @xml_hourly_report=@@obj.generate_query(\"#{session[:pub_id]}-#{session[:filled]}\",'adclients_summaries','hourly_report','delivery_hour','impressions',session[:report_adclient],session[:report_start_on],session[:report_end_on],'','publisher_analytic','')\n @adclient_type=(session[:report_adclient]!='SMS' and session[:report_adclient]!='WAP')? \" and client_id=#{session[:report_adclient]}\" : \" and (ad_client_type='#{session[:report_adclient].upcase}' or ad_client_type='#{session[:report_adclient].downcase}')\"\n filter_column=session[:filled]=='filled' ? \"and impressions>0\" : session[:filled]=='unfilled' ? \"and fill_rate>0\" : \"and (impressions>0 or fill_rate>0)\"\n #frame sql query to retrive hourly traffic data from database..\n sub_query=\"select #{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"} from adclients_summaries where pub_id =#{session[:pub_id]} and delivery_date>='#{(Time.parse(@startdate)).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime(\"%Y-%m-%d\")} 23:59:59' #{filter_column}\" \n sub_query+=\" #{@adclient_type}\"\n query= \"select delivery_hour, #{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"} as sum_impressions,(#{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"}/(#{sub_query})*100) as hourly_percentage from adclients_summaries where pub_id =#{session[:pub_id]} and delivery_date>='#{@startdate} 00:00:00' and delivery_date<='#{@enddate} 23:59:59' #{filter_column}\" \n query+= \"#{@adclient_type}\"\n query+= \" group by delivery_hour\"\n #following code is use to get the hourly traffic recordset from the database\n @hourlydata_pages, @hourlydata = paginate_by_sql AdclientsSummary,query,24\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n rescue Exception=>e\n puts \"DEBUG :: ERROR :: in Publisher analytic controller :: publisher_hourly_traffic method :: #{e.to_s}\"\n end\n end", "title": "" } ]
[ { "docid": "f68c0cb1b716b44b1962bf77cd09712c", "score": "0.60264593", "text": "def traffic_init(host, traffic, time = Time.now)\n dputs(3) { \"Initialising #{host}\" }\n @traffic[host.to_sym] = {\n sec: Array.new(60*2) { [0, 0] },\n min: Array.new(60*2) { [0, 0] },\n hour: Array.new(24*2) { [0, 0] },\n day: Array.new(31*2) { [0, 0] },\n month: Array.new(12*2) { [0, 0] },\n year: Array.new(10*2) { [0, 0] },\n last_time: time,\n last_traffic: traffic\n }\n end", "title": "" }, { "docid": "f832a2bb5b6702894ac0fb0945592430", "score": "0.57638574", "text": "def publisher_hourly_traffic\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],1,0)==0\n #initialize start and end date.\n @startdate=Time.parse(session[:report_start_on]).strftime('%Y-%m-%d')\n @enddate=Time.parse(session[:report_end_on]).strftime('%Y-%m-%d')\n verifyDBconnection\n @xml_hourly_report=@@pub_obj.generate_query(\"#{session[:pub_id]}-#{session[:filled]}\",'adclients_summaries','hourly_report','delivery_hour','impressions',session[:report_adclient],session[:report_start_on],session[:report_end_on],'','admin_analytic','')\n adclient_type=(session[:report_adclient]!='SMS' and session[:report_adclient]!='WAP')? \" and client_id=#{session[:report_adclient]}\" : \" and (ad_client_type='#{session[:report_adclient].upcase}' or ad_client_type='#{session[:report_adclient].downcase}')\"\n #frame sql query to retrive hourly traffic data from database.\n filter_column=session[:filled]=='filled' ? \"and impressions>0\" : session[:filled]=='unfilled' ? \"and fill_rate>0\" : \"and (impressions>0 or fill_rate>0)\"\n sub_query=\"select #{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"} from adclients_summaries where pub_id =#{session[:pub_id]} and delivery_date>='#{(Time.parse(@startdate)).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime(\"%Y-%m-%d\")} 23:59:59' #{filter_column}\" \n sub_query+=\" #{adclient_type}\"\n query= \"select delivery_hour, #{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"} as sum_impressions,(#{session[:filled]=='filled' ? \"sum(impressions)\" : session[:filled]=='unfilled' ? \"sum(fill_rate)\" : \"(sum(impressions)+sum(fill_rate))\"}/(#{sub_query})*100) as hourly_percentage from adclients_summaries where pub_id =#{session[:pub_id]} and delivery_date>='#{@startdate} 00:00:00' and delivery_date<='#{@enddate} 23:59:59' #{filter_column}\" \n query+= \"#{adclient_type}\"\n query+= \" group by delivery_hour\"\n #following code is use to get the hourly traffic recordset from the database\n @hourlydata_pages, @hourlydata = paginate_by_sql AdclientsSummary,query,24\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n rescue Exception=>e\n puts \"DEBUG :: ERROR :: in Admin analytic controller :: publisher_hourly_traffic method :: #{e.to_s}\"\n end\n \n end", "title": "" }, { "docid": "92bd50bafcd3454b9d5dc46b4a9242f1", "score": "0.5679885", "text": "def chart_current_hourly(ts)\n @record = identify_tl_or_perf_record\n @perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record\n @perf_options[:typ] = \"Hourly\"\n @perf_options[:hourly_date] = [ts.month, ts.day, ts.year].join(\"/\")\n\n perf_set_or_fix_dates unless params[:task_id] # Set dates if first time thru\n perf_gen_data\n\n return [true, nil] unless @charts # Return if no charts got created (first time thru async rpt gen)\n\n render :update do |page|\n page << javascript_prologue\n page << if @parent_chart_data\n 'ManageIQ.charts.chartData = ' + {\n \"candu\" => @chart_data,\n \"parent\" => @parent_chart_data\n }.to_json + ';'\n else\n 'ManageIQ.charts.chartData = ' + {\n \"candu\" => @chart_data\n }.to_json + ';'\n end\n page.replace(\"perf_options_div\", :partial => \"layouts/perf_options\")\n page.replace(\"candu_charts_div\", :partial => \"layouts/perf_charts\", :locals => {:chart_data => @chart_data, :chart_set => \"candu\"})\n page << js_build_calendar(@perf_options.to_calendar)\n page << ManageIQ::Reporting::Charting.js_load_statement\n page << 'miqSparkle(false);'\n end\n [true, nil]\n end", "title": "" }, { "docid": "9d78f3586a54f7f35e7a03e444768ff0", "score": "0.5634825", "text": "def hours\n @hours ||= Traffic::Hourly.new(self)\n end", "title": "" }, { "docid": "8bd5608b8443b6d4428ea17e94f5e503", "score": "0.5614552", "text": "def traffic\n Traffic.call\n end", "title": "" }, { "docid": "0f15d10aac7e9c32d075f8b74f6a4777", "score": "0.5613438", "text": "def generate_hourly_json_output\n @json_converter = WrfForecast::JsonConverter::HourlyForecastJsonConverter.\n new(@wrf_handler, @repository, @threshold_handler.warnings)\n @json_converter.convert\n end", "title": "" }, { "docid": "3e1d9e8a25a4f9a164368002596d28c2", "score": "0.5530078", "text": "def weeklyGraphs(array_weekly,type)\n\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Distance Traveled\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Energy Expanded\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Steps\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n end\n end", "title": "" }, { "docid": "73fe0049ecd062a9bbdbd8239a23d766", "score": "0.5511122", "text": "def create\n @traffic = Traffic.new(traffic_params)\n\n respond_to do |format|\n if @traffic.save\n format.html { redirect_to @traffic.website, notice: 'Traffic was successfully created.' }\n format.json { render :show, status: :created, location: @traffic }\n else\n format.html { render :new }\n format.json { render json: @traffic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "309b9c15fc60c0239803ea0a6fa9c135", "score": "0.5446337", "text": "def generate_report(start_date, end_date)\n @resource = Resource.new\n @resource.name = \"Report - #{Time.now.strftime(\"%m/%d/%Y\")}\"\n @recorded_hours_series = Hash.new\n @recorded_hours_series[\"name\"] = \"Recorded Hours\"\n @recorded_hours_series[\"data\"] = Array.new\n\n @data = Array.new\n @opportunity_volunteers = []\n @email_suffixes = []\n top_suffixes = [\"gmail.com\", \"hotmail.com\",\"aol.com\",\"yahoo.com\"]\n recorded_hours.where(date_recorded: start_date..end_date).each do |rh|\n @data.push(rh.hours)\n if rh.person\n existing_volunteer = @opportunity_volunteers.find { |ov| ov[:id] == rh.person_id }\n if existing_volunteer\n existing_volunteer[:hours] += rh.hours\n else\n @opportunity_volunteers.push({\n id: rh.person_id,\n name: \"#{rh.person.first_name} #{rh.person.last_name}\",\n hours: rh.hours\n })\n end\n if rh.person.email\n existing_suffix = @email_suffixes.find { |es| es[:suffix] == rh.person.email.split(\"@\").last }\n if existing_suffix && !top_suffixes.include?(existing_suffix[:suffix])\n existing_suffix[:hours] += rh.hours\n else\n @email_suffixes.push({\n suffix: rh.person.email.split(\"@\").last,\n hours: rh.hours\n })\n end\n end\n end\n end\n\n top_volunteers = @opportunity_volunteers.sort_by { |i| i[:hours] }.reverse!.take(10)\n top_suffixes = @email_suffixes.sort_by { |i| i[:hours] }.reverse!.take(10)\n\n recorded_hours = \"recorded_hours.png\"\n Gchart.line(:size => '500x300',\n :title => \"Timeline of Recorded Hours at #{name}\",\n :bg => 'FFFFFF',\n :data => @data,\n :format => 'file',\n :axis_with_labels => 'y',\n :line_colors => '35c0ff',\n :axis_labels => ['0|2|4|6|8|10'],\n :filename => recorded_hours)\n\n\n\n # This is the pie chart for roles\n @opportunity_roles_series = Hash.new\n @opportunity_roles_series[\"name\"] = \"Opportunity Roles\"\n @opportunity_roles_series[\"data\"] = Array.new\n opportunity_roles_options = {\n title: {\n text: \"Hours Per Role Between #{DateTime.parse(start_date.to_s).strftime(\"%b/%d/%Y\")} and #{DateTime.parse(end_date.to_s).strftime(\"%b/%d/%Y\")}\"\n },\n chart: {\n type: 'pie'\n },\n xAxis: {\n title: {\n text: 'Percentage'\n }\n }\n }\n opportunity_roles_options[\"series\"] = Array.new\n if !opportunity_roles.empty?\n opportunity_roles.each do |opr|\n @opportunity_roles_series[\"data\"].push({name: \"#{opr.name}\", y: opr.total_recorded_hours})\n end\n end\n\n opportunity_roles_options[\"series\"].push(@opportunity_roles_series)\n opportunity_roles = \"opportunity_hours.png\"\n open(opportunity_roles, 'wb') do |file|\n file << open(\"http://export.highcharts.com/?async=false&type=png&width=500&options=#{URI.encode(JSON.generate(opportunity_roles_options))}\").read\n end\n\n\n\n # This is the pie chart for groups\n @opportunity_groups_series = Hash.new\n @opportunity_groups_series[\"name\"] = \"Opportunity Roles\"\n @opportunity_groups_series[\"data\"] = Array.new\n opportunity_groups_options = {\n title: {\n text: \"Groups Between #{DateTime.parse(start_date.to_s).strftime(\"%b/%d/%Y\")} and #{DateTime.parse(end_date.to_s).strftime(\"%b/%d/%Y\")}\"\n },\n chart: {\n type: 'pie'\n },\n xAxis: {\n title: {\n text: 'Percentage'\n }\n }\n }\n opportunity_groups_options[\"series\"] = Array.new\n if !groups.empty?\n groups.each do |opg|\n @opportunity_groups_series[\"data\"].push({name: \"#{opg.name}\", y: opg.total_recorded_hours})\n end\n end\n\n opportunity_groups_options[\"series\"].push(@opportunity_groups_series)\n opportunity_groups = \"groups_opportunity_hours.png\"\n open(opportunity_groups, 'wb') do |file|\n file << open(\"http://export.highcharts.com/?async=false&type=png&width=500&options=#{URI.encode(JSON.generate(opportunity_groups_options))}\").read\n end\n\n\n pdf = OpportunityReportPdf.new(self, recorded_hours, opportunity_roles, opportunity_groups, start_date, end_date, top_volunteers, top_suffixes)\n pdf.render_file \"Opportunity Report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}\"\n\n @resource.resource = File.open(\"Opportunity Report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}\")\n @resource.resourceable = self\n @resource.save\n File.delete(\"groups_opportunity_hours.png\")\n File.delete(\"opportunity_hours.png\")\n File.delete(\"recorded_hours.png\")\n File.delete(\"Opportunity Report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}\")\n\n return @resource\n end", "title": "" }, { "docid": "e36240f50ddec172b445b9c1c72a3485", "score": "0.5402206", "text": "def create_speed_chart\n create_excel_by_story_summary\n end", "title": "" }, { "docid": "52556f79388efc960b69ed6e0c85d0c4", "score": "0.5337504", "text": "def traffic_params\n params.require(:traffic).permit(:country_id, :website_id, :country_share, :country_visits, :bounce_rate, :country_visitors, :annual_turnover)\n end", "title": "" }, { "docid": "9acc48fc4265bdd524c5b87657db34d1", "score": "0.5336545", "text": "def create\n @traffic = Traffic.new(traffic_params)\n\n respond_to do |format|\n if @traffic.save\n format.html { redirect_to @traffic, notice: 'Traffic was successfully created.' }\n format.json { render :show, status: :created, location: @traffic }\n else\n format.html { render :new }\n format.json { render json: @traffic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c06caf9e8f2efd6df518dae9a7a4b44d", "score": "0.5326341", "text": "def advertiser_hourtraffic\n\t\tbegin\n\t\t @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],5,0)==0\n session[:page]=params[:page]==\"\"? 0 : params[:page].to_i\n verifyDBconnection\n @adid= (session[:advreport_ad_id]==\"All\" ) ? \"\" : \" and ad_id=#{session[:advreport_ad_id]} \"\n campaignId= (session[:advreport_camp_id]==\"SMS\" || session[:advreport_camp_id]==\"WAP\" || session[:advreport_camp_id]==nil) ? \"\" : \" and campaign_id=#{session[:advreport_camp_id]} \"\n ad_type=(session[:advreport_camp_id]==\"SMS\" || session[:advreport_camp_id]==\"WAP\" ) ? \" and ad_client_type='#{session[:advreport_camp_id]}'\" : \"\"\n report_type=session[:advreport_type]\n @advXML_hour_traffic_report=@@obj.generate_query(session[:advreport_camp_id],session[:advreport_ad_id],\"#{session[:adv_id]}-campaigns_summaries-#{session[:duration]}\",'hourly_report','delivery_hour','impressions',session[:advreport_start_on],session[:advreport_end_on]) \t\t\t\n sql=\"select delivery_hour , sum(impressions) as impressions, ((sum(impressions)/(select sum(impressions) as impressions from campaigns_summaries where advertiser_id=#{session[:adv_id]} #{campaignId} #{@adid} and delivery_date>='#{(Time.parse(session[:advreport_start_on])).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(session[:advreport_end_on])).strftime(\"%Y-%m-%d\")} 23:59:59' and impressions>0 \t))*100) as percentage from campaigns_summaries where advertiser_id=#{session[:adv_id]} #{campaignId} #{@adid} and delivery_date>='#{(Time.parse(session[:advreport_start_on])).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(session[:advreport_end_on])).strftime(\"%Y-%m-%d\")} 23:59:59' and impressions>0 #{ad_type} group by delivery_hour\"\n @hourtraffic_pages, @hour_traffic = paginate_by_sql CampaignsSummary,sql,24\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n\t\trescue Exception=>e\n\t\t\tputs \"DEBUG :: ERROR :: in advertiser_analytic_controller - advertiser_hour_traffic method Exception :: #{e.to_s}\"\n\t\t\trender :action=>'advertiser_hourtraffic'\n\t\tend\n\tend", "title": "" }, { "docid": "976abe9900eaa132e44f4bdad29db2c3", "score": "0.53131974", "text": "def publisher_traffic\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],5,0)==0\n #define and initialize an hash to get Contient name based on contient code.\n @continent=@continent={\"SA\"=>\"South America\",\"NA\"=>\"North America\",\"AS\"=>\"Asia\",\"EU\"=>\"Europe\",\"AF\"=>\"Africa\",\"OC\"=>\"Oceania\",\"CA\"=>\"Central America\",\"ME\"=>\"Middle East\"}\n #initialize start and end date\n @startdate=Time.parse(session[:report_start_on]).strftime('%Y-%m-%d')\n @enddate=Time.parse(session[:report_end_on]).strftime('%Y-%m-%d')\n @page= params[:page]\n verifyDBconnection\n user_id = @aes.decrypt(session[:key],session[:iv],session[:user_id])\n user_info=User.find_by_id(user_id)\n @check_access=user_info.access_on_analytics\n unfilled_info=@check_access=='true' ? '(sum(fill_rate)+sum(impressions)) as traffic_acquired,sum(fill_rate) as unfilled,' : ''\n @xml_traffic=@@obj.generate_query(\"#{session[:pub_id]}-#{session[:filled]}\",'pub_geolocations','Traffic','continent_code','impressions',session[:report_adclient],session[:report_start_on], session[:report_end_on],'','publisher_analytic','')\n @adclient_type=(session[:report_adclient]!='SMS' and session[:report_adclient]!='WAP')? \" and client_id=#{session[:report_adclient]}\" : \" and (ad_client_type='#{session[:report_adclient].upcase}' or ad_client_type='#{session[:report_adclient].downcase}')\"\n #frame query to get hourly traffic recordset from database.\n query= \"select if(continent_code='CB','NA',continent_code) as continent, #{unfilled_info} sum(impressions) as sum_region,sum(clicks) as sum_clicks,((sum(clicks)/sum(impressions))*100) as sum_ctr,sum(revenue) as sum_revenue,((sum(revenue)/sum(impressions))*1000) as sum_ecpm,(sum(impressions)/(sum(fill_rate)+sum(impressions)))*100 as fr_percentage from pub_geolocations where pub_id =#{session[:pub_id]} and delivery_date>='#{@startdate} 00:00:00' and delivery_date<='#{@enddate} 23:59:59' and (impressions>0 or fill_rate>0 or clicks>0)\" \n query+=\"#{@adclient_type}\"\n query+= \" group by continent order by #{session[:filled]=='filled' ? \"sum_region\" : session[:filled]=='unfilled' ? \"unfilled\" : \"traffic_acquired\"} desc\"\n #following code is used to retrive recordset from database\n @trafficdata_pages, @trafficdata = paginate_by_sql AdclientsSummary,query,10\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n rescue Exception=>e\n puts \"DEBUG :: ERROR :: in Publisher analytic controller :: publisher_traffic method :: #{e.to_s}\"\n end\n \n end", "title": "" }, { "docid": "c0a30ce512eefd8ad614e44d18af8eb3", "score": "0.53060436", "text": "def hourly_daily_distribution\n\n data = []\n 7.times { |i|\n @distribution.each { |d|\n data << [i + 1, d[0], \"not use\", d[1]]\n }\n }\n\n execute(\"scraping-hourly-daily-distribution\",\n data)\n\n end", "title": "" }, { "docid": "07aa6ec28534a8aa51b85bcc19e9bf57", "score": "0.52987415", "text": "def build_chart_series(forecast_hourly_data,resort)\n t_series = ChartData.new(resort.name)\n ws_series = ChartData.new(resort.name)\n cc_series = ChartData.new(resort.name)\n\n # add hourly data points\n for i in 0..48\n h = forecast_hourly_data[i]\n tm = Time.at(h[\"time\"])\n \n t_series.add_data_point([tm, h[\"temperature\"]])\n ws_series.add_data_point([tm, h[\"windSpeed\"]])\n cc_series.add_data_point([tm, h[\"cloudCover\"]*100])\n \n end\n \n @temp_chart_data << {name: t_series.name, data: t_series.data}\n @wind_speed_chart_data << {name: ws_series.name, data: ws_series.data}\n @cloud_cover_chart_data << {name: cc_series.name, data: cc_series.data}\n end", "title": "" }, { "docid": "3e8ac662059f91d793b4ef42ae29f61f", "score": "0.52941084", "text": "def generate_report(start_date, end_date)\n @resource = Resource.new\n @resource.name = \"report - #{Time.now.strftime(\"%T - %m/%e/%Y\")}\"\n @recorded_hours_series = Hash.new\n @recorded_hours_series[\"name\"] = \"Recorded Hours\"\n @recorded_hours_series[\"data\"] = Array.new\n @organization_volunteers = []\n @volunteer_table = []\n @top_opportunities = []\n @volunteer_table << [\"Name\", \"Email\", \"Organization\",\"Opportunity\",\"Instance\",\"Hours\"]\n @opportunities_table = []\n if organization_type.name === \"Volunteer Group\"\n @opportunities_table << [\"Opportunity Name\", \"Organization Name\", \"Organization Contact\",\"# of Volunteers\",\"Total Hours\"]\n elsif organization_type.name === \"Nonprofit\"\n @opportunities_table << [\"Opportunity Name\",\"# of Volunteers\",\"Total Hours\"]\n end\n\n @total_hours = 0\n summary_graph = Hash.new\n summary_graph[\"Total Volunteers Added\"] = Hash.new\n summary_graph[\"Total Recorded Hours\"] = Hash.new\n @email_suffixes = []\n top_suffixes = [\"gmail.com\", \"hotmail.com\",\"aol.com\",\"yahoo.com\"]\n daily_statistics.where(date: start_date..end_date).each do |ds|\n summary_graph[\"Total Volunteers Added\"][ds.date.strftime(\"%m/%e\")] = ds.total_added_volunteers\n summary_graph[\"Total Recorded Hours\"][ds.date.strftime(\"%m/%e\")] = ds.total_recorded_hours\n end\n organization_recorded_hours.each do |rh|\n if rh.hours && rh.person && rh.instance && (start_date..end_date).cover?(rh.instance)\n @total_hours += rh.hours\n if rh.opportunity && !rh.opportunity.nil?\n opportunity_name = \"#{rh.opportunity.name.to_s}\"\n else\n opportunity_name = \"No Opportunity Name\"\n end\n if organization_type.name === \"Nonprofit\"\n if rh.organization && !rh.organization.nil?\n organization_name = \"#{rh.organization.name.to_s}\"\n else\n organization_name = \"No Organization\"\n end\n elsif organization_type.name === \"Volunteer Group\"\n if rh.opportunity && Opportunity.exists?(id: rh.opportunity.id) && rh.opportunity.organization && Organization.exists?(id: rh.opportunity.organization.id)\n organization_name = \"#{rh.opportunity.organization.name.to_s}\"\n else\n organization_name = \"No Organization\"\n end\n end\n if !rh.person.first_name.nil?\n person_first_name = \"#{rh.person.first_name}\"\n else\n person_first_name = \"\"\n end\n if !rh.person.last_name.nil?\n person_last_name = \"#{rh.person.last_name}\"\n else\n person_last_name = \"\"\n end\n if !rh.person.email.nil?\n person_email = \"#{rh.person.email}\"\n else\n person_email = \"\"\n end\n if rh.instance\n instance = rh.instance.strftime(\"%I:%M%p - %m/%d/%Y\")\n else\n instance = \"\"\n end\n @volunteer_table <<\n [\n \"#{person_first_name} #{person_last_name}\",\n person_email,\n organization_name,\n opportunity_name,\n instance,\n \"#{rh.hours.to_f}\"\n ]\n existing_volunteer = @organization_volunteers.find { |ov| ov[:id] == rh.person_id }\n if existing_volunteer\n existing_volunteer[:hours] += rh.hours\n else\n @organization_volunteers.push({\n id: rh.person_id,\n name: \"#{rh.person.first_name} #{rh.person.last_name}\",\n hours: rh.hours\n })\n end\n if rh.person.email\n existing_suffix = @email_suffixes.find { |es| es[:suffix] == rh.person.email.split(\"@\").last }\n if existing_suffix && !top_suffixes.include?(existing_suffix[:suffix])\n existing_suffix[:hours] += rh.hours\n else\n @email_suffixes.push({\n suffix: rh.person.email.split(\"@\").last,\n hours: rh.hours\n })\n end\n end\n end\n end\n\n # This is the pie chart for roles\n @opportunities_series = Hash.new\n @opportunities_series[\"name\"] = \"Opportunities\"\n @opportunities_series[\"data\"] = Array.new\n opportunities_options = {\n title: {\n text: \"\"\n },\n chart: {\n type: 'pie'\n },\n xAxis: {\n title: {\n text: 'Percentage'\n }\n }\n }\n opportunities_options[\"series\"] = Array.new\n if !opportunities.empty?\n opportunities.each do |opr|\n @people = []\n total_recorded_hours = 0\n total_volunteers = 0\n if IceCube::Schedule.from_yaml(opr.schedule).occurs_between?(start_date, end_date)\n opr.recorded_hours.each do |rh|\n if rh.hours && (start_date..end_date).cover?(rh.instance) && (rh.organization_id === id || rh.opportunity.organization.id === id)\n total_recorded_hours += rh.hours\n end\n if rh.person && [email protected]?(rh.person)\n total_volunteers += 1\n @people << rh.person\n end\n end\n end\n if opr.name\n opportunity_name = \"#{opr.name.to_s}\"\n else\n opportunity_name = \"No Opportunity Name\"\n end\n if opr.organization && opr.organization.name\n organization_name = \"#{opr.organization.name.to_s}\"\n else\n organization_name = \"No Organization Name\"\n end\n if !opr.organization && !opr.organization.users.empty?\n ap opr.organization.users.first\n if opr.organization.users.first.email?\n contact_email = \"#{opr.organization.users.first.email}\"\n end\n else\n contact_email = \"\"\n end\n if organization_type.name === \"Volunteer Group\"\n @opportunities_table <<\n [\n opportunity_name,\n organization_name,\n contact_email,\n total_volunteers,\n total_recorded_hours\n ]\n elsif organization_type.name === \"Nonprofit\"\n @opportunities_table <<\n [\n opportunity_name,\n total_volunteers,\n total_recorded_hours\n ]\n end\n\n @top_opportunities << {name: \"#{opr.name}\", hours: total_recorded_hours}\n @opportunities_series[\"data\"].push({name: \"#{opr.name}\", y: total_recorded_hours})\n end\n end\n\n opportunities_options[\"series\"].push(@opportunities_series)\n opportunities = \"#{name}_opportunity_hours.png\"\n open(opportunities, 'wb') do |file|\n file << open(\"http://export.highcharts.com/?async=false&type=png&width=300&options=#{URI.encode(JSON.generate(opportunities_options))}\").read\n end\n\n top_volunteers = @organization_volunteers.sort_by { |i| i[:hours] }.reverse!.take(10)\n top_suffixes = @email_suffixes.sort_by { |i| i[:hours] }.reverse!.take(10)\n\n\n\n pdf = OrganizationReportPdf.new(self,\n summary_graph,\n start_date,\n end_date,\n top_volunteers,\n top_suffixes,\n @organization_volunteers.count,\n @total_hours,\n @volunteer_table,\n opportunities,\n @top_opportunities.take(3),\n @opportunities_table)\n pdf.render_file \"#{self.name} report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}.pdf\"\n\n @resource.resource = File.open(\"#{self.name} report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}.pdf\")\n @resource.resourceable = self\n @resource.save\n File.delete(\"#{self.name} report #{Time.now.strftime(\"%m.%e.%Y.%H%M\")}.pdf\")\n File.delete(opportunities)\n\n return @resource\n end", "title": "" }, { "docid": "0c85521ed26829ccef066e83779baae9", "score": "0.52925366", "text": "def update_host(h, traffic, time = Time.now)\n #dputs_func\n host = h.to_sym\n traffic_host = @traffic[host] || traffic_init(host, traffic, time)\n last_time = @traffic[host]._last_time\n dputs(3) { \"*** Updating #{host} at time #{time} from #{last_time}\" }\n advanced = 0\n if !traffic_host._last_traffic || !traffic ||\n traffic_host._last_traffic.inject(:+).to_i > traffic.inject(:+).to_i\n traffic_host._last_traffic = [0, 0]\n end\n %i(sec min hour day month year).zip([0, 0, 0, 1, 1, 0]).reverse.\n each { |t, first|\n index, last_index = time.send(t) - first, last_time.send(t) - first\n if t == :year\n index, last_index = index % 10, last_index % 10\n end\n th = traffic_host[t]\n len = th.length / 2\n offset = if t == :day\n 31 - Date.new(time.year, time.month).prev_month.\n to_time.end_of_month.day\n else\n 0\n end\n if advanced == 0\n advanced = (index + len - last_index - offset) % len\n elsif advanced == 1\n th[offset...len] = th[len..-1-offset]\n th[len..-1] = Array.new(len) { [0, 0] }\n advanced = 2 if index > 0\n elsif advanced >= 2\n th = Array.new(2 * len) { [0, 0] }\n end\n dputs(3) { \"#{t}: #{advanced} - #{traffic} - #{traffic_host._last_traffic}\" }\n rxtx = traffic.zip(traffic_host._last_traffic).\n collect { |a, b| a.to_i - b.to_i }\n th[len+index] = th[len+index].zip(rxtx).collect { |a, b| a.to_i + b.to_i }\n dputs(3) { \"#{len} - #{index} - #{rxtx} - #{th[len+index]}\" }\n traffic_host[t] = th\n }\n traffic_host._last_time = time\n traffic_host._last_traffic = traffic\n if host == :ineiti\n str = \"#{traffic_host._last_time.strftime('%a %y.%m.%d-%H:%M:%S')} - \"+\n \"#{traffic_host._last_traffic}\\n\" +\n (Internet.operator ? \"#{Internet.operator.internet_left}\" : '::') +\n \" - #{traffic_host._day[31..-1]}\\n\"\n IO.write('/var/tmp/traffic.ineiti', str, mode: 'a')\n end\n end", "title": "" }, { "docid": "6d43a25a0cb711df3541524e6c41b547", "score": "0.52664346", "text": "def overview_chart(resource, usage, generation, use_totals, gen_totals, hours)\n @chart = LazyHighCharts::HighChart.new(\"spline\") do |i|\n i.chart({\n :type => 'areaspline',\n :margin => [30, 5, 5, 30],\n :zoomType => 'x'\n })\n i.legend(:layout => 'horizontal', :style => {\n :left => 'auto',\n :bottom => 'auto',\n :right => '50px',\n :top => '100px'\n })\n i.plotOptions({spline:{marker:{enabled: true}}})\n\t\t\ti.series(name: \"Cumulative Consumption: \" + resource, data: use_totals)\n\t\t\ti.series(name: \"Cumulative Generation: \" + resource, data: gen_totals)\n i.series(name: \"Net \" + resource, data: gen_totals - use_totals)\n i.subtitle(text: \"Select plot area to zoom in.\")\n i.title(text: \"Living Building Progress\")\n i.xAxis({\n dateTimeLabelFormats: {\n month: '%e. %b',\n year: '%b'\n },\n type: 'datetime',\n title: {\n text: \"Date\"\n }\n })\n i.yAxis({\n plotOptions: {\n spline: {\n marker: {\n enabled: true\n }\n }\n },\n title: {\n text: \"Energy Units ( )\"\n },\n tooltip: {\n headerFormat: '{series.name}<br>',\n pointFormat: '{point.x.:%e. %b}: {point.y:.2f} m'\n }\n })\n \n end\n high_chart(\"irregular_intervals_zoomable\" + resource + \"_chart\", @chart)\n end", "title": "" }, { "docid": "27f05ca2eef4be2e0664310b305aaec2", "score": "0.52447367", "text": "def advertiser_hourtraffic\n\t\tbegin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],1,0)==0\n session[:page]=params[:page]==\"\"? 0 : params[:page].to_i\n verifyDBconnection\n @adid= (session[:advreport_ad_id]==\"All\" ) ? \"\" : \" and ad_id=#{session[:advreport_ad_id]} \"\n campaignId= (session[:advreport_camp_id]==\"SMS\" || session[:advreport_camp_id]==\"WAP\" || session[:advreport_camp_id]==nil) ? \"\" : \" and campaign_id=#{session[:advreport_camp_id]} \"\n ad_type=(session[:advreport_camp_id]==\"SMS\" || session[:advreport_camp_id]==\"WAP\" ) ? \" and ad_client_type='#{session[:advreport_camp_id]}'\" : \"\"\n report_type=session[:advreport_type]\n @advXML_hour_traffic_report=@@obj.generate_query(session[:advreport_camp_id],session[:advreport_ad_id],\"#{session[:adv_id]}-campaigns_summaries-#{session[:duration]}\",'hourly_report','delivery_hour','impressions',session[:advreport_start_on],session[:advreport_end_on]) \t\t\t\n sql=\"select delivery_hour , sum(impressions) as impressions, ((sum(impressions)/(select sum(impressions) as impressions from campaigns_summaries where advertiser_id=#{session[:adv_id]} #{campaignId} #{@adid} and delivery_date>='#{(Time.parse(session[:advreport_start_on])).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(session[:advreport_end_on])).strftime(\"%Y-%m-%d\")} 23:59:59' and impressions>0))*100) as percentage from campaigns_summaries where advertiser_id=#{session[:adv_id]} #{campaignId} #{@adid} and delivery_date>='#{(Time.parse(session[:advreport_start_on])).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(session[:advreport_end_on])).strftime(\"%Y-%m-%d\")} 23:59:59' and impressions>0 #{ad_type} group by delivery_hour\"\n @hourtraffic_pages, @hour_traffic = paginate_by_sql CampaignsSummary,sql,24\n #assaign xml array to an hash and put it in a session variable\t\t\t\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n\t\trescue Exception=>e\n\t\t\tputs \"DEBUG :: ERROR :: in advertiser_analytic_controller - advertiser_hour_traffic method Exception :: #{e.to_s}\"\n\t\t\trender :action=>'advertiser_hourtraffic'\n\t\tend\n\tend", "title": "" }, { "docid": "04597755895215535397896d362cdc28", "score": "0.52270937", "text": "def publisher_traffic\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],1,0)==0\n #define and initialize an hash to get Contient name based on contient code.\n @continent={\"SA\"=>\"South America\",\"NA\"=>\"North America\",\"AS\"=>\"Asia\",\"EU\"=>\"Europe\",\"AF\"=>\"Africa\",\"OC\"=>\"Oceania\",\"CA\"=>\"Central America\",\"ME\"=>\"Middle East\"}\n #initialize start and end date\n @startdate=Time.parse(session[:report_start_on]).strftime('%Y-%m-%d')\n @enddate=Time.parse(session[:report_end_on]).strftime('%Y-%m-%d')\n verifyDBconnection\n @xml_traffic=@@pub_obj.generate_query(\"#{session[:pub_id]}-#{session[:filled]}\",'pub_geolocations','Traffic','continent_code','impressions',session[:report_adclient],session[:report_start_on], session[:report_end_on],'','admin_analytic','')\n adclient_type=(session[:report_adclient]!='SMS' and session[:report_adclient]!='WAP')? \" and client_id=#{session[:report_adclient]}\" : \" and (ad_client_type='#{session[:report_adclient].upcase}' or ad_client_type='#{session[:report_adclient].downcase}')\"\n #frame query to get hourly traffic recordset from database.\n #sub_query=\"select sum(impressions) from adclients_summaries where pub_id =#{session[:pub_id]} and delivery_date>='#{(Time.parse(@startdate)).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime(\"%Y-%m-%d\")} 23:59:59'\" \n #sub_query+=\"#{adclient_type}\"\n query= \"select if(continent_code='CB','NA',continent_code) as continent,(sum(fill_rate)+sum(impressions)) as traffic_acquired,sum(impressions) as sum_region,sum(fill_rate) as unfilled,sum(clicks) as sum_clicks,((sum(clicks)/sum(impressions))*100) as sum_ctr,sum(revenue) as sum_revenue,((sum(revenue)/sum(impressions))*1000) as sum_ecpm,(sum(impressions)/(sum(fill_rate)+sum(impressions)))*100 as fr_percentage from pub_geolocations where pub_id =#{session[:pub_id]} and delivery_date>='#{@startdate} 00:00:00' and delivery_date<='#{@enddate} 23:59:59' and (impressions>0 or fill_rate>0 or clicks>0)\" \n query+=\"#{adclient_type}\"\n query+= \" group by continent order by #{session[:filled]=='filled' ? \"sum_region\" : session[:filled]=='unfilled' ? \"unfilled\" : \"traffic_acquired\"} desc\"\n #following code is used to retrive recordset from database\n @trafficdata_pages, @trafficdata = paginate_by_sql AdclientsSummary,query,20\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login', :action=>'login'\n end\n end\n rescue Exception=>e\n puts \"DEBUG :: ERROR :: in Admin analytic controller :: publisher_traffic method :: #{e.to_s}\"\n end\n \n end", "title": "" }, { "docid": "a2ae7dc04f162326279f89b6c72c495b", "score": "0.5222291", "text": "def hourly_daily_distribution (hourly_daily_distribution)\n\n data = []\n 7.times { |i|\n hour = 0\n hourly_daily_distribution.each { |d|\n data << [i + 1, hour += 1, \"not use\", d]\n }\n }\n\n execute(\"scraping-hourly-daily-distribution\",\n data)\n\n end", "title": "" }, { "docid": "2f61746315fdff95c5d78d48defabb53", "score": "0.51898396", "text": "def show\n @host = Host.find(params[:id])\n al_1=[]\n al_5=[]\n al_15=[]\n @host.records.each do |r|\n al_1<< [Time.parse(r.record_at).to_i*1000, r.average_load_1]\n al_5<< [Time.parse(r.record_at).to_i*1000, r.average_load_5]\n al_15<< [Time.parse(r.record_at).to_i*1000, r.average_load_15]\n\n end\n time=Time.now\n @h = LazyHighCharts::HighChart.new('graph') do |f|\n f.title :text=>\"All average load data\"\n f.y_axis :title=> {:text => \"Values\"}\n f.options[:x_axis]={:type=>\"datetime\"}\n f.options[:chart]={:zoomType=>\"x\"}\n f.series(:name=>'Average Load 1 min', :data=> al_1 )\n f.series(:name=>'Average Load 5 min', :data=> al_5 )\n f.series(:name=>'Average Load 15 min', :data=> al_15 )\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @host }\n end\n end", "title": "" }, { "docid": "a39d40d2ef0816adbe1c345793e77013", "score": "0.51521325", "text": "def dailyGraphs(array_daily,type)\n \n #array argument comes from params[:stat][:daily]\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Distance Traveled\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Energy Expanded\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Steps\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n end\n\n return @chart\n end", "title": "" }, { "docid": "11f999ad298a8641e8bbea4325fee987", "score": "0.51122606", "text": "def weekly_page_view_graph\n @this_start_date = Date.today.at_beginning_of_week - 1.day\n @this_end_date = Date.today.at_end_of_week - 1.day\n @last_start_date = @this_start_date - 1.week\n @last_end_date = @this_start_date - 1.day\n # NOTE: We subtract 1 day to use Sunday as the beginning of the week,\n # since this is how mysuite does it currently.\n\n @view_counts_this_week = DailyPageView.counts_for_writer_between(@user[:id], @this_start_date, @this_end_date)\n @view_counts_last_week = DailyPageView.counts_for_writer_between(@user[:id], @last_start_date, @last_end_date) \n\n render :layout => false \n end", "title": "" }, { "docid": "e02ffb7d9e4216cada7b37e8cc007231", "score": "0.5084153", "text": "def prepackage_stories\n @stories.each do |hour|\n hour.each do |datum|\n path = datum[0].dup\n hed = datum[1].dup\n visitors = datum[2] || 0\n \n if @opts[:filters]\n d = self.filter_story(hed,path)\n hed = d[:title]\n path = d[:path]\n# url = d[:url]\n url = \"http://www.#{@opts[:host]}#{path}\"\n else\n url = \"http://www.#{@opts[:host]}#{path}\"\n end\n \n if not path.nil?\n if not @uniq_stories.collect {|q| q[1] }.include?(hed)\n @uniq_stories << [url,hed,visitors]\n else\n dupe_idx = @uniq_stories.collect{|q| q[1]}.index(hed)\n @uniq_stories[dupe_idx][2] += visitors\n end \n end\n end\n end \n end", "title": "" }, { "docid": "bc16b2b30622478bda52638225c88c66", "score": "0.50823313", "text": "def phases_chart(stories)\n by_phase = stories.group_by { |s| s.phase.name } \n chart = GoogleChart::PieChart.new('500x200', \"Phase distribution\", true)\n by_phase.each { |k, v| chart.data \"#{k} (#{v.count})\", v.count }\n chart.to_url\n end", "title": "" }, { "docid": "9104c5bce91f2bd0a1b511b874208d61", "score": "0.5074033", "text": "def set_traffic\n @traffic = Traffic.find(params[:id])\n end", "title": "" }, { "docid": "9104c5bce91f2bd0a1b511b874208d61", "score": "0.5074033", "text": "def set_traffic\n @traffic = Traffic.find(params[:id])\n end", "title": "" }, { "docid": "0c66d18a4e759f295ec57e17b843e3db", "score": "0.5041561", "text": "def burndown_chart_data\n # Create buckets by week\n result = [ ]\n\n # Get the weeks between start and end date as an array\n # dates = unit.start_date.to_date.step(unit.end_date.to_date + 1.week, step=7).to_a\n dates = unit.start_date.to_date.step(unit.end_date.to_date + 1.week, 7).to_a\n\n # Setup the dictionaries to contain the keys and values\n # key = series name\n # values = array of [ x, y ] values\n projected_results = { key: \"Projected\", values: [] }\n target_task_results = { key: \"Target\", values: [] }\n done_task_results = { key: \"To Submit\", values: [] }\n complete_task_results = { key: \"To Complete\", values: [] }\n\n result.push(target_task_results)\n result.push(projected_results)\n result.push(done_task_results)\n result.push(complete_task_results)\n\n # Get the target task from the unit's task definitions\n target_tasks = assigned_task_defs\n\n return if target_tasks.count == 0\n\n # get total value of all tasks assigned to this project\n total = target_tasks.map{|td| td.weighting.to_f}.inject(:+)\n\n #last done task date\n if ready_or_complete_tasks.empty?\n last_target_date = unit.start_date\n else\n last_target_date = ready_or_complete_tasks.sort{|a,b| a.task_definition.target_date <=> b.task_definition.target_date }.last.task_definition.target_date\n end\n\n # today is used to determine when to stop adding done tasks\n today = reference_date\n\n # Get the tasks currently marked as done (or ready to mark)\n done_tasks = ready_or_complete_tasks\n\n # use weekly completion rate to determine projected progress\n completion_rate = weekly_completion_rate\n projected_remaining = total\n\n # Track which values to add\n add_target = true\n add_projected = true\n add_done = true\n\n # Iterate over the dates\n dates.each { |date|\n # get the target values - those from the task definitions\n target_val = [ date.to_datetime.to_i,\n target_tasks.select{|task_def| task_def.target_date > date}.map{|task_def| task_def.weighting.to_f}.inject(:+)\n ]\n # get the done values - those done up to today, or the end of the unit\n done_val = [ date.to_datetime.to_i,\n done_tasks.select{|task| (not task.completion_date.nil?) && task.completion_date <= date}.map{|task| task.task_definition.weighting.to_f}.inject(:+)\n ]\n # get the completed values - those signed off\n complete_val = [ date.to_datetime.to_i,\n completed_tasks.select{|task| task.completion_date <= date}.map{|task| task.task_definition.weighting.to_f}.inject(:+)\n ]\n # projected value is based on amount done\n projected_val = [ date.to_datetime.to_i, projected_remaining / total ]\n\n # add one week's worth of completion data\n projected_remaining -= completion_rate\n\n # if target value then its the %remaining only\n if target_val[1].nil? then target_val[1] = 0 else target_val[1] /= total end\n # if no done value then value is 100%, otherwise remaining is the total - %done\n if done_val[1].nil? then done_val[1] = 1 else done_val[1] = (total - done_val[1]) / total end\n if complete_val[1].nil? then complete_val[1] = 1 else complete_val[1] = (total - complete_val[1]) / total end\n\n # add target, done and projected if appropriate\n if add_target then target_task_results[:values].push target_val end\n if add_done\n done_task_results[:values].push done_val\n complete_task_results[:values].push complete_val\n end\n if add_projected then projected_results[:values].push projected_val end\n\n # stop adding the target values once zero target value is reached\n if add_target && target_val[1] == 0 then add_target = false end\n # stop adding the done tasks once past date - (add once for tasks done this week, hence after adding)\n if add_done && date > today then add_done = false end\n # stop adding projected values once projected is complete\n if add_projected && projected_val[1] <= 0 then add_projected = false end\n }\n\n result\n end", "title": "" }, { "docid": "ce4e7b710a4f793b26ff79e55d345af2", "score": "0.49977437", "text": "def update_traffic\n return unless Captive.traffic\n Captive.traffic.update\n @traffic_save.data_str = Captive.traffic.to_json\n end", "title": "" }, { "docid": "d03983d38a22e230877d69865a141923", "score": "0.49600232", "text": "def show\n @graph.postal = House.where(\"hems_id is ?\", @graph.hems_id).first.postal\n @chart_data = []\n if @graph.main == true\n chart = []\n House.where(\"hems_id is ?\", @graph.hems_id).first.mains.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"main\", :data => chart}\n end\n if @graph.solar_generate == true\n chart = []\n House.where(\"hems_id is ?\", @graph.hems_id).first.solar_generates.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"solar_generated\", :data => chart}\n end\n if @graph.solar_sold == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.solar_sells.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"solar_sold\", :data => chart}\n end\n if @graph.battery_charge == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.battery_charges.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"battery_charge\", :data => chart}\n end\n if @graph.battery_discharge == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.battery_discharges.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"battery_discharge\", :data => chart}\n end\n if @graph.fuel_cell == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.fuel_cells.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"fuel_cell\", :data => chart}\n end\n if @graph.gus == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.gus.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"gus\", :data => chart}\n end\n if @graph.water == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.waters.where(timestamp: @[email protected]).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"water\", :data => chart}\n end\n end", "title": "" }, { "docid": "e280bd602f4f9da8079c21b40cfd3b74", "score": "0.49555477", "text": "def monthlyGraphs(array_monthly,type)\n\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Distance Traveled\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Energy Expanded\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Steps\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n end\n end", "title": "" }, { "docid": "b7f235bbd53aa35dd6046b32ddcf3465", "score": "0.49446905", "text": "def set_hourly_histogram\n @hourly_histogram = HourlyHistogram.find(params[:id])\n end", "title": "" }, { "docid": "cb18992a11655f7ec1af613c7d371f6e", "score": "0.4904711", "text": "def create\n @hourly = Hourly.new(hourly_params)\n\n respond_to do |format|\n if @hourly.save\n format.html { redirect_to @hourly, notice: 'Hourly was successfully created.' }\n format.json { render :show, status: :created, location: @hourly }\n else\n format.html { render :new }\n format.json { render json: @hourly.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9ec9b4099a8cdad383df5513f979291", "score": "0.48961687", "text": "def activity\n# logger.debug( \"* Activity graph for Project ID: #{params[:id]}\" )\n @project_id = params[:id]\n project = Project.find_by_id( @project_id )\n redirect_to( projects_path() ) and return unless project\n\n @project_name = project.name\n # Retrieve all the data rows for the chart graph, assuring that each date entry is unique (and cumulative)\n grouped_by_date_rows = ProjectRow.where( :project_id => @project_id ).select( \"date_format(date_entry, '%Y-%m-%d') as single_date_entry, sum(std_hours) as std_hours_tot, sum(ext_hours) as ext_hours_tot\" ).group( :single_date_entry )\n # Retrieve also the data rows for the pie graph, grouping by each human resource:\n grouped_by_resource_rows = ProjectRow.where( :project_id => @project_id ).select( \"human_resources.name as resource, sum(std_hours) as std_hours_tot, sum(ext_hours) as ext_hours_tot\" ).joins( :human_resource ).group( :human_resource_id )\n\n array_of_date_rows = grouped_by_date_rows.collect {|row| row.serializable_hash }\n array_of_resource_rows = grouped_by_resource_rows.collect {|row| row.serializable_hash }\n\n # [Steve, 20120215] The localized name for the field, to be displayable inside the chart legend must\n # be a single word with no special chars in it (no dots, comma, parenthesis, ...)\n @resource_name = I18n.t(:resource_displayable_name, {:scope => [:project_row]})\n @date_entry_name = I18n.t(:date_entry_displayable_name, {:scope => [:project_row]})\n @std_hours_name = I18n.t(:std_hours_displayable_name, {:scope => [:project_row]})\n @ext_hours_name = I18n.t(:ext_hours_displayable_name, {:scope => [:project_row]})\n # Format each row and assign each attributes to a new hash with displayable keys:\n verbose_array = array_of_date_rows.inject([]) { |arr, e|\n arr << {\n @date_entry_name => e['single_date_entry'],\n @std_hours_name => e['std_hours_tot'].to_i,\n @ext_hours_name => e['ext_hours_tot'].to_i\n }\n }\n @project_date_rows = verbose_array.to_json.gsub(/\\\"/,\"'\")\n\n verbose_array = array_of_resource_rows.inject([]) { |arr, e|\n arr << {\n @resource_name => e['resource'],\n @std_hours_name => e['std_hours_tot'].to_i,\n @ext_hours_name => e['ext_hours_tot'].to_i\n }\n }\n @project_resource_rows = verbose_array.to_json.gsub(/\\\"/,\"'\")\n# DEBUG\n# logger.debug(\"\\r\\n\\r\\n!! ----- report_detail -----\")\n# logger.debug(\"activity params #{params.inspect}\")\n# logger.debug(\"----------------------------------------------------------\")\n# logger.debug(\"@project_date_rows: #{@project_date_rows.inspect}\")\n# logger.debug(\"----------------------------------------------------------\")\n# logger.debug(\"@project_resource_rows: #{@project_resource_rows.inspect}\")\n# logger.debug(\"----------------------------------------------------------\\r\\n\")\n @context_title = \"#{I18n.t(:project_activity_for)} \\'#{@project_name}\\'\"\n end", "title": "" }, { "docid": "59fee827f36287b9d1ad2d2a56ebbc67", "score": "0.48908392", "text": "def hour_metrics; end", "title": "" }, { "docid": "4b796430093f834a2022139191f1f544", "score": "0.48830917", "text": "def hour_metrics=(_arg0); end", "title": "" }, { "docid": "00bb8283f9b1454458f491a7edc35031", "score": "0.4860187", "text": "def prepaid_traffic\n super\n end", "title": "" }, { "docid": "c4c7ce0ac35d65b92f935759e3aab92f", "score": "0.48558575", "text": "def generate_report(resolution_unit, sample_count, resolution)\n infos = [\"Status\", \"Push Outcome\", \"App Online\", \"Push Duration\", \"Latency\"]\n\n framework_services = get_frameworks_services\n framework_services << {:name => \"All\", :framework => \"All\", :service => \"All\"}\n framework_services = framework_services.sort { |service_first, service_second| [service_first[:framework], service_first[:service]] <=> [service_second[:framework], service_second[:service]] }\n\n # prepares the header of the report\n header = [\"Info\", \"Framework\", \"Service\", \"Uptime\"]\n dashboard = Array.new\n framework_services.each do |sla|\n infos.each do |info|\n dashboard << {:info => info, :name => sla[:name], :framework => sla[:framework], :service => sla[:service], :uptime => 0, :sum_app_online => 0, :sum_app_count => 0}\n end\n end\n\n # calibrates DateTime to UTC\n current_time = DateTime.current.new_offset(Rational(0, 24))\n current_time_start = current_time.change({:min => 0, :sec => 0})\n\n minutes = ((current_time - current_time_start) * 24 * 60).to_i\n current_time = minutes > 30 ? current_time.change({:min => 30, :sec => 0}) : current_time_start\n\n xy_sum_all_app_online, xy_sum_all_app_count = 0, 0\n sample_count_i = sample_count\n while sample_count_i > 0\n time_from = current_time.advance(:\"#{resolution_unit}\" => resolution * -1 * sample_count_i)\n time_to = time_from.advance(:\"#{resolution_unit}\" => resolution)\n t0_string = time_from.to_s\n\n y_all_count, y_all_status, y_all_push_outcome, y_all_app_online, y_all_duration, y_all_latency = 0, 0, 0, 0, 0, 0\n x_sum_app_online, x_sum_app_count = 0, 0\n applications = get_apps(time_from, time_to)\n\n # compute report content fields\n dashboard.each do |item|\n if (item[:framework] != \"All\" && item[:service] != \"All\")\n\n app_hash = applications.select do |app|\n app_timestamp = app.timestamp\n app.name.include?(item[:name]) &&\n app_timestamp < time_to &&\n app_timestamp >= time_from\n end\n\n app_hash_count = app_hash.count\n if app_hash_count > 0\n\n push_outcome = app_hash.inject(0.0) { |result, element| result + element.push_status }\n app_online = app_hash.inject(0.0) { |result, element| result + element.http_status }\n duration = app_hash.inject(0.0) { |result, element| result + element.duration }\n latency = app_hash.inject(0.0) { |result, element| result + element.latency }\n status = app_hash.inject(0.0) { |result, element| result + (element.push_status * element.http_status) }\n\n case item[:info]\n when \"Status\"\n item[:\"#{t0_string}\"] = (status / app_hash_count).round(6)\n y_all_count = y_all_count + app_hash_count\n y_all_status = y_all_status + status\n y_all_app_online = y_all_app_online + app_online\n y_all_push_outcome = y_all_push_outcome + push_outcome\n y_all_duration = y_all_duration + duration\n y_all_latency = y_all_latency + latency\n x_sum_app_online = item[:sum_app_online] + app_online\n x_sum_app_count = item[:sum_app_count] + app_hash_count\n xy_sum_all_app_online = xy_sum_all_app_online + app_online\n xy_sum_all_app_count = xy_sum_all_app_count + app_hash_count\n when \"Push Outcome\"\n item[:\"#{t0_string}\"] = (push_outcome / app_hash_count).round(6)\n when \"App Online\"\n item[:\"#{t0_string}\"] = (app_online / app_hash_count).round(6)\n when \"Push Duration\"\n item[:\"#{t0_string}\"] = (duration / app_hash_count).round(6)\n when \"Latency\"\n item[:\"#{t0_string}\"] = (latency / app_hash_count).round(6)\n else\n item[:\"#{t0_string}\"] = \"\"\n end\n\n item[:sum_app_online] = x_sum_app_online\n item[:sum_app_count] = x_sum_app_count\n item[:uptime] = (100 * (x_sum_app_online / x_sum_app_count)).round(4) unless x_sum_app_count == 0\n else\n item[:\"#{t0_string}\"] = nil\n end\n end\n end\n\n # compute report summary fields fro all frameworks and all services\n dashboard.select { |element| element[:framework] == \"All\" && element[:service] == \"All\" }.inject([]) { |result, item_all|\n if (y_all_count != 0)\n case item_all[:info]\n when \"Status\"\n item_all[:\"#{t0_string}\"] = (y_all_status / y_all_count).round(6)\n when \"Push Outcome\"\n item_all[:\"#{t0_string}\"] = (y_all_push_outcome / y_all_count).round(6)\n when \"App Online\"\n item_all[:\"#{t0_string}\"] = (y_all_app_online / y_all_count).round(6)\n when \"Push Duration\"\n item_all[:\"#{t0_string}\"] = (y_all_duration / y_all_count).round(6)\n when \"Latency\"\n item_all[:\"#{t0_string}\"] = (y_all_latency / y_all_count).round(6)\n else\n item_all[:\"#{t0_string}\"] = \"\"\n end;\n item_all[:uptime] = (100 * (xy_sum_all_app_online / xy_sum_all_app_count)).round(4)\n else\n item_all[:\"#{t0_string}\"] = nil\n end\n result\n }\n\n header << t0_string\n\n sample_count_i = sample_count_i -1\n end\n\n # removes unused fields from result\n dashboard.each do |hash|\n hash.delete(:name)\n hash.delete(:sum_app_online)\n hash.delete(:sum_app_count)\n end\n\n sort_keys = {}\n infos.each_with_index do |info, index|\n sort_keys[info] = index\n end\n\n # sort report\n dashboard.sort! do |first, second|\n first_framework = first[:framework]\n first_service = first[:service]\n second_framework = second[:framework]\n second_service = second[:service]\n if (first_framework == 'All') && (second_framework != 'All')\n -1\n elsif (second_framework == 'All') && (first_framework != 'All')\n 1\n elsif first_framework == second_framework && first_service == second_service\n sort_keys[first[:info]] < sort_keys[second[:info]] ? -1 : 1\n else\n [first_framework, first_service] <=> [second_framework, second_service]\n end\n end\n\n return header, dashboard\nend", "title": "" }, { "docid": "73832c21fad176c42df32b345b07fb19", "score": "0.4850218", "text": "def performed_per_hour\n timeseries_data(:performed, 24, :hours)\n end", "title": "" }, { "docid": "aacbd59bbd78126e0d97f09832c055a4", "score": "0.48494932", "text": "def traffic_params\n params.require(:traffic).permit(:record_date, :page_views_per_million, :page_views_per_user, :rank, :reach_per_million)\n end", "title": "" }, { "docid": "cb41e60b6f8dfbdb035a63657912b605", "score": "0.48477116", "text": "def create\n @hourly_histogram = HourlyHistogram.new(hourly_histogram_params)\n\n respond_to do |format|\n if @hourly_histogram.save\n format.html { redirect_to @hourly_histogram, notice: 'Hourly histogram was successfully created.' }\n format.json { render :show, status: :created, location: @hourly_histogram }\n else\n format.html { render :new }\n format.json { render json: @hourly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3db369328fac0649fb6d4a3891b5945", "score": "0.48316008", "text": "def set_trafficdatum\n @trafficdatum = Trafficdatum.find(params[:id])\n end", "title": "" }, { "docid": "3ad488de3fc488d092386baa7606f9b2", "score": "0.48275355", "text": "def perf_top_chart\n return if perfmenu_click?\n\n @record = identify_tl_or_perf_record\n @perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record\n if params[:menu_choice]\n chart_click_data = parse_chart_click(params[:menu_choice])\n report = @sb[:chart_reports].kind_of?(Array) ? @sb[:chart_reports][chart_click_data.chart_index] : @sb[:chart_reports]\n data_row = report.table.data[chart_click_data.data_index]\n top_ids = if @perf_options[:cat]\n data_row[\"assoc_ids_#{report.extras[:group_by_tags][chart_click_data.legend_index]}\"][chart_click_data.model.downcase.to_sym][:on]\n else\n data_row[\"assoc_ids\"][chart_click_data.model.downcase.to_sym][:on]\n end\n @perf_options[:top_model] = chart_click_data.model.singularize.capitalize\n @perf_options[:top_type] = chart_click_data.type # day or hour\n @perf_options[:top_ts] = data_row[\"timestamp\"].utc\n @perf_options[:top_ids] = top_ids\n end\n @perf_options[:index] = params[:chart_idx] == \"clear\" ? nil : params[:chart_idx] if params[:chart_idx]\n @showtype = \"performance\"\n if request.xml_http_request? # Is this an Ajax request?\n perf_gen_top_data # Generate top data\n return unless @charts # Return if no charts got created (first time thru async rpt gen)\n\n render :update do |page|\n page << javascript_prologue\n page << 'ManageIQ.charts.chartData = ' + {\"candu\" => @chart_data}.to_json + ';'\n page.replace(\"candu_charts_div\",\n :partial => \"layouts/perf_charts\",\n :locals => {:chart_data => @chart_data, :chart_set => \"candu\"})\n page << ManageIQ::Reporting::Charting.js_load_statement\n page << 'miqSparkle(false);'\n end\n else\n drop_breadcrumb(\n :name => params[:bc],\n :url => url_for_only_path(\n :id => @perf_record.id,\n :action => \"perf_top_chart\",\n :bc => params[:bc],\n :escape => false\n )\n )\n @ajax_action = \"perf_top_chart\"\n render :action => \"show\"\n end\n end", "title": "" }, { "docid": "26fb1806c83e51e84a5bc3df3f9b3e0b", "score": "0.48268682", "text": "def record_traffic(metrics, name, packets, bytes)\n metrics[\"#{name} packets\"] = packets.to_i\n metrics[\"#{name} bytes\"] = bytes.to_i\n metrics\n end", "title": "" }, { "docid": "b54fa9b067901640870261a76eac6f6d", "score": "0.48210832", "text": "def analytics_send_data\n if(Hit.count > 0)\n # Assume that the first and last objects correspond to\n # first and last hits made.\n first_date = Hit.first.as_json['date_created'].strftime(\"%d-%m-%Y\")\n last_date = Hit.last.as_json['date_created'].strftime(\"%d-%m-%Y\")\n \n summary_data = {\n start_date: first_date,\n end_date: last_date,\n hits: summarize_hits\n }\n \n Bloghistory::analytics_email(\n first_date, \n last_date, \n summary_data\n ).deliver\n Hit.delete_all\n redirect_to(analytics_path)\n else\n flash.now[:danger] = \"No analytics data to send.\"\n end\n end", "title": "" }, { "docid": "ad6b4b52c80f488bdaa280f633f97c37", "score": "0.48196557", "text": "def line_graph_report\n g=line_graph(\"toto\")\n g.x_axis_label = \"Domaine\"\n g.y_axis_label = 'Nb VM'\n g.title = \"host repartition\" \n @data=Hardware.sum('virtualmachines.MEMORY', :joins => [:virtualmachine], :group => \"hardware.WORKGROUP\")\n # @data=Hardware.count_distribution :workgroup\n g.labels = { 0 => 'Mon', 1 => 'Wed', 2 => 'Fri', 3 => 'Sun' }\n # g.y_axis_increment = 10\n @data.sort.each do |d|\n g.data(d[0],d[1])\n end\n g.minimum_value = 0\n \n send_data(g.to_blob, \n :disposition => 'inline', \n :type => 'image/png')\n\n end", "title": "" }, { "docid": "2706f301b8e9d727e5a8b60ae3259e88", "score": "0.48165464", "text": "def test_render_calculates_hour_boundary\n today1 = Time.new(2012, 1, 31, 15) # Today at 3:00pm\n @timelog.record_activity('Arrived', today1)\n today2 = Time.new(2012, 1, 31, 16) # Today at 4:00pm\n @timelog.record_activity('Writing a test', today2)\n Timelog::DailyReport.render(@timelog, @output, Time.new(2012, 1, 31))\n assert_equal(\"1 h 00 min Writing a test\\n\" <<\n \"\\n\" <<\n \"Time spent working: 1 h 00 min\\n\" <<\n \"Time spent slacking: 0 h 00 min\\n\" <<\n \"Time left at work: 7 h 00 min\\n\",\n @output.string)\n end", "title": "" }, { "docid": "ec6178e6262917d7950ea20468bd477a", "score": "0.48093316", "text": "def show\n @host = Host.find_by_host(params[:id])\n @organisation = @host.site.organisation\n @total_data = WeeklyTotalData.new(@host.weekly_totals, Date.new(2012,10,17)..Date.today)\n @most_recent_hit_data = MostRecentHitData.new(@host.hits, @host.hits.most_recent_hit_on_date)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @host }\n end\n end", "title": "" }, { "docid": "53a23660ca9eefb2d658f69ce1e2715d", "score": "0.48011273", "text": "def send_chart info, period, building_id, from_date, to_date\n\t queryResult = Building.connection.execute(\"CALL powerstorm_data.advancedChartBy#{period}(#{building_id}, '#{from_date}', '#{to_date}');\")\n\t #.to_a.transpose.first.collect { |i| (i * 100).to_i / 100.0 }\n\t data = Hash.new\n\t queryResult.each do |tuple|\n\t\tinfo[:date_times].push tuple[1]\n\t\tinfo[:power_usages].push tuple[0]\n\t end\n\t info\n end", "title": "" }, { "docid": "93c215bd3e2acbe9c57f68dc77498199", "score": "0.47924533", "text": "def gatherHourVisitor\n now,last_hour_start,last_hour_end = Util.hour_query_time\n pv = @client.query(\"select count(id) from visitors where site_id=#{@site_id} and created_at >= #{last_hour_start} and created_at <= #{last_hour_end}\").fetch_row[0]\n ipv = @client.query(\"select count(distinct ip_id) from visitors where site_id=#{@site_id} and created_at >= #{last_hour_start} and created_at <= #{last_hour_end}\").fetch_row[0]\n\n r = @client.query(\"select count(id) from site_hour_gather where site_id=#{@site_id} and hour_time=#{last_hour_start}\").fetch_row[0].to_i\n if(r == 0)\n @stmt.prepare(\"insert into site_hour_gather(site_id,pv,ipv,hour_time,created_at) \"+\n \" values(?,?,?,?,?)\" )\n @stmt.execute(@site_id,pv,ipv,last_hour_start,now)\n else\n @stmt.prepare(\"update site_hour_gather set pv=?,ipv=?,created_at=? where site_id=? and hour_time=?\")\n @stmt.execute(pv,ipv,now,@site_id,last_hour_start)\n end\n end", "title": "" }, { "docid": "47ce06dcb4915133bfc79af1b91a84c9", "score": "0.4789886", "text": "def twelve_week_page_view_graph\n @start_date = Date.today.at_beginning_of_week - 11.weeks\n view_counts = DailyPageView.counts_for_writer_between(@user[:id], @start_date, Date.today)\n @view_counts_by_week = []\n view_counts.in_groups_of(7, false) do |week_counts|\n @view_counts_by_week << week_counts.sum\n end\n\n render :layout => false \n end", "title": "" }, { "docid": "d4aff3c143c1cfb6b67a37474290fa45", "score": "0.4779754", "text": "def index\n @trafficdata = Trafficdatum.all\n end", "title": "" }, { "docid": "bbe4aa02773ce07401c23072e6d12488", "score": "0.47728345", "text": "def hourly_forecast\n weather_data[:hourly][:data].map do |forecast_data|\n Forecast.new(forecast_data)\n end\n end", "title": "" }, { "docid": "06dfadbc4c71401244b6e5de2c95d38f", "score": "0.47726697", "text": "def index\n @traffics = Traffic.all\n end", "title": "" }, { "docid": "e3e343d8c5eb90afa6fcdfbd0b6b14bd", "score": "0.47642624", "text": "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", "title": "" }, { "docid": "42979600f73118cb0ff8cb54ca5f8f57", "score": "0.472883", "text": "def genRoadTraffic(road_name, desc)\n objs_to_process = traffic_lexical(road_name, desc)\n #objs_to_process = [{:desc=>from_ref, :poi => startPoi}, {:desc => to_ref, :poi => endPoi}]\n start_lat_lng = get_lat_lng(road_name, objs_to_process[0][:poi][:ref])\n end_lat_lng = get_lat_lng(road_name, objs_to_process[1][:poi][:ref])\n road_traffic = RoadTraffic.new :desc => desc, :rn => road_name,\n \t\t\t\t:s_poi_ref => objs_to_process[0][:poi][:ref], :s_poi_reftype => objs_to_process[0][:poi][:ref_type], \n \t\t\t\t:s_poi_lat => start_lat_lng[:lat], :s_poi_lng => start_lat_lng[:lng],\n \t\t\t\t:e_poi_ref => objs_to_process[1][:poi][:ref], :e_poi_reftype => objs_to_process[1][:poi][:ref_type], \n \t\t\t\t:e_poi_lat => end_lat_lng[:lat], :e_poi_lng => end_lat_lng[:lng]\nend", "title": "" }, { "docid": "331b600d75f029df0e62399abf355c1f", "score": "0.4727626", "text": "def index\n projects = current_user.tasks + current_user.projects\n names = projects.map(&:name)\n hours = []\n projects.each do |p|\n h = 0\n p.tracks.each do |t|\n h += (t.end - t.start) / 60 / 60 if t.end\n end\n hours << h\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: \"Hours spent on your pojects\")\n f.xAxis(categories: names)\n f.series(name: \"Spent hours\", yAxis: 0, data: hours)\n\n f.yAxis [\n { title: { text: \"Spent hours\", margin: 70 } }\n ]\n\n f.legend(align: 'right', verticalAlign: 'top', y: 75, x: -50, layout: 'vertical')\n f.chart(defaultSeriesType: \"column\")\n end\n end", "title": "" }, { "docid": "96230d8b49d9f2609c86db7417ea6005", "score": "0.47274968", "text": "def live_network_chart(query = \"bytes\", timeout = 10)\n last_data = Request.live_network(query, timeout)\n\n network = LazyHighCharts::HighChart.new('spline') do |f|\n f.series(:name => \"HOLA\", :data => [{:x => last_data[1], :y => last_data[0]}])\n\n f.options[:chart][:defaultSeriesType] = \"spline\"\n f.options[:legend][:style] = {}\n f.options[:title] = \"\"\n\n f.options[:chart][:events] = {}\n\n end\n network\n\n end", "title": "" }, { "docid": "5b3b96e213191fd459a361bd8b87cc4f", "score": "0.47257987", "text": "def livechart\n # our data comes from the DB\n # our roast profile ID is in params\n\n @title = \"Roast ID #{params[:roast_id]}\"\n @subtitle = \"Created by JSK\"\n\n @chart = Chart.new\n @chart.show_BT = true\n @chart.show_ET = true\n @chart.show_BT_ROR = true\n\n @data = \"\"\n RoastLogItem.where(roast_id: params[:roast_id]).order(:id).each do |item|\n @data << \"[#{item.t},#{item.bt},#{item.et},#{item.ror}],\\n\"\n end\n\n end", "title": "" }, { "docid": "7aea733a6b25bb136226aae738f47546", "score": "0.4722999", "text": "def daily_local_traffic_chart\n Gchart.bar(:size => CHART_SIZE,\n :title => 'Average Daily Local Traffic',\n :data => [2,0,0,1,0,2,8,26,20,18,12,14,32,28,12,15,20,14,20,32,36,22,8,4],\n :axis_with_labels => 'x',\n :axis_labels => ['12AM','6AM','12PM','6PM'],\n :bar_width_and_spacing => 5,\n :bar_colors => 'blue',\n :bg => 'white')\n end", "title": "" }, { "docid": "7092881af03cb47e4b66b04fe4b158db", "score": "0.4701711", "text": "def generate_report report_id = nil\n if self.time_scope == 'Yesterday' then\n date_range = 1.day.ago.at_beginning_of_day..DateTime.now.at_beginning_of_day\n elsif self.time_scope == 'Last Week' then\n date_range = 1.week.ago.at_beginning_of_week..1.week.ago.at_end_of_week\n else\n date_range = 1.month.ago.at_beginning_of_month..1.month.ago.at_end_of_month\n end\n \n report_text = Hash.new\n\n YAML::load(self.monitored_obj).keys.each do |licserver_id|\n server_report = Hash.new\n\n #generate stats for all hours\n error_margin = Licserver.find(licserver_id.to_s).features.where{\n (created_at.in date_range)\n }.count.to_f * 0.01\n all_hours_dump = Licserver.find(licserver_id.to_s.to_i).features.where{\n (created_at.in date_range)\n }.select{ [name, max, sum(current).as(total_current), sum(max).as(total_max), count(max).as(max_count) ] }.\n group( :name, :max ).\n having{ count(name) > error_margin }.\n map{ |x| [ x.name, x.max, x.total_current, x.total_max, x.max_count ] }\n server_report = server_report.merge({ :all_hours => all_hours_dump } )\n\n #generate stats for office hours\n error_margin = Licserver.find(licserver_id.to_s).features.where{\n ( to_char( created_at, 'HH24:MI:SS') > '01:00:00' ) & \n ( to_char( created_at, 'HH24:MI:SS' ) < '10:00:00' ) & \n ( to_char( created_at, 'D') != 1 ) & ( to_char( created_at, 'D' ) != 7 ) & \n (created_at.in date_range)\n }.count.to_f * 0.01\n office_hours_dump = Licserver.find(licserver_id.to_s.to_i).features.where{\n # 0800 to 1700 malaysia time because data is stored in UTC\n ( to_char( created_at, 'HH24:MI:SS') > '01:00:00' ) & \n ( to_char( created_at, 'HH24:MI:SS' ) < '10:00:00' ) & \n ( to_char( created_at, 'D') != 1 ) & ( to_char( created_at, 'D' ) != 7 ) & \n (created_at.in date_range)\n }.select{ [name, max, sum(current).as(total_current), sum(max).as(total_max), count(max).as(max_count) ] }.\n group( :name, :max).\n having{ count(name) > error_margin }.\n map{ |x| [ x.name, x.max, x.total_current, x.total_max, x.max_count ] }\n server_report = server_report.merge({ :office_hours => office_hours_dump } )\n\n report_text = report_text.merge( { licserver_id.to_sym => server_report } )\n end\n\n #build the actual reports\n if report_id.nil? then \n new_report = self.reports.new( :title => self.title,\n :body => report_text.to_yaml,\n :start_date => date_range.first, :end_date => date_range.last\n )\n else\n #for some insane reason, generating a new report works, but updating a current report doesn't\n new_report = self.reports.find(report_id)\n new_report.update_attribute(:body ,nil)\n new_report.save!\n new_report.update_attribute(:body ,report_text.to_yaml)\n new_report.save!\n new_report.update_attributes( :title => self.title,\n :start_date => date_range.first, :end_date => date_range.last\n )\n end\n\n new_report.save!\n\n end", "title": "" }, { "docid": "b9bd872d745393baf5d8d7b1e6ff7448", "score": "0.46975267", "text": "def highchart_time_line(blood_pressures)\n @timeline = LazyHighCharts::HighChart.new('graph') do |f|\n f.title({ :text => \"Blood Pressure\" })\n f.chart(defaultSeriesType: \"timeseries\")\n\n f.options[:xAxis] = { type: \"datetime\" }\n f.options[:xAxis][:title] = { text: \"Date\" }\n f.options[:legend] = { enabled: false }\n\n f.series(type: 'line', name: 'Systolic', \n data: blood_pressures.map { |bp| [ bp[:date], bp[:systolic] ] })\n f.series(type: 'line', name: 'Diastolic', \n data: blood_pressures.map { |bp| [ bp[:date], bp[:diastolic] ] })\n end\n end", "title": "" }, { "docid": "ce3f320032411574768c78adfeb32060", "score": "0.46972147", "text": "def getchart()\n # The data for the chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n labels = [\"Mon Jun 4\", \"Tue Jun 5\", \"Wed Jun 6\", \"Thu Jun 7\", \"Fri Jun 8\"]\n\n # Create a XYChart object of size 540 x 350 pixels\n c = ChartDirector::XYChart.new(540, 350)\n\n # Set the plot area to start at (120, 40) and of size 280 x 240 pixels\n c.setPlotArea(120, 40, 280, 240)\n\n # Add a title to the chart using 20 pts Times Bold Italic (timesbi.ttf) font and\n # using a deep blue color (0x000080)\n c.addTitle(\"Weekly Server Load\", \"timesbi.ttf\", 20, 0x000080)\n\n # Add a legend box at (420, 100) (right of plot area) using 12 pts Times Bold\n # font. Sets the background of the legend box to light grey 0xd0d0d0 with a 1\n # pixel 3D border.\n c.addLegend(420, 100, true, \"timesbd.ttf\", 12).setBackground(0xd0d0d0, 0xd0d0d0, 1\n )\n\n # Add a title to the y-axis using 12 pts Arial Bold/deep blue (0x000080) font. Set\n # the background to yellow (0xffff00) with a 2 pixel 3D border.\n c.yAxis().setTitle(\"Throughput (per hour)\", \"arialbd.ttf\", 12, 0x000080\n ).setBackground(0xffff00, 0xffff00, 2)\n\n # Use 10 pts Arial Bold/orange (0xcc6600) font for the y axis labels\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 10, 0xcc6600)\n\n # Set the axis label format to \"nnn MBytes\"\n c.yAxis().setLabelFormat(\"{value} MBytes\")\n\n # Use 10 pts Arial Bold/green (0x008000) font for the x axis labels. Set the label\n # angle to 45 degrees.\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 10, 0x008000).setFontAngle(45)\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Add a 3D stack bar layer with a 3D depth of 5 pixels\n layer = c.addBarLayer2(ChartDirector::Stack, 5)\n\n # Use Arial Italic as the default data label font in the bars\n layer.setDataLabelStyle(\"ariali.ttf\")\n\n # Use 10 pts Times Bold Italic (timesbi.ttf) as the aggregate label font. Set the\n # background to flesh (0xffcc66) color with a 1 pixel 3D border.\n layer.setAggregateLabelStyle(\"timesbi.ttf\", 10).setBackground(0xffcc66,\n ChartDirector::Transparent, 1)\n\n # Add the first data set to the stacked bar layer\n layer.addDataSet(data0, -1, \"Server #1\")\n\n # Add the second data set to the stacked bar layer\n layer.addDataSet(data1, -1, \"Server #2\")\n\n # Add the third data set to the stacked bar layer, and set its data label font to\n # Arial Bold Italic.\n textbox = layer.addDataSet(data2, -1, \"Server #3\").setDataLabelStyle(\"arialbi.ttf\"\n )\n\n # Set the data label font color for the third data set to yellow (0xffff00)\n textbox.setFontColor(0xffff00)\n\n # Set the data label background color to the same color as the bar segment, with a\n # 1 pixel 3D border.\n textbox.setBackground(ChartDirector::SameAsMainColor, ChartDirector::Transparent,\n 1)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "ab546c830f660fd28516204420161a5e", "score": "0.46939006", "text": "def generate_day_graph(authority_name: ALL_AUTH, action:, data:)\n gruff_data = rework_performance_data_for_gruff(data, BY_HOUR)\n create_gruff_graph(gruff_data,\n performance_graph_full_path(authority_name, action, FOR_DAY),\n I18n.t('qa_server.monitor_status.performance.x_axis_hour'))\n end", "title": "" }, { "docid": "70d4851d49404506238d2ea1c364d9b9", "score": "0.46933514", "text": "def new_domain_stats\n @domains = Domain.accessible_by(current_ability).order(:name)\n @traffic_sources = TrafficSource.order(:name)\n @dimensions_list = {'Date' => 'ga:date', 'Source' => 'ga:source', 'Article' => 'ga:pagePathLevel1', 'Device' => 'ga:deviceCategory', 'Campaign' => 'ga:campaign'}\n dimensions = params[:dimensions] || %w{ga:date}\n dimensions = dimensions.join(',')\n @ecpm = {}\n @cost = {}\n\n if params[:domain_id].present? and params[:traffic_source_id].present?\n @stats = DomainStat.get_google_analytics(params[:domain_id], params[:traffic_source_id], dimensions, 'ga:sessions,ga:pageviews,ga:avgTimeonSite,ga:bounceRate', cookies[:start].to_date.to_s(:db), cookies[:end].to_date.to_s(:db))\n page_views = DomainStat.get_google_analytics(params[:domain_id], nil, 'ga:date', 'ga:pageviews', cookies[:start].to_date.to_s(:db), cookies[:end].to_date.to_s(:db))\n sessions = DomainStat.get_google_analytics(params[:domain_id], params[:traffic_source_id], 'ga:date', 'ga:sessions', cookies[:start].to_date.to_s(:db), cookies[:end].to_date.to_s(:db))\n sessions_by_date = sessions[:rows].each_with_object({}) { |u,h| h[u['date']] = u['sessions'] }\n\n page_views[:rows].each do |page_view|\n date = page_view['date']\n revenue = Revenue.accessible_by(current_ability).select('sum(amount) as amount').where(date: date).by_domain(params[:domain]).first\n if revenue.present? and revenue.amount.present?\n @ecpm[date] = revenue.amount / ((page_view['pageviews'].to_f * 6) / 1000)\n else\n @ecpm[date] = 0\n end\n end\n\n @stats[:rows].each do |stat|\n date = stat['date']\n spend = Spend.accessible_by(current_ability).select('amount').where(date: date, traffic_source_id: params[:traffic_source_id]).by_domain(params[:domain_id]).first\n\n percent_of_total = stat['sessions'].to_f / sessions_by_date[date].to_f\n\n if spend.present? and spend.amount.present?\n stat['cost'] = spend.amount * percent_of_total\n stat['cpc'] = stat['cost'].to_f / stat['sessions'].to_f\n else\n stat['cost'] = 0\n stat['cpc'] = 0\n end\n if @ecpm[date].present?\n stat['revenue'] = ((stat['pageviews'].to_f * 6) / 1000) * @ecpm[date]\n stat['rps'] = stat['revenue'] / stat['sessions'].to_f\n else\n stat['revenue'] = 0\n stat['rps'] = 0\n end\n if stat['revenue'] > 0 and stat['cost'] > 0\n stat['roi'] = ((stat['revenue'] - stat['cost']) / stat['cost']) * 100\n else\n stat['roi'] = 0\n end\n end\n end\n\n render 'reports/new_domain_stats'\n end", "title": "" }, { "docid": "cdcb78ae46b60b14b72cf475b60e81a4", "score": "0.4681963", "text": "def getchart()\n # the names of the tasks\n labels = [\"Market Research\", \"Define Specifications\", \"Overall Archiecture\",\n \"Project Planning\", \"Detail Design\", \"Software Development\", \"Test Plan\",\n \"Testing and QA\", \"User Documentation\"]\n\n # the planned start dates and end dates for the tasks\n startDate = [Time.mktime(2004, 8, 16), Time.mktime(2004, 8, 30), Time.mktime(2004,\n 9, 13), Time.mktime(2004, 9, 20), Time.mktime(2004, 9, 27), Time.mktime(2004,\n 10, 4), Time.mktime(2004, 10, 25), Time.mktime(2004, 11, 1), Time.mktime(2004,\n 11, 8)]\n endDate = [Time.mktime(2004, 8, 30), Time.mktime(2004, 9, 13), Time.mktime(2004,\n 9, 27), Time.mktime(2004, 10, 4), Time.mktime(2004, 10, 11), Time.mktime(2004,\n 11, 8), Time.mktime(2004, 11, 8), Time.mktime(2004, 11, 22), Time.mktime(2004,\n 11, 22)]\n\n # the actual start dates and end dates for the tasks up to now\n actualStartDate = [Time.mktime(2004, 8, 16), Time.mktime(2004, 8, 27),\n Time.mktime(2004, 9, 9), Time.mktime(2004, 9, 18), Time.mktime(2004, 9, 22)]\n actualEndDate = [Time.mktime(2004, 8, 27), Time.mktime(2004, 9, 9), Time.mktime(\n 2004, 9, 27), Time.mktime(2004, 10, 2), Time.mktime(2004, 10, 8)]\n\n # Create a XYChart object of size 620 x 280 pixels. Set background color to light\n # green (ccffcc) with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(620, 280, 0xccffcc, 0x000000, 1)\n\n # Add a title to the chart using 15 points Times Bold Itatic font, with white\n # (ffffff) text on a dark green (0x6000) background\n c.addTitle(\"Mutli-Layer Gantt Chart Demo\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x006000)\n\n # Set the plotarea at (140, 55) and of size 460 x 200 pixels. Use alternative\n # white/grey background. Enable both horizontal and vertical grids by setting\n # their colors to grey (c0c0c0). Set vertical major grid (represents month\n # boundaries) 2 pixels in width\n c.setPlotArea(140, 55, 460, 200, 0xffffff, 0xeeeeee, ChartDirector::LineColor,\n 0xc0c0c0, 0xc0c0c0).setGridWidth(2, 1, 1, 1)\n\n # swap the x and y axes to create a horziontal box-whisker chart\n c.swapXY()\n\n # Set the y-axis scale to be date scale from Aug 16, 2004 to Nov 22, 2004, with\n # ticks every 7 days (1 week)\n c.yAxis().setDateScale(Time.mktime(2004, 8, 16), Time.mktime(2004, 11, 22),\n 86400 * 7)\n\n # Add a red (ff0000) dash line to represent the current day\n c.yAxis().addMark(Time.mktime(2004, 10, 8), c.dashLineColor(0xff0000,\n ChartDirector::DashLine))\n\n # Set multi-style axis label formatting. Month labels are in Arial Bold font in\n # \"mmm d\" format. Weekly labels just show the day of month and use minor tick (by\n # using '-' as first character of format string).\n c.yAxis().setMultiFormat(ChartDirector::StartOfMonthFilter(),\n \"<*font=arialbd.ttf*>{value|mmm d}\", ChartDirector::StartOfDayFilter(),\n \"-{value|d}\")\n\n # Set the y-axis to shown on the top (right + swapXY = top)\n c.setYAxisOnRight()\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Reverse the x-axis scale so that it points downwards.\n c.xAxis().setReverse()\n\n # Set the horizontal ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Use blue (0000aa) as the color for the planned schedule\n plannedColor = 0x0000aa\n\n # Use a red hash pattern as the color for the actual dates. The pattern is created\n # as a 4 x 4 bitmap defined in memory as an array of colors.\n actualColor = c.patternColor([0xffffff, 0xffffff, 0xffffff, 0xff0000, 0xffffff,\n 0xffffff, 0xff0000, 0xffffff, 0xffffff, 0xff0000, 0xffffff, 0xffffff,\n 0xff0000, 0xffffff, 0xffffff, 0xffffff], 4)\n\n # Add a box whisker layer to represent the actual dates. We add the actual dates\n # layer first, so it will be the top layer.\n actualLayer = c.addBoxLayer(actualStartDate, actualEndDate, actualColor, \"Actual\")\n\n # Set the bar height to 8 pixels so they will not block the bottom bar\n actualLayer.setDataWidth(8)\n\n # Add a box-whisker layer to represent the planned schedule date\n c.addBoxLayer(startDate, endDate, plannedColor, \"Planned\").setBorderColor(\n ChartDirector::SameAsMainColor)\n\n # Add a legend box on the top right corner (595, 60) of the plot area with 8 pt\n # Arial Bold font. Use a semi-transparent grey (80808080) background.\n b = c.addLegend(595, 60, false, \"arialbd.ttf\", 8)\n b.setAlignment(ChartDirector::TopRight)\n b.setBackground(0x80808080, -1, 2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "14910abcc5c5d245eb17135459066355", "score": "0.46801203", "text": "def build_daily_activity_time_values(array_daily,feature)\n \n arr = []\n total_looking_at_phone = total_walking = total_cycling = total_standing = total_sitting = total_tilting = total_notUsingPhone = total_laying = total_running = 0\n\n unless array_daily.nil?\n for i in 0..23\n total_looking_at_phone += (array_daily[i.to_s]['lookingAtPhone'][feature]/1000)\n total_walking += (array_daily[i.to_s]['walking'][feature]/1000)\n total_cycling += (array_daily[i.to_s]['cycling'][feature]/1000)\n total_standing += (array_daily[i.to_s]['standing'][feature]/1000)\n total_sitting += (array_daily[i.to_s]['sitting'][feature]/1000)\n total_tilting += (array_daily[i.to_s]['tilting'][feature]/1000)\n total_notUsingPhone += (array_daily[i.to_s]['notUsingPhone'][feature]/1000)\n total_laying += (array_daily[i.to_s]['laying'][feature]/1000)\n total_running += (array_daily[i.to_s]['running'][feature]/1000)\n end\n end\n \n arr_looking = ['Looking At Phone(%dh%d:%ds)' % convertSeconds_to_Hours(total_looking_at_phone),total_looking_at_phone]\n arr_walking = ['Walking(%dh%d:%ds)' % convertSeconds_to_Hours(total_walking),total_walking]\n arr_cycling = ['Cycling(%dh%d:%ds)' % convertSeconds_to_Hours(total_cycling),total_cycling]\n arr_standing = ['Standing(%dh%d:%ds)' % convertSeconds_to_Hours(total_standing),total_standing]\n arr_sitting = ['Sitting(%dh%d:%ds)' % convertSeconds_to_Hours(total_sitting),total_sitting]\n arr_tilting = ['Tilting(%dh%d:%ds)' % convertSeconds_to_Hours(total_tilting),total_tilting]\n arr_notusing = ['Not using phone(%dh%d:%ds)' % convertSeconds_to_Hours(total_notUsingPhone),total_notUsingPhone]\n arr_laying = ['Laying(%dh%d:%ds)' % convertSeconds_to_Hours(total_laying),total_laying]\n arr_running = ['Running(%dh%d:%ds)' % convertSeconds_to_Hours(total_running),total_running]\n \n arr[0] = arr_looking\n arr[1] = arr_walking\n arr[2] = arr_cycling\n arr[3] = arr_standing\n arr[4] = arr_sitting\n arr[5] = arr_tilting\n arr[6] = arr_notusing\n arr[7] = arr_laying\n arr[8] = arr_running\n \n return arr\n end", "title": "" }, { "docid": "d1eb5be1e2cae4fa8072de167581a276", "score": "0.4675012", "text": "def player_kicking_performance_chart(player)\n field_goal_attempts = player.field_goal_attempts.includes(:game).to_a\n field_goal_attempts_by_week = field_goal_attempts.group_by {|a| a.game.wk }.sort_by {|wk, attempts| wk}\n weeks = field_goal_attempts_by_week.map {|week, attempts| \"Week #{week} vs #{player.opponent_on_week(week) ||'bye'}\" }\n\n LazyHighCharts::HighChart.new('graph') do |f|\n f.title text: \"Weekly kicking performance\"\n f.chart(type: 'column')\n f.plotOptions(column: {stacking: 'normal', dataLabels: {enabled: true, color: 'white'}})\n f.yAxis(min: 0, max: 10, minPadding: 0, maxPadding: 0, startOnTick: false, tickInterval: 1, stackLabels: {enabled: true, fontWeight: 'bold'})\n f.chart(borderWidth: 1, borderColor: '#aaa', height: 500)\n f.options[:xAxis][:categories] = weeks\n f.series(type: 'column', name: '50+', color: '#468847', data: field_goal_attempts_by_week.map {|k,v| v.select(&:made?).select {|a| a.dist >= 50}.size})\n f.series(type: 'column', name: '40-49', color: '#3a87ad', data: field_goal_attempts_by_week.map {|k,v| v.select(&:made?).select {|a| (40..49).include?(a.dist) }.size})\n f.series(type: 'column', name: '0-39', color: '#f89406', data: field_goal_attempts_by_week.map {|k,v| v.select(&:made?).select {|a| a.dist < 40}.size})\n f.series(type: 'column', name: 'Missed', color: '#b94a48', data: field_goal_attempts_by_week.map {|k,v| v.select(&:missed?).size})\n end\n end", "title": "" }, { "docid": "c5b805f04ff3c7df7ee4d7ed17fa9d1b", "score": "0.46713322", "text": "def create_speed_chart_with_to_date(to_date)\n create_excel_by_story_summary(to_date)\n end", "title": "" }, { "docid": "a27caf1a0b0bc1e561da69a21f5033b1", "score": "0.46672145", "text": "def improved_line_chart(resource, usage, generation, use_totals, gen_totals, hours)\n @chart = LazyHighCharts::HighChart.new(\"spline\") do |p|\n p.title(text: resource.capitalize + \" Over Time\")\n p.xAxis(categories: hours)\n\t p.plotOptions({:spline => {:marker => {:enabled => false}}})\n usage.each {|type, values| p.series(type: 'spline', name: type.capitalize, data: values)}\n\t generation.each {|type, values| p.series(type: 'spline', name: type.capitalize, data: values)}\n p.series(type: 'spline', name: \"Cumulative Usage\", data: use_totals)\n\t p.series(type: 'spline', name: \"Cumulative Generation\", data: gen_totals)\n p.legend(:layout => 'horizontal', :style => {\n :left => 'auto',\n :bottom => 'auto',\n :right => '50px',\n :top => '100px'\n })\n end\n high_chart(resource + \"_chart\", @chart)\n end", "title": "" }, { "docid": "5b67729ed1e928b115a37cf9e94fed82", "score": "0.466503", "text": "def get_hour_data(c)\n\t\t#c = City.find 18\n\t\t# Table 4: 预报准确性月小时值评估\n\t\t# 获取过去一个月的监测小时值\n\t\tnum_day = 67\n\t\tmonitor_data_hour = ChinaCitiesHour.history_data_hour(c, num_day.days.ago.beginning_of_day)\n\t\t# 获取过去一个月的预报24,48,72,96小时值\n\t\tforecast_data_hour = HourlyCityForecastAirQuality.history_data_hour(c, num_day.days.ago.beginning_of_day, 0)\n\t\tforecast_data_hour_ann = AnnForecastData.history_data_hour(c, num_day.days.ago.beginning_of_day, 0)\n\t\t@monitor_forecast_hour_month_diff = [ {name: c.city_name+'监测值', data: (monitor_data_hour),:discrete => true } ]\n\t\tforecast_data_hour.each_index do |i|\n\t\t\t@monitor_forecast_hour_month_diff << {name: (24*(i+1)).to_s+'小时预报', data: forecast_data_hour[i], :discrete => true }\n\t\tend\n\t\tforecast_data_hour_ann.each_index do |i|\n\t\t\t@monitor_forecast_hour_month_diff << {name: (24*(i+1)).to_s+'小时预报ANN', data: forecast_data_hour_ann[i], :discrete => true }\n\t\tend\n\n\t\t# 计算监测和预报的相关系数\n\t\t@corr_data = []\n\t\t@correlation = []\n\t\tmld = add_loss_hour_data(monitor_data_hour)\n\t\tforecast_data_hour.each_index do |i|\n\t\t\tv = data_to_vector(mld,add_loss_hour_data(forecast_data_hour[i]))\n\t\t\t#@correlation << r(Hash(*v[0].flatten).values, Hash(*v[1].flatten).values)\n\t\t\t@correlation << r(v[0].map {|d| d[1]}, v[1].map {|d| d[1]})\n\t\t\t@corr_data << v\n\t\tend\n\t\tif forecast_data_hour_ann.first.length >0\n\t\t\tforecast_data_hour_ann.each_index do |i|\n\t\t\t\tv = data_to_vector(mld,add_loss_hour_data(forecast_data_hour_ann[i]))\n\t\t\t\t@correlation << r(v[0].map {|d| d[1]}, v[1].map {|d| d[1]})\n\t\t\t\t@corr_data << v\n\t\t\t\t#@correlation << r(Hash(*v[0].flatten).values, Hash(*v[1].flatten).values)\n\t\t\tend\n\t\tend\n\t\tmld\n\n\tend", "title": "" }, { "docid": "84761513de64ccb5b3d879411c338b0b", "score": "0.46581632", "text": "def create\n @trafficdatum = Trafficdatum.new(trafficdatum_params)\n\n respond_to do |format|\n if @trafficdatum.save\n format.html { redirect_to @trafficdatum, notice: 'Trafficdatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trafficdatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @trafficdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29024ded24c8516cd63b16de9f01e9d4", "score": "0.4651622", "text": "def matter_task_chart_graph_data\n\t\t@today_task=\"today\" if @parameters[\"today\"]==\"today\"\n\t\t@overdue_task=\"overdue\" if @parameters[\"overdue\"]==\"overdue\"\n\t\t@open_task=\"open_task\" if @parameters[\"open_task\"]==\"open_task\"\n\t\tmatter_tasks_count(@company_id, @employee_user_id, 'todo')\n\t\ttask_hash = get_task_and_appointment_series(@all_tasks,false,@params)\n #lawyer_view_all_matter_tasks2(current_company.id,get_employee_user_id,'Task')\n\t\t@data << {'upcoming'=>task_hash[\"upcoming\"],'today'=>task_hash[\"today\"],'overdue'=>task_hash[\"overdue\"]} unless task_hash.blank?\n\t\t@title = \"#{@user.full_name.titleize}'s Open #{I18n.t(:text_menu_matter,:locale=>@locale)} Tasks\"\n\tend", "title": "" }, { "docid": "e4f0d63df7187fe402befbc72d9f09a5", "score": "0.46494052", "text": "def create\n @site_hour = SiteHour.new(params[:site_hour])\n\t@site_hour.project = session[:project]\n\n respond_to do |format|\n if @site_hour.save\n flash[:notice] = t 'flash.site_hr_create'\n format.html { redirect_to(@site_hour) }\n format.xml { render :xml => @site_hour, :status => :created, :location => @site_hour }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site_hour.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d59a233960b31577bf38e27288fd6abf", "score": "0.46479532", "text": "def timeseries_data\n histogram_bucket_count = @density - 1\n histogram_bucket_size = @y_max.to_f / histogram_bucket_count\n num_values = (params[:buckets] || @density * 4).to_i\n start_date = @data.start_timestamp\n end_date = @data.end_timestamp\n bucket_width = (end_date - start_date) / num_values\n buckets = []\n num_values.times do |i| \n buckets[i] = Timeslice.new(start_date + i * bucket_width, \n bucket_width,\n :primary_dim => @primary_dim,\n :histogram_bucket_size => histogram_bucket_size,\n :histogram_bucket_count => histogram_bucket_count,\n :measure => @measure,\n :log_transform => @log_transform,\n :apdex_t => @apdex_t)\n end\n\n summary = Timeslice.new(start_date, \n end_date - start_date,\n :primary_dim => @primary_dim,\n :histogram_bucket_size => histogram_bucket_size,\n :histogram_bucket_count => histogram_bucket_count,\n :log_transform => @log_transform,\n :measure => @measure,\n :apdex_t => @apdex_t)\n\n @data.each do | event |\n index = [(event.timestamp - start_date) / bucket_width, num_values - 1].min.floor\n buckets[index] << event\n summary << event\n end\n # Next put the series summary on the front\n buckets.unshift summary\n buckets.map! { |b| b.record }\n # Put the list of dimensions at the front\n buckets.unshift @dimensions\n buckets\n end", "title": "" }, { "docid": "8d0e96a13a151d80996011404f1f5af3", "score": "0.46434882", "text": "def initialize(hourly_forecast)\n @date = Date.parse(hourly_forecast[:date])\n @time = hourly_forecast[:time]\n @expected_weather = hourly_forecast[:wx]\n @temp_farenheit = hourly_forecast[:tempf].to_i\n @temp_celsius = hourly_forecast[:tempc].to_i\n @probability_of_precipitation = hourly_forecast[:pop].to_i\n @precipitation_millimeters = hourly_forecast[:qpfmm]\n @precipitation_inches = hourly_forecast[:qpfin]\n @dew_point_celsius = hourly_forecast[:dewpointc].to_i\n @dew_point_farenheit = hourly_forecast[:dewpointf].to_i\n @relative_humidity = hourly_forecast[:relativehumidity].to_i\n @wind_speed_knots = hourly_forecast[:windspeedknots].to_i\n @wind_speed_mph = hourly_forecast[:windspeedmph].to_i\n @wind_direction = hourly_forecast[:winddirectioneng]\n end", "title": "" }, { "docid": "c43ec8af824bca5cd62d1b4bf2fddf76", "score": "0.46400377", "text": "def initialize \n create_url\n response = RestClient.get(@url)\n @daily_plan_json = JSON.parse(response)\n send_to_timedtask(@daily_plan_json)\n end\n \n def send_to_timedtask(daily_plan_json)\n create_daily_plan(daily_plan_json)\n end", "title": "" }, { "docid": "e970611a48a13176a685b665f2cb2378", "score": "0.4639217", "text": "def get_network_traffic(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/traffic'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 't0' => options['t0'],\r\n 'timespan' => options['timespan'],\r\n 'deviceType' => options['device_type']\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "title": "" }, { "docid": "468b3bce431353fcdd728290cc83a2f5", "score": "0.4631024", "text": "def Building_visits(count_visit,\n visit_bounce_rate,\n page_views_per_visit,\n avg_time_on_site,\n min_durations,\n min_pages)\n @logger.an_event.debug(\"Building visits for <#{@policy_type}> <#{@website_label}> <#{@date_building}> is starting\")\n begin\n\n @logger.an_event.debug(\"count_visit #{count_visit}\")\n @logger.an_event.debug(\"visit_bounce_rate #{visit_bounce_rate}\")\n @logger.an_event.debug(\"page_views_per_visit #{page_views_per_visit}\")\n @logger.an_event.debug(\"avg_time_on_site #{avg_time_on_site}\")\n @logger.an_event.debug(\"min_durations #{min_durations}\")\n @logger.an_event.debug(\"min_pages #{min_pages}\")\n\n\n reporting = Reporting.new(@website_label, @date_building, @policy_type)\n reporting.visit_obj(count_visit, visit_bounce_rate, page_views_per_visit, avg_time_on_site, min_durations, min_pages)\n reporting.to_file(\"visit objective\")\n\n\n chosen_landing_pages_file = Flow.new(TMP, \"chosen-landing-pages\", @policy_type, @website_label, @date_building) #input\n raise IOError, \"tmp flow <#{chosen_landing_pages_file.basename}> is missing\" unless chosen_landing_pages_file.exist?\n count_chosen_landing_page = chosen_landing_pages_file.count_lines(EOFLINE)\n raise ArgumentError, \"because not enough count landing page <#{count_chosen_landing_page}> for <#{count_visit}> visits\" if count_chosen_landing_page < count_visit\n @logger.an_event.warn \"too much count landing page <#{count_chosen_landing_page}> for <#{count_visit}> visits\" if count_chosen_landing_page > count_visit\n count_pages = (count_visit * page_views_per_visit).to_i\n count_durations = (count_visit * avg_time_on_site).to_i\n @duration_pages = distributing(count_pages, count_durations, min_durations)\n min_duration_idx = @duration_pages.index(@duration_pages.min)\n if min_duration_idx > 0\n min_duration = @duration_pages[min_duration_idx]\n @duration_pages.delete_at(min_duration_idx)\n @duration_pages = [min_duration] + @duration_pages\n end\n\n @visits = []\n p = ProgressBar.create(:title => title(\"Loading chosen landing pages\"), :length => PROGRESS_BAR_SIZE, :starting_at => 0, :total => count_visit, :format => '%t, %c/%C, %a|%w|')\n chosen_landing_pages_file.foreach(EOFLINE) { |page|\n @logger.an_event.debug(\"page #{page}\")\n @visits << Visit.new(page, @website_label, @duration_pages.pop)\n p.increment\n }\n\n building_not_bounce_visit(visit_bounce_rate, count_visit, page_views_per_visit, min_pages)\n\n @visits_file = Flow.new(TMP, \"visits\", @policy_type, @website_label, @date_building) #output\n p = ProgressBar.create(:title => title(\"Saving visits\"), :length => PROGRESS_BAR_SIZE, :starting_at => 0, :total => count_visit, :format => '%t, %c/%C, %a|%w|')\n @visits.each { |visit| @visits_file.write(\"#{visit.to_s}#{EOFLINE}\"); p.increment }\n @visits_file.close\n @visits_file.archive_previous\n\n rescue Exception => e\n @logger.an_event.error (\"Building visits for <#{@policy_type}> <#{@website_label}> is over => #{e.message}\")\n raise e\n else\n @logger.an_event.debug(\"Building visits for <#{@policy_type}> <#{@website_label}> is over\")\n end\n end", "title": "" }, { "docid": "9cb016827f494f7be490e23a781ef50d", "score": "0.4627059", "text": "def index\n @day = Elecapp.where(created_at: (Time.now.beginning_of_day)..Time.now.end_of_day)\n @data = @day.pluck(:text, :date)\n\n\n d = []\n cat = []\n @data.each do |key, value|\n d << key\n cat << value\n end\n\n @chart = LazyHighCharts::HighChart.new('chart') do |f|\n f.chart(:height => '400')\n f.yAxis[:title => {:text => \"Usage(Watt)\", :margin => 20, style: { color: '#333'}}]\n f.xAxis(type: 'datetime', :categories => cat)\n f.series(:type => 'area', :name => '24Hrs', :data => d)\n end\n end", "title": "" }, { "docid": "8503d69f28fcf8638aa0b6d43e6207cc", "score": "0.46257964", "text": "def hourly_histogram_params\n params.require(:hourly_histogram).permit(:name, :tweet_count, :since_id, :histogram, :metric, :stream)\n end", "title": "" }, { "docid": "431b5bd30b2a40d1d8f11644a0a203ee", "score": "0.4616029", "text": "def inbound\n hit_api \"https://www.googleapis.com/analytics/v3/data/ga?metrics=ga:visits&dimensions=ga:date\"\n #hit_api \"https://www.googleapis.com/analytics/v3/data/ga?metrics=ga:organicSearches,ga:CPC,ga:visits&dimensions=ga:date\"\n end", "title": "" }, { "docid": "fbdcb20fd104c1d9e390a112e0aba771", "score": "0.46149185", "text": "def combine\n host = @init_options[:host]\n api_key = @init_options[:api_key]\n chartbeat = Chartbeat.new :host => host, :apikey => api_key\n @data = chartbeat.toppages :limit => 50\n \n @data.each do |datum|\n visitors = datum['visitors']\n path = datum['path']\n title = datum['i']\n \n # if the story is already in the db, combine visitor count\n # otherwise insert a new row\n existing_story = @db[:stories].where(:title => title).first || ''\n \n if not existing_story.empty?\n existing_visitors = existing_story[:visitors]\n @db[:stories].where(:title => title).update :visitors => existing_visitors + visitors\n else\n @db[:stories].insert({\n :title => title,\n :visitors => visitors,\n :path => path\n })\n end\n \n end\n end", "title": "" }, { "docid": "265ff63a0ca50f2d2b3446a298ed8a0e", "score": "0.46070594", "text": "def perf_gen_tag_data_before_wait\n case @perf_options[:typ]\n when \"Hourly\"\n from_dt = create_time_in_utc(@perf_options[:hourly_date] + \" 00:00:00\", @perf_options[:tz]) # Get tz 12am in UTC\n to_dt = create_time_in_utc(@perf_options[:hourly_date] + \" 23:59:59\", @perf_options[:tz]) # Get tz 11:59pm in UTC\n rpt = perf_get_chart_rpt(\"vim_perf_tag_hourly\")\n rpt.performance = {:group_by_category => @perf_options[:cat]}\n rpt.tz = @perf_options[:tz]\n rpt.time_profile_id = @perf_options[:time_profile]\n rpt.where_clause = [\"resource_type = ? and resource_id = ? and timestamp >= ? and timestamp <= ? and capture_interval_name = ?\",\n @perf_record.class.base_class.name,\n @perf_record.id,\n from_dt,\n to_dt,\n 'hourly']\n when \"Daily\"\n f = Date.parse(@perf_options[:daily_date]) - (@perf_options[:days].to_i - 1)\n from_dt = create_time_in_utc(\"#{f.year}/#{f.month}/#{f.day} 00\", @perf_options[:tz]) # Get tz 12am in UTC\n to_dt = create_time_in_utc(\"#{@perf_options[:daily_date]} 23\", @perf_options[:tz]) # Get tz 11pm in UTC\n rpt = perf_get_chart_rpt(\"vim_perf_tag_daily\")\n rpt.time_profile_id = @perf_options[:time_profile]\n chart_layout = perf_get_chart_layout(\"daily_tag_charts\", @perf_options[:model]) if @perf_options[:index]\n if @perf_options[:index] # If only looking at 1 chart, trim report columns for less daily rollups\n chart = chart_layout[@perf_options[:index].to_i]\n perf_trim_report_cols(rpt, chart)\n end\n rpt.tz = @perf_options[:tz]\n rpt.performance = {:group_by_category => @perf_options[:cat]}\n rpt.where_clause = [\"resource_type = ? and resource_id = ? and timestamp >= ? and timestamp <= ?\",\n @perf_record.class.base_class.name,\n @perf_record.id,\n from_dt,\n to_dt]\n end\n initiate_wait_for_task(:task_id => rpt.async_generate_table(:userid => session[:userid],\n :session_id => request.session_options[:id],\n :cat_model => @perf_options[:cat_model],\n :mode => \"charts\"))\n end", "title": "" }, { "docid": "54d3520c1bbb9ae03da348ebee48b47a", "score": "0.46053204", "text": "def set_hourly\n @hourly = Hourly.find(params[:id])\n end", "title": "" }, { "docid": "ed94ef405bd9514ec602c53ddb99a509", "score": "0.46033055", "text": "def create\n\n\t\t\tsrc = Tagaly3::SRC\n\t\t\t@uri = URI.parse(src)\n\t\t\thttp = Net::HTTP.start(@uri.host,@uri.port)\n @sites = Site.where(advertiserId: session[:user_id],siteStatus:\"active\")\n x=params[:campaign][:countDayparting].to_i\n \n i=1\n dayparting=''\n dayp=''\n hr1p=''\n min1p=''\n hr2p=''\n min2p=''\n \n retargetString=''\n coversionGoalsString=''\n httpRequest=''\n\tif params[:campaign][:retargets].present?\n\t\tparams[:campaign][:retargets].each do |retarget|\n\t\t retargetString = retargetString + \"&retargeting=\" + retarget\n\t\tend\n\tend\n\t\t if params[:campaign][:conversions].present?\n\t\t params[:campaign][:conversions].each do |conversion|\n\t\t coversionGoalsString = params[:campaign][:conversions].join(',')\n\t\t end\n\t\tend\n\n Date.strptime(DateTime.now.to_s).strftime(\"%m/%d/%Y\")\n now = Time.now.in_time_zone(session[:user_timezone])\n campaign_start_date=Time.strptime(now.to_s,\"%Y-%m-%d\").strftime(\"%Y-%m-%d\")\n if params[:campaign][:runcampaigncontinuously] == 'ongoing'\n startDate=campaign_start_date\n endDate=''\n else\n startDate=params[:campaign][:campaign_startdate]\n endDate=params[:campaign][:campaign_enddate]\n end\n \n@adIdscreated = Array.new\n\t\tif params[\"campaign\"][\"camptype\"] == \"NativeCampaign\"\n\t\t\tparams[\"campaign\"][\"campaign_type\"] = \"native_ad_placement\"\n\t\t\t@adunitsArr = params[\"campaign\"][:adunits].split(/,/)\n\t\t\[email protected] do |eachAdunitId|\n\t\t\t\tqty = \"\"\n\t\t\t\tqty = session[:imps][\"#{eachAdunitId}\"].to_i * 1000\n\t\t\t\tadIdForAdunit = $campCreation[\"CampCreation\"][eachAdunitId]\n\t\t\t\tadIdDetails = $adDetails[adIdForAdunit]\n\t\t\t\tjsonStringArray = Array.new\n\t\t\t\tnAdUnitName = \"\"\n\t\t\t\tnAdUnitdestinationUrl = \"\"\n\t\t\t\tadIdDetails.each do |element,elementdata|\n\t\t\t\t\tif element.to_s == \"name\"\n\t\t\t\t\t\tnAdUnitName = elementdata\n\t\t\t\t\telsif element.to_s == \"destinationUrl\"\n\t\t\t\t\t\tnAdUnitdestinationUrl = elementdata\n\t\t\t\t\tend\n\t\t\t\t\tjsonString = \" '#{element}' : '#{elementdata}' \"\n\t\t\t\t\tjsonStringArray.push(jsonString)\n\t\t\t\tend\n\t\t\t\t@finalString = jsonStringArray.join(\",\")\n\t\t\t\t@finalString = \" { \" + @finalString + \" } \"\n \trequest = Net::HTTP::Put.new(\"/adexchange/advertiser/advertisement\")\n\t\t\t\t# request = Net::HTTP::Put.new(\"/adexchange/publisher/nativeStyle\" , {'Content-Type' =>'application/json'})\n\t\t\t\trequest.set_form_data({\"adUnitId\"=> eachAdunitId , \"advertiserId\" => session[:user_id], \"siteId\" => session[:site_id], \"adType\" => \"NativeAd\" , \"adName\" => nAdUnitName ,\t\"adDestinationUrl\" => nAdUnitdestinationUrl ,\t\"adStatus\"=>\"Active\" ,\"version\"=> \"1.0\".to_f , \"nativeAdData\" => @finalString , \"volume\" => qty })\n\t\t \tresponse = http.request(request)\n\t\t\t\t@code = response.code\n\t\t\t\t@body = response.body\n\t\t\t\[email protected](@body)\n\t\t\tend\n\t\t\t\tads = @adIdscreated.join(\",\")\n\t\t\t\tcampaignStatus=params[:campaign][:state]\n\t\t\t\t$campCreation = SparseArray.new\n\t\t\t\t$adDetails = SparseArray.new\n\t\telse\n\t\t if params[:campaign][:campaign_type] == 'ad_placement'\n\t\t\t\tads = \"\"\n\t\t\t\tadunits = \"\"\n\t\t\t\t$adunits.each do |adunitId|\n\t\t\t\t\tadunits = adunitId.to_s + \",\" + adunits.to_s\n\t\t\t\t\tqty = params[:qty][adunitId].to_i * 1000\n\t\t\t\t\tuserId = session[:user_id]\n\t\t\t\t\tsiteId = session[:site_id]\n\t\t\t\t\tif $banneradDetails[adunitId][\"adType\"] == \"Create\"\n\t\t\t\t\t\tadName = $banneradDetails[adunitId]['adName']\n\t\t\t\t\t\tdestUrl = $banneradDetails[adunitId]['destination_url']\n\t\t\t\t\t\timgUrl = $banneradDetails[adunitId]['imgUrl']\n\t\t\t\t\t\tadSize = $banneradDetails[adunitId][\"adSize\"]\n\t\t\t\t\t\tadType = \"BannerAd\"\n\t\t\t\t \trequest = Net::HTTP::Put.new(\"/adexchange/advertiser/advertisement\")\n\t\t\t\t\t\t# request = Net::HTTP::Put.new(\"/adexchange/publisher/nativeStyle\" , {'Content-Type' =>'application/json'})\n\t\t\t\t\t\trequest.set_form_data({\"adUnitId\"=> adunitId , \"advertiserId\" => userId , \"siteId\" => siteId , \"adType\" => adType , \"adName\" => adName ,\t\"adDestinationUrl\" => destUrl ,\t\"adStatus\"=>\"Active\" , \"adImageUrl\" => imgUrl , \"version\"=> \"1.0\".to_f , \"volume\" => qty , \"adSize\" => adSize })\n\t\t\t\t\t\tresponse = http.request(request)\n\t\t\t\t\t\t@code = response.code\n\t\t\t\t\t\t@body = response.body\n\t\t\t\t\t\tads = @body.to_s + \",\" + ads\n\t\t\t\t\telse\n\t\t\t\t\t\tadId = $banneradDetails[adunitId][\"lidAdId\"]\n\t\t\t\t\t\t@copiedId = copyAd(\"#{adId}\",\"2.0\",\"\",\"#{adunitId}\")\n\t\t\t\t\t\tads = @copiedId.to_s + \",\" + ads\n\t\t\t\t\tend\n\t\t\t\t\t# ===========\n\t\t\t\tend\n\t\t\t\tcampaignStatus=\"pause\"\n=begin\n\t\t\t\tads=params[:campaign][:ads]\n\t\t\t\tcampaignStatus=\"pause\"\n=end\n\t\t\telse\n\t\t\t\tads=params[:campaign][:ads].join(',')\n\t\t\t\tcampaignStatus=params[:campaign][:state]\n\t\t\tend\t\t\n\t\t\tcampaignStatus=params[:campaign][:state]\n\t\tend\n\t\t\tcampaignStatus=params[:campaign][:state]\n\t@adslist=ads.split(\",\")\n #### Create a copy of the ads assigned to this campaign\n \n #### Arrage the dayparting according to the API\n \n\t\tif params[:campaign][:campaign_type] !='ad_placement'\n\t\t\t\twhile i <= x\n\t\t\t\t dayp=\"dayparting_day\" + i.to_s\n\t\t\t\t hr1p=\"dayparting_start_hr\" + i.to_s\n\t\t\t\t min1p=\"dayparting_start_min\" + i.to_s\n\t\t\t\t hr2p=\"dayparting_end_hr\" + i.to_s\n\t\t\t\t min2p=\"dayparting_end_min\" + i.to_s\n\t\t\t\t dayparting = dayparting + params[:campaign][dayp].to_s + \"|\" + params[:campaign][hr1p].to_s + \":\" + params[:campaign][min1p].to_s + \"|\" + params[:campaign][hr2p].to_s + \":\" + params[:campaign][min2p].to_s + \",\"\n\t\t\t\t i=i+1\n\t\t\t\tend\n\t\t\t\tdayparting=dayparting.chomp(\",\")\n\t\t\t\t\n\t\t\t\tgeotargetingtype=params[:campaign][:geotargeting]\n\t\t\t\tgeotargetingValue=params[:campaign][geotargetingtype].join(\" , \")\n\t\t\t\tvolume=0\n\t\t\t\tprice=0\n\t\t\t\tif params[:campaign][:bidtype]==\"cpc\"\n\t\t\t\t volume=params[:campaign][:clicks].to_i\n\t\t\t\t price=params[:campaign][:cpc].to_f\n\t\t\t\telsif params[:campaign][:bidtype]==\"cpm\"\n\t\t\t\t volume=params[:campaign][:impressions].to_i\n\t\t\t\t price=params[:campaign][:cpm].to_f\n\t\t\t\telse params[:campaign][:bidtype]==\"cpa\"\n\t\t\t\t volume=params[:campaign][:conversionscpa].to_i\n\t\t\t\t price=params[:campaign][:cpa].to_f\n\t\t\t\tend\n\t\t\t\tif params[:campaign][:runadcontinuously] == 'ongoing'\n\t\t\t\t dayparting=\"all\"\n\t\t\t\tend\n\t\t\t\tif params[:campaign][:targetallusers]==\"no-retargets\"\n\t\t\t\t @retargets=0\n\t\t\t\telse\n\t\t\t\t @retargets=params[:campaign][:retargets].join(',')\n\t\t\t\tend\n\t\t\t\tif params[:campaign][:campaign_type]==\"ad_placement\"\n\t\t\t\t\tadunits=adunits\n\t\t\t\telse\n\t\t\t\t\tadunits=0\n\t\t\t\tend\n\t\tend\n #render text: @retargets\n src = Tagaly3::SRC\n @HOST_NAME = Tagaly3::HOST_NAME\n @host = Socket.gethostname\n @uri = URI.parse(src)\n http = Net::HTTP.new(@uri.host,@uri.port)\n request = Net::HTTP::Put.new(\"/adexchange/advertiser/campaign\")\n\n\t\tif params[:campaign][:campaign_type] !='ad_placement'\n \trequest.set_form_data({\"campaignName\"=>params[:campaign][:campaign_name],\"advertiserId\"=>session[:user_id],\"siteId\"=>session[:site_id],\"budget\"=>params[:campaign][:weekly_budget] , \"campaignStartDate\"=>startDate,\"campaignEndDate\"=>endDate , \"campaignStatus\"=>campaignStatus , \"frequencyCaping\"=>200,\"adRotation\"=>\"test\",\"volume\"=>volume,\"price\"=>price,\"currency\"=>\"$\",\n\t\"campaignType\"=>params[:campaign][:campaign_type],\"bidType\"=>params[:campaign][:bidtype],\"geoTargetingType\"=>params[:campaign][:geotargeting],\"adId\"=>ads,\"retargeting\"=>@retargets,\"coversionGoals\"=>coversionGoalsString,\"geoTargeting\"=>geotargetingValue.to_s , \"dayParting\"=>dayparting,\"devicePreference\"=>params[:campaign][:device_preferences],\"adUnitId\"=>adunits})\n\t\telse\n \trequest.set_form_data({\"campaignName\"=>params[:campaign][:campaign_name] , \"advertiserId\"=>session[:user_id],\"siteId\"=>session[:site_id] , \"budget\"=>params[:campaign][:weekly_budget] , \"campaignStartDate\"=>startDate , \"campaignEndDate\"=>endDate , \"campaignStatus\"=> \"Pause\" , \"campaignType\"=>params[:campaign][:campaign_type] , \"adId\"=>ads , \"devicePreference\"=>params[:campaign][:device_preferences] , \"adUnitId\"=>adunits , \"coversionGoals\"=>coversionGoalsString })\n\t\tend\n\n\t\t$campCreation = SparseArray.new\n\t\t$adDetails = SparseArray.new\n ### Get Response\n response = http.request(request)\n @code = response.code\n\t\tcampaignId=response.body\n if @code=='200'\n\t\n\t\t @adslist.each do |adId|\n\t\t#render text: params[:campaign][:ads]\n\t\tif params[\"campaign\"][\"camptype\"] != \"NativeCampaign\"\n\t\t\t#@copiedId=copyAd(\"#{adId}\",\"2.0\",\"\")\n\t\tend\n\n\t\t\tsrc = Tagaly3::SRC\n\t\t\t@HOST_NAME = Tagaly3::HOST_NAME\n\t\t\t@host = Socket.gethostname\n\t\t\t@uri = URI.parse(src)\n\t\t\thttp = Net::HTTP.new(@uri.host,@uri.port)\n\t\t\trequest = Net::HTTP::Post.new(\"/adexchange/advertiser/advertisement/#{adId}\")\n\t\t\trequest.set_form_data({\"approvalStatus\"=>\"PendingApproval\",\"campaignId\"=>campaignId.to_i})\n\t\t\t### Get Response\n\t\t\tresponse = http.request(request)\n\t\t\t@code = response.code\n\t\tend\n\n\t\t if params[:campaign][:campaign_type] == 'ad_placement' || params[\"campaign\"][\"camptype\"] == \"NativeCampaign\"\n \tflash[:notice]=\"Campaign created successfully. Your campaigns will go live as soon as the publisher approves them.\"\n\t\t\telse\n \tflash[:notice]=\"Campaign created successfully\"\n\t\t\tend\n else\n flash[:error]=\"Some problem occured while campaign creation ! Please contact the administrator .\"\n end\n\tif params[:campaign][:campaign_type]==\"ad_placement\"\n\t\tredirect_to \"/campaigns/checkout\"\n\telse\n\t\n\tredirect_to \"/dashboard/#{session[:site_id]}\"\n\tend\n\n end", "title": "" }, { "docid": "2be2790ce43501d63f4b3a6f440ee917", "score": "0.46009022", "text": "def show\n\n ## Chart\n\n @chart_data = {\n 1.year.ago => rand(9000...10000),\n 2.years.ago => rand(500...8000),\n 3.years.ago => rand(500...8000),\n 4.years.ago => rand(500...8000),\n 5.years.ago => rand(500...8000),\n 6.years.ago => rand(500...8000),\n 7.years.ago => rand(500...8000),\n 8.years.ago => rand(500...8000),\n 9.years.ago => rand(500...8000),\n 10.years.ago => rand(1000...5000)\n }\n\n ## Job Postings\n\n jobpostings = JobPosting.new(@job.title, (@location.city + ', ' + @location.state) )\n @posts = jobpostings.list['response']['results'].present? ? jobpostings.list['response']['results']['result'] : ''\n\n ## Map\n\n map_params = {\n center: @location.city + ', ' + @location.state,\n zoom: 12,\n size: '1280x192',\n scale: 2\n }\n\n @map = \"https://maps.googleapis.com/maps/api/staticmap?\" + map_params.to_query\n end", "title": "" }, { "docid": "4e386fa3fa00c1551fa78c7da43bd458", "score": "0.4599524", "text": "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thur\", \"Fri\"]\n\n # Create a XYChart object of size 540 x 375 pixels\n c = ChartDirector::XYChart.new(540, 375)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n c.addTitle(\"Average Weekly Network Load\", \"timesbi.ttf\", 18)\n\n # Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical\n # gradient color from grey (888888) to black (000000) as background. Set border\n # and grid lines to white (ffffff).\n c.setPlotArea(50, 55, 440, 280, c.linearGradientColor(0, 55, 0, 335, 0x888888,\n 0x000000), -1, 0xffffff, 0xffffff)\n\n # Add a legend box at (50, 25) using horizontal layout. Use 10pts Arial Bold as\n # font, with transparent background.\n c.addLegend(50, 25, false, \"arialbd.ttf\", 10).setBackground(\n ChartDirector::Transparent)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set axis line width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Add axis title\n c.yAxis().setTitle(\"Throughput (MBytes Per Hour)\")\n\n # Add a multi-bar layer with 3 data sets and 4 pixels 3D depth\n layer = c.addBarLayer2(ChartDirector::Side, 4)\n layer.addDataSet(data0, 0x66aaee, \"Server #1\")\n layer.addDataSet(data1, 0xeebb22, \"Server #2\")\n layer.addDataSet(data2, 0xcc0000, \"Server #3\")\n\n # Set bar border to transparent. Use bar gradient lighting with light intensity\n # from 0.75 to 1.75.\n layer.setBorderColor(ChartDirector::Transparent, ChartDirector::barLighting(0.75,\n 1.75))\n\n # Configure the bars within a group to touch each others (no gap)\n layer.setBarGap(0.2, ChartDirector::TouchBar)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "2e56d05493848cde060139d4fbc494fc", "score": "0.45955756", "text": "def perf_gen_chart(report, options)\n options[:chart_type] ||= @perf_options[:chart_type] # Set chart_type for the set of charts, unless overridden already for this chart\n options[:width] ||= 350\n options[:height] ||= 250\n report.title = options[:title]\n report.graph ||= {}\n report.graph[:type] = options[:type]\n report.graph[:columns] = options[:columns]\n report.graph[:legends] = options[:legends]\n report.graph[:max_col_size] = options[:max_value]\n report.to_chart(settings(:display, :reporttheme), false,\n MiqReport.graph_options(options))\n chart_data = {\n :data => report.chart, # Save the graph data\n :main_col => options[:columns].first # And the main (first) column of the chart\n }\n if options[:chart2]\n report.graph[:type] = options[:chart2][:type]\n report.graph[:columns] = options[:chart2][:columns]\n report.to_chart(settings(:display, :reporttheme), false,\n MiqReport.graph_options(options.merge(:composite => true)))\n chart_data[:data2] = report.chart\n end\n chart_data\n end", "title": "" }, { "docid": "39580d42f4fc3a1e1b5b0cbe27688cf8", "score": "0.459489", "text": "def drawContraceptiveReportGraph(locationName,locationId,year)\n##LINE GRAPH\ng = Gruff::Line.new('900x500') #Define a New Graph\n\n@location_n = locationName\n@yr = year\n\nif(locationName==nil)\n@location_n = \" \"\nelsif year == nil\n@yr = \" \"\nend\n\ng.title = \"Location Name: \" + @location_n #Title for the Graph\ng.theme_pastel # Declare a theme from the presets available\n\n#Get data for Contraceptive availablity \n\n#January\njan_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#February\nfeb_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#March\nmar_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#April\napr_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#May\nmay_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#June\njun_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#July\njul_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#August\naug_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#September\nsep_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#Octomber\noct_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'october' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#November\nnov_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n#December\ndec_hivcon_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId} and availability_of_contraceptives ='yes'\"\n\n\n@jan_hivcon_cases = Hivcase.count_by_sql(jan_hivcon_sql)\n@feb_hivcon_cases = Hivcase.count_by_sql(feb_hivcon_sql)\n@mar_hivcon_cases = Hivcase.count_by_sql(mar_hivcon_sql)\n@apr_hivcon_cases = Hivcase.count_by_sql(apr_hivcon_sql)\n@may_hivcon_cases = Hivcase.count_by_sql(may_hivcon_sql)\n@jun_hivcon_cases = Hivcase.count_by_sql(jun_hivcon_sql)\n@jul_hivcon_cases = Hivcase.count_by_sql(jul_hivcon_sql)\n@aug_hivcon_cases = Hivcase.count_by_sql(aug_hivcon_sql)\n@sep_hivcon_cases = Hivcase.count_by_sql(sep_hivcon_sql)\n@oct_hivcon_cases = Hivcase.count_by_sql(oct_hivcon_sql)\n@nov_hivcon_cases = Hivcase.count_by_sql(nov_hivcon_sql)\n@dec_hivcon_cases = Hivcase.count_by_sql(dec_hivcon_sql)\n\n#Graph Data for Contraceptives \ng.data(\"Contraceptive Availability for year \"+ @yr, [@jan_hivcon_cases, @feb_hivcon_cases, @mar_hivcon_cases, @apr_hivcon_cases,@may_hivcon_cases,@jun_hivcon_cases,@jul_hivcon_cases,@aug_hivcon_cases,@sep_hivcon_cases,@oct_hivcon_cases,@nov_hivcon_cases,@dec_hivcon_cases]) \n\n#Graph Data for Hiv cases\n\n#January\n#Count the number of malaria cases for january \n\n#January\njanuary_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#February\nfebruary_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#March\nmarch_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#April\napril_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#May\nmay_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#June\njune_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#july\njuly_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#August\naugust_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#September\nseptember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#October\noctober_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'octomber' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#November\nnovember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#December\ndecember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n\n\n@jan_hiv_cases = Hivcase.count_by_sql(january_sql)\n@feb_hiv_cases = Hivcase.count_by_sql(february_sql)\n@mar_hiv_cases = Hivcase.count_by_sql(march_sql)\n@apr_hiv_cases = Hivcase.count_by_sql(april_sql)\n@may_hiv_cases = Hivcase.count_by_sql(may_sql)\n@jun_hiv_cases = Hivcase.count_by_sql(june_sql)\n@jul_hiv_cases = Hivcase.count_by_sql(july_sql)\n@aug_hiv_cases = Hivcase.count_by_sql(august_sql)\n@sep_hiv_cases = Hivcase.count_by_sql(september_sql)\n@oct_hiv_cases = Hivcase.count_by_sql(october_sql)\n@nov_hiv_cases = Hivcase.count_by_sql(november_sql)\n@dec_hiv_cases = Hivcase.count_by_sql(december_sql)\n\ng.data(\"Hiv Cases for year \"+ @yr, [@jan_hiv_cases, @feb_hiv_cases, @mar_hiv_cases, @apr_hiv_cases, @may_hiv_cases, @jun_hiv_cases,@jul_hiv_cases,@aug_hiv_cases,@sep_hiv_cases,@oct_hiv_cases,@nov_hiv_cases,@dec_hiv_cases])\n\ng.labels = {0 => 'Jan', 1 => 'Feb', 2 => 'Mar', 3 => 'Apr', 4 => 'May', 5 => 'Jun', 6 => 'July', 7 => 'Aug', 8 => 'Sep', 9 => 'Oct', 10 => 'Nov', 11 => 'Dec'} #Labels for Each of the Graph\ng.write('app/assets/images/hiv_contraceptive_report.png')\n\nend", "title": "" }, { "docid": "1a8a24e74c99f4ad15faa3fb5bbf5173", "score": "0.45892802", "text": "def index\n @title = \"Stats for #{current_user.profile ? current_user.profile.first_name : current_user.username}\"\n\n # Build workout metrics chart\n @workout_metrics = LazyHighCharts::HighChart.new('graph') do |f|\n # Pull chart series from the model\n points, times = WorkoutRecord.get_series_for_chart current_user.id\n @workout_metrics_empty = (points.size < 2) && (times.size < 2)\n \n # Add default chart properties\n f.options.merge! CHART_OPTIONS\n\n # Set the chart title and subttile\n f.options[:title] = { :text => \"Workout Metrics for #{current_user.profile ? current_user.profile.first_name : current_user.username}\" }\n f.options[:subtitle] = { :text => \"#{(Date.today - 30.days).strftime('%B %e')} to #{Date.today.strftime('%B %e, %Y')}\" }\n\n # Label the axes\n point_axis = { :opposite => true, # Label this axis on the right side instead of left\n :title => { :text => 'Points' } \n }\n time_axis = { :labels => { \n :style => { :color => '#AA4643' } \n }, \n :title => { \n :text => 'Times', \n :style => { :color => '#AA4643' } \n } \n }\n f.y_axis = nil\n\n # Add the axes and series to the chart\n f.options[:yAxis] = [point_axis, time_axis]\n f.series :name => 'Points', :data => points, :yAxis => 0\n f.series :name => 'Time in seconds', :data => times, :yAxis => 1\n end\n \n # Build blood pressure chart\n @bp_metrics = LazyHighCharts::HighChart.new('graph') do |f|\n sys_bp, dia_bp = HealthRecord.get_bp_series_for_chart current_user.id\n @bp_metrics_empty = (sys_bp.size < 2) && (dia_bp.size < 2)\n \n f.options.merge! CHART_OPTIONS\n f.options[:title] = { :text => \"#{current_user.get_name}'s Blood Pressure\" }\n f.options[:subtitle] = { :text => \"#{(Date.today - 30.days).strftime('%B %e')} to #{Date.today.strftime('%B %e, %Y')}\" }\n f.y_axis = { :title => { :text => 'Pressure (mmHg)' } }\n f.series :name => 'Systolic', :data => sys_bp\n f.series :name => 'Diastolic', :data => dia_bp\n end\n\n # Build weight and heart rate chart\n @health_metrics = LazyHighCharts::HighChart.new('graph') do |f|\n weight = HealthRecord.get_weight_series_for_chart current_user.id\n heart_rate = HealthRecord.get_heart_rate_series_for_chart current_user.id\n\n @health_metrics_empty = (weight.size < 2) && (heart_rate.size < 2)\n f.options.merge! CHART_OPTIONS\n f.options[:title] = { :text => \"Health Metrics for #{current_user.get_name}\" }\n f.options[:subtitle] = { :text => \"#{(Date.today - 30.days).strftime('%B %e')} to #{Date.today.strftime('%B %e, %Y')}\" }\n f.series :name => 'Weight (pounds)', :data => weight\n f.series :name => 'Resting Heart Rate (beats per minute)', :data => heart_rate\n end\n\n # Build daily calories and BMI chart\n @bmi_chart = LazyHighCharts::HighChart.new('graph') do |f|\n bmi = HealthRecord.get_bmi_series_for_chart current_user.id\n calories = HealthRecord.get_calories_series_for_chart current_user.id\n @bmi_chart_empty = (bmi.size < 2) && (calories.size < 2)\n f.options.merge! CHART_OPTIONS\n f.options[:title] = { :text => \"BMI for #{current_user.get_name}\" }\n f.options[:subtitle] = { :text => \"#{(Date.today - 30.days).strftime('%B %e')} to #{Date.today.strftime('%B %e, %Y')}\" }\n # Label the axes\n bmi_axis = { :opposite => true, # Label this axis on the right side instead of left\n :title => { :text => 'BMI' } \n }\n calories_axis = { :labels => { \n :style => { :color => '#AA4643' } \n }, \n :title => { \n :text => 'Calories Consumed', \n :style => { :color => '#AA4643' } \n } \n }\n f.y_axis = nil\n\n # Add the axes and series to the chart\n f.options[:yAxis] = [bmi_axis, calories_axis]\n f.series :name => 'BMI', :data => bmi, :yAxis => 0\n f.series :name => 'Daily Calories Consumed', :data => calories, :yAxis => 1\n end\n end", "title": "" }, { "docid": "af40da63c7d1c2fa7e173fc6aa74b549", "score": "0.45886528", "text": "def index\n @hourly_histograms = HourlyHistogram.all\n end", "title": "" }, { "docid": "72ed901b93f2dcbb782461c53858c4f2", "score": "0.45769104", "text": "def perf_gen_top_data_after_wait\n miq_task = MiqTask.find(params[:task_id]) # Not first time, read the task record\n if miq_task.task_results.kind_of?(Array)\n rpts = miq_task.task_results.reverse # Grab the array of report objects (reversed so reports can be popped off)\n else\n rpt = miq_task.miq_report_result.report_results # Grab the report object from the blob\n end\n miq_task.destroy # Get rid of the task and results\n\n @chart_reports = []\n @charts = []\n @chart_data = []\n\n @perf_options[:ght_type] ||= \"hybrid\"\n @perf_options[:chart_type] = :performance\n cont_plus_model = request.parameters[\"controller\"] + \"-\" + @perf_options[:top_model]\n\n layout_name = case @perf_options[:top_type]\n when 'topday' then 'day_top_charts'\n when 'tophour' then 'hour_top_charts'\n end\n chart_layouts = perf_get_chart_layout(layout_name, cont_plus_model)\n\n if @perf_options[:index]\n chart = chart_layouts[@perf_options[:index].to_i]\n @chart_data.push(gen_perf_chart(chart, rpt, nil, 'perf_top_chart'))\n @chart_reports.push(rpt)\n @charts.push(chart)\n else\n chart_layouts.each_with_index do |chart, idx|\n next if chart.nil?\n\n rpt = rpts.pop # Get the next report object from the array\n @chart_data.push(gen_perf_chart(chart, rpt, idx, 'perf_top_chart'))\n @chart_reports.push(rpt)\n @charts.push(chart)\n end\n end\n\n @sb[:chart_reports] = @chart_reports # Hang on to the reports for these charts\n @charts = @charts\n @chart_data = @chart_data\n @top_chart = true\n @html = perf_report_to_html(rpt)\n end", "title": "" }, { "docid": "46a00783d16f2bd356d26d4914fa603c", "score": "0.45715645", "text": "def pub_geo_chart(*args)\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Please login again.\"\n redirect_to :controller=>'login', :action=>'login'\n else\n if @aes.checkSecurity(session[:user_id],session[:key],session[:iv],1,0)==0\n start_date=args[0]\n end_date=args[1]\n duration=args[2]\n delivery_time={\"$gte\" => \"#{Time.parse(start_date).strftime(\"%Y-%m-%d\")}\", \"$lte\" => \"#{Time.parse(end_date).strftime(\"%Y-%m-%d\")}\"} \n publisher=args[3] if args[3]!=nil and args[3]!=''\n #initialize colors for piechart\n pub=Publisher.find_by_publisher_name(publisher) if publisher!='' and publisher!=nil\n search=Hash.new\n #form search parameter\n search.store(\"dt\",delivery_time) if delivery_time!=nil and delivery_time!=''\n search.store(\"pid\",\"#{pub.id}\") if pub!=nil and pub!=\"\"\n search.store(\"pid\",\"\") if (publisher!=nil and publisher!='') and (pub==nil or pub==\"\")\n db = Mongo::Connection.new(\"192.168.1.21\", 27017).db(\"zestadz_analytics_db\")\n coll = db.collection('pub_us_geostats')\n geostats=coll.group(['st'], search, {'fl' => 0}, \"function(doc, prev) { prev.fl += (doc.fl+doc.unfl)}\")\n chart_data=\"<map hoverColor='01B401' formatNumberScale='0' useSNameInLabels='1' showCanvasBorder='0' includeValueInLables='0' showPercentageValues='1' fillColor='FFFFFF' defaultAnimation='0' showShadow='0' showBevel='0' leftMargin='5' ><data>\"\n count=0\n for geo in geostats\n if count<geo['fl'].to_i \n count=geo['fl'].to_i if geo['st']!=nil and geo['st']!=''\n end\n chart_data+=\"<entity id='#{geo['st']}' value='#{geo['fl']}' link='/admin_analytic/pub_geo_cities%3Fstart_date=#{start_date}%26end_date=#{end_date}%26duration=#{duration}%26pub=#{(pub==nil or pub=='') ? '' : pub.publisher_name}%26state=#{geo['st']}%26frm=chart#{args[2]=='true' ? '%26flag=true' : ''}'/>\" if (geo['fl'].to_i>0 and geo['st']!=nil and geo['st']!='')\n end\n chart_data+=\"</data>\"\n chart_data+=\"<colorRange><color minValue='0' maxValue='#{(count/3)}' displayValue='Low' color='A7FF98' /><color minValue='#{((count/3))}' maxValue='#{(count-(count/3))}' displayValue='Moderate' color='2CCE00' /><color minValue='#{(count-(count/3))}' maxValue='#{(count)+1}' displayValue='High' color='007700' /></colorRange></map>\" \n return chart_data\n else\n flash[:notice]=\"Your are not an authorized user. Please login with different username.\"\n redirect_to :controller=>'login'\n end\n end\n rescue Exception=>e\n puts \"Error occured in pub_geo_chart method :: #{e}\"\n end\n end", "title": "" }, { "docid": "6514266ef7cfad02603c86c2f267eb26", "score": "0.45707703", "text": "def create\n @traffic_packet = TrafficPacket.new(params[:traffic_packet])\n\n respond_to do |format|\n if @traffic_packet.save\n format.html { redirect_to(@traffic_packet, :notice => 'Traffic packet was successfully created.') }\n format.xml { render :xml => @traffic_packet, :status => :created, :location => @traffic_packet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @traffic_packet.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b56d2ac0975f33f6fb8887fb35b6bed7", "score": "0.45687383", "text": "def get_weekly_totals\n database = Database.new 'RI-2016', 'postgres'\n Dictionary.offense_codes.each do |code, offense|\n # Obtain state data for this offense\n puts \"Querying state-wide dataset for #{offense}\"\n state_query = Queries::Incidents.state_with_code code\n state_data = database.execute state_query\n state_weekly_data = Research::When.by_week state_data\n # Create a weekly dataset\n puts \"Populating a state-wide weekly dataset\"\n state_weekly_array = []\n state_weekly_data.each do |week, value|\n state_weekly_array.append value\n end\n # Obtain data from each agency for comparison\n agencies_query = Queries::Agencies.all\n agencies_data = database.execute agencies_query\n agencies_data.each do |agency|\n next if agency['nibrs_reported'].to_i == 0\n puts \"Querying #{agency['agency_name']} dataset for #{offense}\"\n agency_query = Queries::Incidents.agency_with_code agency['agency_ori'], code\n agency_data = database.execute agency_query\n agency_weekly_data = Research::When.by_week agency_data\n # Create a weekly dataset\n puts \"Populating a weekly dataset\"\n agency_weekly_array = []\n agency_weekly_data.each do |week, value|\n agency_weekly_array.append value\n end\n # Create graph\n file = \"out/#{database.database}_#{agency['agency_name']}_#{code}.png\"\n puts \"Creating comparison graph and saving to #{file}\"\n g = Gchart.new(\n type: 'line',\n title: \"Counts of #{offense} by calendar week\",\n data: [state_weekly_array, agency_weekly_array],\n legend: [\"#{database.database}\", \"#{agency['agency_name']}\"],\n\tline_colors: ['1565c0', 'c62828'],\n axis_with_labels: ['x', 'y'],\n axis_range: [[0, 53, 53 / 10], [0, state_weekly_array.max, state_weekly_array.max / 10]],\n size: '500x500',\n filename: file\n )\n g.file\n end\n end\nend", "title": "" }, { "docid": "be10d74e91c661204d139a0a6065d7de", "score": "0.45685527", "text": "def track_chart\n link :weekly_track_chart, \"Track\", name\n end", "title": "" }, { "docid": "673dde0d627abbfd8d1c245fcffae40c", "score": "0.4555079", "text": "def collect_stories\n times = self.get_collection_intervals\n \n times.each do |time|\n puts \"Collecting for #{Time.at(time)}...\"\n h = Hashie::Mash.new(@c.snapshots(:timestamp => time))\n \n titles = h.titles.to_a\n paths = h.active\n \n if not titles.nil? || paths.nil?\n paths_visitors = paths.collect {|q| [q.path,q.total]} \n \n # Match titles to paths and add visitors.\n titles.each do |title|\n paths_visitors.each do |path_visitor|\n if path_visitor[0] == title[0]\n title << path_visitor[1]\n end\n end\n end\n else\n warn \"Warning! No data collected for #{Time.at(time)}. Results may be skewed! Try setting older timestamps for best results.\"\n end\n \n @stories << titles\n end\n \n self.package_stories\n end", "title": "" } ]
de8a367e9625d0b840f04f8743b26600
to create album by selecting in the images in the view and show the preview
[ { "docid": "9dead29cff80a9d5f1ab822a5106f316", "score": "0.65780735", "text": "def images_select_album_create\n title = params[:title]\n album_name = params[:album_name]\n movie_id = params[:edit_movie_id]\n artist_id = params[:edit_artist_id]\n event_id = params[:edit_event_id]\n user_id = current_user.id\n\n album = Album.create(:album_name => album_name)\n images_ids = params[:images_ids]\n post_to_facebook = params[:post_fb]\n images_ids.split(\" \").each do |image_id|\n AlbumImage.create(:album_id => album.id, :image_id => image_id)\n end\n\n album.cover_image_id = images_ids.split(\" \")[0]\n album.save\n\n post_created = false\n\n if !movie_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => movie_id, \n :posting_type => \"Movie\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n post_created = true\n end\n\n if !artist_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => artist_id, \n :posting_type => \"Artist\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n post_created = true\n end\n\n if !event_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => event_id, \n :posting_type => \"Event\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n end\n Post.mention(post,params[:mention_artist_id],params[:mention_movie_id])\n\n #inserting this particular post to the current user feed\n feed = Feed.create(:user_id => user_id ,:post_id => post.id, :post_created_on => post.created_at )\n\n #user score\n action_score = Score.create(:user_id => current_user.id, :score => 20, :action => \"Post created || Album || post id is #{post.id}\")\n total_score = action_score.score\n current_user.score += total_score\n current_user.save\n\n scrap_hash = {}\n\n PostsWorker.perform_async(post.id,1,scrap_hash)\n PostsWorker.perform_async(post.id,2,scrap_hash)\n redirect_to root_url\n\n end", "title": "" } ]
[ { "docid": "f2f799f6e49b863c161c01b6f96f1dfe", "score": "0.6703451", "text": "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", "title": "" }, { "docid": "dd0b08f713cd6d468123134d95059f14", "score": "0.66948473", "text": "def show\n @images = @galleries_album.galleries\n end", "title": "" }, { "docid": "1c8fb469ca75c227a6f3f998599c6838", "score": "0.66551113", "text": "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "title": "" }, { "docid": "21683e4e32747303553bd0d2620bf992", "score": "0.6633771", "text": "def set_album\n @image = Album.find(params[:album_id])\n end", "title": "" }, { "docid": "6589da7be944b672fcecb9b6558f9998", "score": "0.6628029", "text": "def index\n @pictures = @album.pictures.all \n @picture = @album.pictures.build\n end", "title": "" }, { "docid": "52caa0fdd4d65ce7729e4c467613265e", "score": "0.66230506", "text": "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", "title": "" }, { "docid": "af48fcbd2f3da61bbd2107b657603613", "score": "0.66189635", "text": "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", "title": "" }, { "docid": "c7716fc8196a6525add8f81bb0f1a6be", "score": "0.65658474", "text": "def create\r\n @album = Album.new(params[:album])\r\n if (params[:album][:coverpage])\r\n tem_coverPage = upload_file(@album.coverpage,\"app/assets/images/album_images\")\r\n @album.coverpage = \"album_images/\"+tem_coverPage\r\n else\r\n @album.coverpage = \"album_images/album_default.jpg\"\r\n end\r\n @album.owner = session[:user_id]\r\n respond_to do |format|\r\n if @album.save\r\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\r\n format.json { render json: @album, status: :created, location: @album }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "73e40f3df3ec4cff01086fd984be3fbd", "score": "0.65290815", "text": "def create\n @album = Album.find(params[:album_id])\n #@photo = @album.photos.build(params[:photo])\n @photo = @album.photos.create(params[:photo])\n @album.cover_id ||= @photo.id\n @album.add_participator(current_user)\n @photo.exif_read\n\n\n respond_to do |format|\n if @photo.save && @album.save\n format.html { redirect_to @album, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n format.js \n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ebe063388dbe574e5abbc4fae7b82012", "score": "0.65241075", "text": "def set_album\n @album = Pagealbum.find(params[:id]) rescue Pagealbum.new\n @images=[]\n end", "title": "" }, { "docid": "5cbefb835fc9161782529ea0890c22e1", "score": "0.6451959", "text": "def new\n @album = Album.new\n @album.album_photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "title": "" }, { "docid": "bae8f3ad4aea2bbb3c63de9dc978e1bc", "score": "0.64347136", "text": "def show\n @kpictures = @kokuin.photos\n @kmatch = KokuinMatch.new\n # @kokuin.photos.build\n end", "title": "" }, { "docid": "d8992e2b67df8d97584c6049a716b193", "score": "0.64244723", "text": "def show\n @album_photo = AlbumPhoto.find_by(id: 3)\n end", "title": "" }, { "docid": "869837ca6d9a1d2b1de8e58db6a27d32", "score": "0.6410458", "text": "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", "title": "" }, { "docid": "d382ac55415f200593f8288a9bf6f5cd", "score": "0.639787", "text": "def show\n @photos_1_2 = Array.new\n @photos_2_2 = Array.new\n\n @photos_1_3 = Array.new\n @photos_2_3 = Array.new\n @photos_3_3 = Array.new\n\n @interior_album.interior_photos.each_with_index do |interior_photo, i|\n if i % 2 == 0\n @photos_1_2.push(interior_photo)\n else\n @photos_2_2.push(interior_photo)\n end\n\n if i % 3 == 0\n @photos_1_3.push(interior_photo)\n elsif (i+1) % 3 == 0\n @photos_3_3.push(interior_photo)\n else\n @photos_2_3.push(interior_photo)\n end\n\n end\n end", "title": "" }, { "docid": "8b07cb9d81f75a4965184b69c7555b1a", "score": "0.63861", "text": "def create_photos\n end", "title": "" }, { "docid": "2fedd2dbba30217525214c0c6a625d4e", "score": "0.6377726", "text": "def new\n @photoalbum = Photoalbum.new\n end", "title": "" }, { "docid": "a20eb8762f6fa642589c7ed5f203ec24", "score": "0.63770306", "text": "def create\n @gallery = Gallery.new(gallery_params)\n @gallery.thumbUrl = @gallery.arts.first.image.thumb('400x200').url\n respond_to do |format|\n if @gallery.save\n format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' }\n format.json { render :show, status: :created, location: @gallery }\n else\n format.html { render :new }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1f7ee25efbde8d9d534e9cfc8e79e69", "score": "0.6367124", "text": "def create\n @image = @album.images.build(image_params)\n\n if @image.save\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been uploaded.\"\n else\n render \"new\"\n end\n end", "title": "" }, { "docid": "10fd41a75680bf7d788cf42523b8d3da", "score": "0.63499856", "text": "def createalbum\n \tredirect_to(\"/photo/createAlbumPage\")\n end", "title": "" }, { "docid": "448d2e2d6a7e19029a3d2c882686eee0", "score": "0.6332418", "text": "def index\n @images = @album.images.all\n end", "title": "" }, { "docid": "88cb508a1a9836ec1e93874978b388c0", "score": "0.632952", "text": "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", "title": "" }, { "docid": "70e0215dd7489f3f3b6028094513f9cb", "score": "0.6327603", "text": "def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "ed7891d9ab7623fa7d3434e4bddfb9e0", "score": "0.629055", "text": "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", "title": "" }, { "docid": "b2e4369521a9c51ab24266d336b2dea6", "score": "0.628588", "text": "def create\n @picture = @album.pictures.build(params[:picture])\n\n if @picture.save\n flash[:notice] = 'Picture was successfully uploaded.'\n redirect_to(album_pictures_path(@album))\n else\n @pictures = @album.pictures.all \n render :action => \"index\" \n end\n end", "title": "" }, { "docid": "55ea79a46410e4962f5976a43272029b", "score": "0.6269098", "text": "def new\n @album = Album.new\n @images = Image.all(:conditions => {:album_id => nil})\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "title": "" }, { "docid": "95f462f858faae0f0fd25594d594cb36", "score": "0.62493324", "text": "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", "title": "" }, { "docid": "78e01166fbcbce9d58f6a6c17cae56f0", "score": "0.624926", "text": "def index\n @pictures = @album.pictures.all\n end", "title": "" }, { "docid": "fdb0fac2ef42b47395001621b204b347", "score": "0.6248294", "text": "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", "title": "" }, { "docid": "c3ec6cb71b40fa51c87d68558da142fa", "score": "0.6247233", "text": "def index\n @albums = Album.all\n @photos = Photo.find(:all, :order => \"ordering\")\n #@photos = Photo.all\n #Dir.entries(\"app/assets/images/gallery/\").each do |entry|\n # if entry =~ /\\d+\\.jpg/\n # @photos << Photo.new(:mainfile=>\"/assets/gallery/\" + entry,:thumbfile => \"/assets/gallery/\" + entry.gsub(/\\.jpg/,'') + \"_thumb.jpg\" )\n # end\n #end\n if @photos.length == 0\n #redirect_to url_for([:uploader,:admin,:photo])\n redirect_to admin_photos_uploader_url\n else\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end\n\n end", "title": "" }, { "docid": "b106490abbedf9917bae8fe4884ae673", "score": "0.6237252", "text": "def images_select_album_create_render\n @images_ids = []\n images_ids = params[:image_ids]\n images_ids.each do |image_id|\n if image_id[-1] == \"&\"\n image_id[-1]=\"\"\n end\n @images_ids << image_id\n end\n end", "title": "" }, { "docid": "5a1c53351d3627eb00934871441a1273", "score": "0.6230106", "text": "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n end", "title": "" }, { "docid": "cb9337318cb726c89c142bbe8826b032", "score": "0.6225533", "text": "def new\n @photo = Photo.new\n \n\tif params[:album_id]\n\t\t$album = Album.find(params[:album_id])\n\tend\n\t\n\trender :layout => false\n end", "title": "" }, { "docid": "2a5cb02075722f4fa3449d6c6ac2245e", "score": "0.6204146", "text": "def show\n @picture = @album.pictures.find(params[:id])\n end", "title": "" }, { "docid": "5e1632d0aa1281847b58674da6a89a6c", "score": "0.61931354", "text": "def index\n @album_photos = AlbumPhoto.all\n end", "title": "" }, { "docid": "47dd813c9345b3dcab11ba8dcfa9fab0", "score": "0.6166889", "text": "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", "title": "" }, { "docid": "da2543adfcffeb4f785b6227d8925e65", "score": "0.615355", "text": "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", "title": "" }, { "docid": "d2c418b756eac2983cffc55eddc89492", "score": "0.6150553", "text": "def set_galleries_album\n @galleries_album = Galleries::Album.find(params[:id])\n end", "title": "" }, { "docid": "dd50fe099b2f243a5103467e9bf40abc", "score": "0.6138279", "text": "def index\n params[:tag] ? @photos = Photo.tagged_with(params[:tag]) : @photos = Photo.all\n album = params[:album_id]\n @photos = current_user.photos.all.where(album_id: album).with_attached_pictures\n\n end", "title": "" }, { "docid": "458fff701522b90f61dc5f70439af9cd", "score": "0.6129674", "text": "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n @album = Admin::Album.find(params[:album_id])\n end", "title": "" }, { "docid": "3a2c096ac0a9bd2b7ea5ef6650705312", "score": "0.61261123", "text": "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n respond_to do |format|\n if @album.save\n if @album.user.locations.any?\n add_location_to_user_albums(@album.user.locations.where(status: 'current').first) if @album.user.locations.where(status: 'current').any?\n end\n create_activity(@album.class.name, @album.id, 'create')\n format.html { \n if album_params.has_key?(:cover)\n render 'crop' \n else \n redirect_to @album, notice: 'Portfolio was successfully created.' \n end \n }\n format.json { render action: 'show', status: :created, location: @album } \n \n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5c7a4c9cbb021119b796610c22bdf57", "score": "0.61228824", "text": "def album\r\n #prepare_new_album extracted for reuse from spec\r\n prepare_new_album unless @content\r\n end", "title": "" }, { "docid": "0f50d4e6deed6f8309b94f56025913cf", "score": "0.61173373", "text": "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "title": "" }, { "docid": "8b5df64c19dc5ac13db4806a0e01c5d9", "score": "0.6113468", "text": "def index\n @photos = @allbum.photos\n end", "title": "" }, { "docid": "8ff5d13a791cbcae2fceaa72283a3dce", "score": "0.6111077", "text": "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "title": "" }, { "docid": "b8ee413f011a65838218a79580cfbecf", "score": "0.6107403", "text": "def show\n @album = Album.find(params[:id])\n# @photos = @album.photos\n \n @photos = Photo.search(params[:id],params[:page])\n\n @organization = Organization.find(:first, :conditions => [\"album_id = ?\",params[:id]])\n @event = Event.find(:first, :conditions => [\"album_id = ?\",params[:id]])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "title": "" }, { "docid": "e243cb24983fb86457afa7cb31b4b292", "score": "0.61055326", "text": "def show\n @gallery = Gallery.find(params[:id])\n @category = Category.find(@gallery.category_id)\n @illustrations = @gallery.illustrations.find(:all, :order => \"sorted_order\")\n @illustration = @gallery.illustrations.build\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "1928a7352544d1574fedd116732a2a68", "score": "0.60990477", "text": "def image_library\n @title = \"Insert image\"\n # Only interested in images\n get_files(params.merge({:key => 'Image'}))\n render :layout => 'admin_modal'\n end", "title": "" }, { "docid": "e4a6a1fbbc9ddb7b2c50ef5216c0f569", "score": "0.6097213", "text": "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n end", "title": "" }, { "docid": "c1f8d7a1b42b7d3db29de59701e5a8b3", "score": "0.6088417", "text": "def show\n if (show = params[:show_photo])\n session[:show_photo] = (show == 'true')\n end\n\n @new_folder = Folder.new(parent: @folder)\n @new_item = Item.new(folder: @folder)\n @new_photo = Photo.new(item_id: nil)\n end", "title": "" }, { "docid": "a08008788be627d31639089d8ab44856", "score": "0.6084754", "text": "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", "title": "" }, { "docid": "63fd063c9ca9b6240d287e89d0c7cbbe", "score": "0.6074726", "text": "def show\n @album = Album.find(params[:id]) \n @album_images = Image.where(:album_id => @album.id).order(\"mark DESC\").page(params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post.to_xml(:include => :images) }\n format.json { render :json => @post.to_json(:include => :images) }\n end\n end", "title": "" }, { "docid": "ce8a11477d26e56e11a595089a15c8df", "score": "0.6071968", "text": "def show\n @photos = Photo.where('album_id' => params[:id]).paginate(:page => params[:page], :per_page => 20)\n end", "title": "" }, { "docid": "0575b031987ddafac27053a0cd6c89fe", "score": "0.6071515", "text": "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", "title": "" }, { "docid": "e6cdbd392050d4113a91158bdc04c0a5", "score": "0.6068676", "text": "def show\n\t\t@album = Album.find(params[:id])\n\tend", "title": "" }, { "docid": "5c16f93f1a9b265ccec39f31ed81136d", "score": "0.6058356", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "5c16f93f1a9b265ccec39f31ed81136d", "score": "0.6058356", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "5c16f93f1a9b265ccec39f31ed81136d", "score": "0.6058356", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "5c16f93f1a9b265ccec39f31ed81136d", "score": "0.6058356", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "5c16f93f1a9b265ccec39f31ed81136d", "score": "0.6058356", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "7b5d4aaf1ebe5afdf383ea14d77a0924", "score": "0.60583496", "text": "def create\r\n @image = Image.create()\r\n @composition = Composition.create(composition_params)\r\n render 'show'\r\n end", "title": "" }, { "docid": "9f94eb2807b740c484978d066bfbc197", "score": "0.60572565", "text": "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", "title": "" }, { "docid": "5cc2c5bb588b3081de4a631a92624a0f", "score": "0.6052392", "text": "def show\n redirect_to user_album_photos_path(@user,params[:id])\n end", "title": "" }, { "docid": "955d7562a76854a2c6a2db83413cbd12", "score": "0.60482186", "text": "def create\n @photo = Photo.new(params[:photo])\n @photo.file = params[:file]\n\n respond_to do |format|\n if @photo.save\n format.html { render :text => \"FILEID:\" + @photo.file.album.url }\n format.json { render :nothing => true }\n else\n format.html { render :text => \"ERRORS:\" + @photo.errors.full_messages.join(\" \"), :status => 500 }\n format.json { render json => @photo.errors, :status => 500 }\n end\n end\n end", "title": "" }, { "docid": "f53a29f97b59ee723f9ac42b7472feae", "score": "0.60443455", "text": "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", "title": "" }, { "docid": "f7478e0ed6c05a705d13948d09e51017", "score": "0.6042278", "text": "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", "title": "" }, { "docid": "811e6f92e28266204a99ebbc68065144", "score": "0.603503", "text": "def new\n @album = Album.find(params[:album_id])\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end", "title": "" }, { "docid": "5a0ec473ecd25ff1c0d25e07e6cc6a53", "score": "0.6030514", "text": "def create\n @photo = @gallery.photos.new(params[:photo])\n if @photo.save\n flash[:success] = \"Foto #{@photo.filename} do álbum criada com sucesso. Envie outra se quiser.\"\n redirect_to new_admin_gallery_photo_path(@gallery)\n else\n @page_title = \"Novo Foto do álbum\"\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "e6d54c6cccb1e6ffec524c29a03bd227", "score": "0.60304755", "text": "def create\n @album = Album.new(album_params)\n @album.owner = @current_owner\n @album.owner_id = @current_owner.id\n if @album.creation_date.blank?\n @album.creation_date=Date.current#new(year: Time.now.year,day: Time.now.day,month: Time.now.month)\n end\n @album.cover=nil\n if @album.save\n redirect_to @album, notice: 'Альбом успешно создан.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "fe1f8dddcb28b18a4879b4f1b3b7e316", "score": "0.60243565", "text": "def edit\n @album = Album.includes(:images, :creator).find(params[:id])\n render :edit\n end", "title": "" }, { "docid": "1424685cb6e3c6ccbfe6b4044e505081", "score": "0.6018502", "text": "def set_album\n @album = Album.includes(:photos, :shares).find(params[:id])\n end", "title": "" }, { "docid": "254a89eae125c1a3c922c00ce3b8dd00", "score": "0.60169965", "text": "def gallery\n \n @gallery = Picture.all\n\nend", "title": "" }, { "docid": "e0e63aa34ac87db16e68e88f32c4c745", "score": "0.60144454", "text": "def new\n @album = Album.find(params[:album_id])\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "title": "" }, { "docid": "a15c99a5c3ff6454f210b753eafb2453", "score": "0.6008748", "text": "def create\n @photo = @project.photos.new(photo: params[:file])\n authorize! :create, @photo\n @photo.save!\n render :partial => \"show\"\n end", "title": "" }, { "docid": "95f4d46ce2ade6c4c7be4d87870d46fd", "score": "0.5996863", "text": "def galleryphoto() @galleryphoto = GalleryPhoto.new end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "d0686d02d34720178ebe34ef7392d213", "score": "0.5988865", "text": "def set_album\n @album = Album.find(params[:id])\n end", "title": "" }, { "docid": "f01e6097bdebf58a50879ab37a88992e", "score": "0.59812653", "text": "def create\n already_uploaded_images_for_same_album = Image.where(\"album_id=?\",params[:image][:album_id])\n raise Exception.new(\"You have already uploaded 25 images for the same album, please try to create new album\") if already_uploaded_images_for_same_album.count == 25\n @image = Image.new\n @image.image_url = params[:image][:image_url]\n @image.tagline = image_params[:tagline]\n date_params = image_params[\"created_date(1i)\"] + \"/\" + image_params[\"created_date(2i)\"] + \"/\" + image_params[\"created_date(3i)\"]\n @image.created_date = date_params\n @image.user_id = current_user.id\n @image.album_id = params[:image][:album_id].to_i\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe38346b2ff505bfcb9262f767fa750b", "score": "0.59764445", "text": "def new\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\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", "title": "" }, { "docid": "b46a670f289388f82e6540eef43216f6", "score": "0.5968857", "text": "def create\n @gallery = Gallery.new(gallery_params)\n\n \n if @gallery.save\n redirect_to action: 'index'\n else\n redirect_to action: 'new'\n end\n \n end", "title": "" }, { "docid": "01788155dca7fc4532e819df39420d69", "score": "0.59680367", "text": "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", "title": "" } ]
704eb7c1da366c893d8ad20063b13ca4
Unsubscribe from the given channel name
[ { "docid": "92662f9d59dc1b578dd57873c93a2917", "score": "0.8080039", "text": "def unsubscribe(channel_name)\n return nil unless subscribed? channel_name\n \n WSChannel.find_by_name(channel_name).remove_subscriber(self)\n @subscribed_channels.delete channel_name\n end", "title": "" } ]
[ { "docid": "e6865459c3ada468658ea10b2741a282", "score": "0.8080335", "text": "def unsubscribe_from_channel channel_id\n delete(\"/channels/#{channel_id}\", code:204)\n end", "title": "" }, { "docid": "c5160679a6841b4a8d513337d3f176fd", "score": "0.7976394", "text": "def unsubscribe channel\n @client.unsubscribe channel\n end", "title": "" }, { "docid": "e8766f6247304ccea855f232a8a7cd20", "score": "0.7970011", "text": "def unsubscribe(channel)\n send_action('unsubscribe', channel)\n end", "title": "" }, { "docid": "fdd8adf7bac1bd96cbbe32256062d02f", "score": "0.7969452", "text": "def close_channel(name)\n name = name.to_sym\n channel = @channels[name]\n if channel\n channel.send_message(event: :unsubscribe)\n @channels.delete(channel)\n end\n end", "title": "" }, { "docid": "dfdeab5c2ec500c3d2d13c8df698248b", "score": "0.79457754", "text": "def unsubscribe_from_channel channel_id\n perform_delete(\"/me/channels/#{channel_id}\")\n end", "title": "" }, { "docid": "0d757fa9bcc21bc47f20da4d11276838", "score": "0.76795644", "text": "def remove_channel(name)\n\t\tname.assert_kind Channel, String\n\n\t\tleave_channel(name)\n\t\[email protected] name if channel.kind_of? String and @channels.has_key? name\n\tend", "title": "" }, { "docid": "f89b7584eef1ba3ac566ae61cee31f38", "score": "0.76550144", "text": "def unsubscribe_from_channel(channel)\n log_debug \"#{self.class} runs 'unsubscribe_from_channel' method with #{channel}\"\n server_kill_reactors(channel)\n end", "title": "" }, { "docid": "87d85fd676360be326152bbc9268581a", "score": "0.75611514", "text": "def unsubscribe_from_channel(channel)\n super\n async.redis_action('unsubscribe', channel)\n end", "title": "" }, { "docid": "07220862eedc09ec45d1c19516fa08ff", "score": "0.7524221", "text": "def unsubscribe(channel, data)\n super\n async.redis_action('unsubscribe', channel)\n end", "title": "" }, { "docid": "75b07c5a0cbfd2039fe7c23e385d3b71", "score": "0.7480628", "text": "def unsubscribe\n publisher.publish channel, 'unsubscribe'\n @thread.kill\n @thread = nil\n end", "title": "" }, { "docid": "b3250a35407cb66db2cf4e2d3fd2add4", "score": "0.7414614", "text": "def unsubsribe_from_channel channel_id\n perfrom_delete(\"/users/#{get_id}/channel/#{channel_id}\")\n end", "title": "" }, { "docid": "133b24defd04971e74f976d6d0ddb24c", "score": "0.74071926", "text": "def unsubscribe(name)\n id = @sub_ids[name]\n self.send(msg: 'unsub', id: id)\n end", "title": "" }, { "docid": "7954b22735f27999a683d8814863646b", "score": "0.7396146", "text": "def unsubscribe(name); end", "title": "" }, { "docid": "a5632e3d4ee58f0414227937b9bd5534", "score": "0.7371909", "text": "def unsubscribe(channel, _json_data)\n log_debug \"#{self.class} runs 'unsubscribe' method with #{channel}\"\n return unless channel.present?\n forget_channel(channel)\n delete_server_subscribers(channel)\n end", "title": "" }, { "docid": "44054d521bb87908149da17accbd07d2", "score": "0.7251726", "text": "def unsubscribe(topic, channel)\n name = \"#{topic}:#{channel}\"\n subscriber = @subscribers[name]\n return unless subscriber\n subscriber.stop\n @subscribers.delete(name)\n end", "title": "" }, { "docid": "e8fc29d08dbc6391f4370ed3b5865b93", "score": "0.7241408", "text": "def delete_channel(name)\n delete \"/api/channels/#{name}\" do |response, error|\n raise ::Pigeon::NuntiumException.new error.message if error\n\n response\n end\n end", "title": "" }, { "docid": "68a44b10acd0c668fffa43c359808cf7", "score": "0.7220674", "text": "def unsubscribe name, headers={}\n @connection.unsubscribe name, headers\n @listeners[name] = nil\n end", "title": "" }, { "docid": "b5df6003e400a4b42d052e1ba9b4b949", "score": "0.72087973", "text": "def unsubscribe(name, headers = {})\n @connection.unsubscribe(name, headers)\n @listeners[name] = nil\n end", "title": "" }, { "docid": "6d9e5550883e2ab46de0a6f72b388115", "score": "0.71936846", "text": "def unsubscribe(channel)\n\t\t\treturn unless is_channel_valid channel\n\t\t\tch = @channels[channel]\n\t\t\tif ch != nil\n\t\t\t\tbegin @on_exception_callback.call(self, \"Not subscribed to the channel #{channel}\") if(@on_exception_callback)\t\n\t\t\t\treturn end unless ch.is_subscribed\n\t\t\t\tch.subscribe_on_reconnected = false\n\t\t\t\tEM.next_tick {\n\t\t\t\t\[email protected] \"unsubscribe;#{@app_key};#{channel}\".to_json\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t@on_exception_callback.call(self, \"Not subscribed to the channel #{channel}\") if(@on_exception_callback)\t\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9a82af67b5f2f26022ffac9553001ae3", "score": "0.7099677", "text": "def handle_unsubscribe_from_channels(origin_client_id, params)\n channel_symbols = params[:channels]\n options = {}\n @qsif[:channel_manager].unsubscribe(origin_client_id, channel_symbols, options)\n end", "title": "" }, { "docid": "1ac09b04bc36a07ab47ea9af51c40588", "score": "0.7079596", "text": "def unsubscribe\n @connection.unsubscribe(@name)\n true\n end", "title": "" }, { "docid": "50a57d44a7f93078211bf2c846585877", "score": "0.70748526", "text": "def delete_channel(name)\n delete \"/api/channels/#{name}\" do |response, error|\n raise ::Pigeon::VerboiceException.new error.message if error\n\n response\n end\n end", "title": "" }, { "docid": "48bfd653e7da6676c636bc8e141855b8", "score": "0.7016702", "text": "def unsubscribe(channel, callback)\n listener.remove_subscriber(channel, callback)\n end", "title": "" }, { "docid": "f20b88c97c8f137710facba94d747ec7", "score": "0.70122933", "text": "def remove(channel_or_channel_name)\n @mutex.synchronize do\n if channel_or_channel_name.is_a?(String)\n channel_or_channel_name = find(channel_or_channel_name)\n end\n \n @channels.delete(channel_or_channel_name)\n end\n end", "title": "" }, { "docid": "73bea35754d616db1a93811d5646d639", "score": "0.6994794", "text": "def unsubscribe(name, headers = {}, subscription_id = nil)\n headers[:destination] = name\n transmit \"UNSUBSCRIBE\", headers\n if @reliable\n subscription_id = name if subscription_id.nil?\n @subscriptions.delete(subscription_id)\n end\n end", "title": "" }, { "docid": "b40e8a40b5715a1c196e23ea0a0e22e7", "score": "0.69881177", "text": "def destroy_channel name\n @channels.delete name\n remove_from_store self, gen_key(self), gen_key(self, name)\n remove_all_from_store self, gen_key(self, name)\n end", "title": "" }, { "docid": "b6905f4f3265e5af431a7ab0b6c99cbf", "score": "0.69719785", "text": "def unsubscribe(channel, obj)\n x = @pub_sub_list[channel].delete(obj)\n raise \"#{obj} tried to #{self}.unsub_from #{channel} which is not in list\" unless x\n end", "title": "" }, { "docid": "02185f12a5a5e4194ca334bf8b939f90", "score": "0.6942461", "text": "def unsubscribe!\n channel.unsubscribe(sid)\n ensure\n log.info(widget_name) { \"Unsubscribed #{sid} via #{channel}\" }\n end", "title": "" }, { "docid": "c55849e4e1cd517b825df7ef521c18e2", "score": "0.6936551", "text": "def unsubscribe(*channels)\n delegate.unsubscribe(\n @app.socket_digest(@app.socket_connection_id),\n *channels\n )\n end", "title": "" }, { "docid": "3619dc51bb910736fe1bdd82c85a23c9", "score": "0.6934893", "text": "def unsubscribe(name)\n #EM.schedule { @subs.delete name }\n EM.add_timer(1) { @subs.delete name }\n end", "title": "" }, { "docid": "844a394a427f3b996ce633a94f1dedb9", "score": "0.69198674", "text": "def unsubscribe(key, channels)\n registry.unsubscribe_to_channels_for_key(channels, key)\n end", "title": "" }, { "docid": "844a394a427f3b996ce633a94f1dedb9", "score": "0.69198674", "text": "def unsubscribe(key, channels)\n registry.unsubscribe_to_channels_for_key(channels, key)\n end", "title": "" }, { "docid": "3aa8cd7d7cff8ed5f9dcc4022e77036b", "score": "0.6909612", "text": "def unsubscribe_all\n @subscribed_channels.each do |channel_name|\n unsubscribe channel_name\n end\n end", "title": "" }, { "docid": "3ee17c229e28187402eee8b743dea061", "score": "0.68960464", "text": "def unsubscribe(name, headers = {}, subId=NIL)\n headers[:destination] = name\n transmit \"UNSUBSCRIBE\", headers\n if @reliable\n subId = name if subId==NIL\n @subscriptions.delete(subId)\n end\n end", "title": "" }, { "docid": "779234a73e1409dc4a95a807a4688718", "score": "0.68852454", "text": "def unsubscribe(*channels); end", "title": "" }, { "docid": "779234a73e1409dc4a95a807a4688718", "score": "0.68852454", "text": "def unsubscribe(*channels); end", "title": "" }, { "docid": "0f0e8f49662cbe3d25d21231eb55eac9", "score": "0.6879388", "text": "def unsubscribe(name)\n raise HandlerError.new \"Unable to unsubscribe handler #{name}\" unless @subscribers.has_key? name\n @subscribers.delete(name)\n\n self # This allows C#-like syntax : my_event -= subscriber\n end", "title": "" }, { "docid": "ffebf6667a9470735c9c6713b88c2a37", "score": "0.6836033", "text": "def unsubscribe(name, headers = {}, subId = nil)\n headers[:destination] = name\n transmit(\"UNSUBSCRIBE\", headers)\n if @reliable\n subId = name if subId.nil?\n @subscriptions.delete(subId)\n end\n end", "title": "" }, { "docid": "ffebf6667a9470735c9c6713b88c2a37", "score": "0.6836033", "text": "def unsubscribe(name, headers = {}, subId = nil)\n headers[:destination] = name\n transmit(\"UNSUBSCRIBE\", headers)\n if @reliable\n subId = name if subId.nil?\n @subscriptions.delete(subId)\n end\n end", "title": "" }, { "docid": "9e01cdcf84a71918253e99c60a9edc0f", "score": "0.68317777", "text": "def unsubscribe_clients(channel)\n send_action('unsubscribe_clients', channel)\n end", "title": "" }, { "docid": "f84503acec44b174312c92be66778407", "score": "0.68246853", "text": "def unsubscribe(*channels)\n channels = Array.ensure(channels).flatten\n raise ArgumentError if channels.empty?\n delegate.unsubscribe(@app.socket_digest(@app.socket_connection_id), channels)\n end", "title": "" }, { "docid": "db6d3fbf672cdd76bd9850de5fa58e72", "score": "0.68071073", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end", "title": "" }, { "docid": "db6d3fbf672cdd76bd9850de5fa58e72", "score": "0.68071073", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end", "title": "" }, { "docid": "db6d3fbf672cdd76bd9850de5fa58e72", "score": "0.68071073", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end", "title": "" }, { "docid": "db6d3fbf672cdd76bd9850de5fa58e72", "score": "0.68071073", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end", "title": "" }, { "docid": "db6d3fbf672cdd76bd9850de5fa58e72", "score": "0.68071073", "text": "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n end", "title": "" }, { "docid": "7e211ca5ad9e44206f252ebedc2d31a7", "score": "0.68036044", "text": "def unsubscribe(destination_name, headers = {})\n @subscriptions.delete(destination_name)\n end", "title": "" }, { "docid": "757243f09bc2306a883ebc96ee53c6a6", "score": "0.67864", "text": "def punsubscribe(*channels); end", "title": "" }, { "docid": "757243f09bc2306a883ebc96ee53c6a6", "score": "0.67864", "text": "def punsubscribe(*channels); end", "title": "" }, { "docid": "37b47e68993193216246fd83ce88bcdb", "score": "0.6721714", "text": "def unsubscribe_from_room(nickname)\n call_subscription_api('room/%s/subscribe?unsubscribe=1' % URI.encode(nickname))['status']\n end", "title": "" }, { "docid": "43aa048308d15dcbb7f60b995e993de6", "score": "0.67073214", "text": "def unsubscribe(name, &block)\n if not @subscribed.nil? and (@subscribed.first == name)\n @subscribed = nil\n end\n \n yield if not block.nil?\n end", "title": "" }, { "docid": "2888161930b3fd929c9dc81c2f4eeb0e", "score": "0.66839606", "text": "def unsubscribe(name, &block)\n if name.in? @subscribed_names\n @subscribed_names.delete name\n @native.ignore(name, &block)\n elsif not block.nil?\n EM::next_tick do\n yield\n end\n end\n end", "title": "" }, { "docid": "dfae4b6250e7af402a88578e106579c7", "score": "0.6679678", "text": "def forget_channel(channel)\n if @channels.blank?\n @websocket.close\n else\n @channels.delete(channel)\n end\n end", "title": "" }, { "docid": "31185b16bb5e61ff9068e0a123c8ff21", "score": "0.6670278", "text": "def unsubscribe(*channels)\n channels.each do |channel|\n @sub_callbacks.delete(channel)\n @subs.delete(channel)\n end\n raw_send_command(:unsubscribe, *channels)\n return pubsub_deferrable(*channels)\n end", "title": "" }, { "docid": "b7971cdbb595824ea6c7bc0b71c6cd9a", "score": "0.6669707", "text": "def unsubscribe(channel)\n Minion.info(\"Unsubscribing to #{queue}\")\n channel.queue(queue, durable: true, auto_delete: false).unsubscribe\n @running = false\n end", "title": "" }, { "docid": "e8d99ca97fa0ae50d4706b01bf64ed1a", "score": "0.66505253", "text": "def unsubscribe destination_name, message_headers={}\n subscriptions[destination_name].remove\n subscriptions.delete(destination_name) if subscriptions[destination_name].count <= 0\n end", "title": "" }, { "docid": "57c5a919720108cb886c704f87d43e25", "score": "0.6637514", "text": "def unsubscribe_from(username)\n action(username, 'unsubscribe')\n end", "title": "" }, { "docid": "f3b9a832fae1bebf54c733b7900c1391", "score": "0.66300696", "text": "def unsubscribe(name)\n @named_handlers_lock.synchronize do\n @named_handlers.delete(name)\n end\n end", "title": "" }, { "docid": "93508c5e095315d2e554cc01cdcc9145", "score": "0.6610168", "text": "def unsubscribe\n if @channel.channel_type == \"group\"\n if !params[:group_id]\n render_json :status => :bad_request, :messages => \"Must declare explicit group id to unsubscribe.\" and return\n end\n group = Group.find(params[:group_id])\n if !group || [email protected]_subscribers.exists?(group)\n render_json :status => :bad_request, :messages => \"Group id does not exist or is not subscribed to the channel.\" and return\n end\n if !group.admins.exists?(@user)\n render :status => :forbidden and return\n end\n @channel.group_subscribers.delete(group)\n render :status => :ok and return\n else\n if params[:person_id]\n if !ensure_same_as_logged_person(@channel.owner.guid)\n render_json :status => :forbidden, :messages => \"You are not the channel owner\" and return\n end\n person = Person.find_by_guid(params[:person_id])\n if !person\n render_json :status => :bad_request, :messages => \"Person not found\" and return\n end\n else\n person = @user\n end\n if [email protected]_subscribers.exists?(person)\n render_json :status => :bad_request, :messages => \"Person is not subscribed to channel.\" and return\n end\n @channel.user_subscribers.delete(person)\n render :status => :ok and return\n end\n end", "title": "" }, { "docid": "f1a4993dd4a901f4787766262face121", "score": "0.6608046", "text": "def remove(channel_id, broadcasting)\n socket.unsubscribe(channel_id, broadcasting)\n end", "title": "" }, { "docid": "764373cb23dfcde69b228e1649e768e2", "score": "0.6577789", "text": "def release(name)\n channels.delete(name)\n end", "title": "" }, { "docid": "3a6a5f3a30e7873f470ea8635bdd7478", "score": "0.6577251", "text": "def unsubscribe(name, &block)\n not_implemented\n end", "title": "" }, { "docid": "902c23ff1827444086109e72dfd233c8", "score": "0.65745604", "text": "def unsubscribe destination_name, message_headers={}\n end", "title": "" }, { "docid": "9dd97c8e2a58ba4f4d36b2cf04ea5fd6", "score": "0.65502554", "text": "def unsubscribe destination_name, message_headers={}\r\n end", "title": "" }, { "docid": "1e3bb3aa08dcfaeb02191c083b218c8f", "score": "0.6523044", "text": "def unsubscribe destination_name, message_headers={}\n @stomp_connection.unsubscribe(destination_name, message_headers)\n end", "title": "" }, { "docid": "dc7787e42538c6e08d5a2a191106c9a5", "score": "0.6521172", "text": "def unsubscribe(channels, &block)\n connect {\n channels = [channels].flatten\n validate_channels(channels)\n \n @transport.send({\n 'channel' => Channel::UNSUBSCRIBE,\n 'clientId' => @client_id,\n 'subscription' => channels\n \n }) do |response|\n if response['successful']\n channels = [response['subscription']].flatten\n channels.each { |channel| @channels[channel] = nil }\n end\n end\n }\n end", "title": "" }, { "docid": "8c096095cf4a8bf30bf3e49c0d1093c7", "score": "0.650328", "text": "def unsubscribe(feed, callback)\n RestClient.post(hub, :headers => HEADER, 'hub.mode' => 'unsubscribe', 'hub.topic' => feed, 'hub.callback' => callback, 'hub.verify' => 'async')\n end", "title": "" }, { "docid": "7d1b5d9a3ce87093f2fc0257b40a392c", "score": "0.6497793", "text": "def unsubscribe(channel, subscription = nil, &block)\n subscription ||= block\n\n if Array === channel\n return channel.map { |c| unsubscribe(c, subscription) }\n end\n\n dead = @channels.unsubscribe(channel, subscription)\n return unless dead\n\n connect {\n info('Client ? attempting to unsubscribe from ?', @dispatcher.client_id, channel)\n\n send_message({\n 'channel' => Channel::UNSUBSCRIBE,\n 'clientId' => @dispatcher.client_id,\n 'subscription' => channel\n\n }, {}) do |response|\n next unless response['successful']\n\n channels = [response['subscription']].flatten\n info('Unsubscription acknowledged for ? from ?', @dispatcher.client_id, channels)\n end\n }\n end", "title": "" }, { "docid": "2d07d00fc8094c0fff3a44252d04d0f4", "score": "0.6485864", "text": "def unsubscribe signature, broadcaster_name\n subscriber = @subscribers[signature]\n @broadcasters[broadcaster_name].mb.delete subscriber[:subscriber]\n subscriber[:broadcasters].delete broadcaster_name\n end", "title": "" }, { "docid": "30d87912d7c4dec7be905d5cfcf970ee", "score": "0.6481501", "text": "def unsubscribe\n @channel.unsubscribe current_user\n respond_to do |format|\n format.html { redirect_to channels_path, notice: \"Abonnement erfolgreich beendet.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0bf5d62e3bc02124db30e219ad91d51b", "score": "0.64100134", "text": "def unsubscribe(channels=nil)\n if channels.class == Array && block_given?\n @j_del.java_method(:unsubscribe, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(channels.map { |element| element },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling unsubscribe(channels)\"\n end", "title": "" }, { "docid": "5b222098f387a1539732d4fa9e97a9f9", "score": "0.6405144", "text": "def unsubscribe(topic, url)\n # note: do NOT encode the URL, this is not decoded on the erlang side!\n # (only strings are allowed anyway)\n # url = @conn.class.encode_value(url)\n result = @conn.call(:unsubscribe, [topic, url])\n @conn.class.process_result_unsubscribe(result)\n end", "title": "" }, { "docid": "e964ee7d5c3ee43a12ea3fe15bfe7ce0", "score": "0.63980263", "text": "def unsubscribe(subreddit)\n subscriptions.find_by(subreddit: subreddit).destroy\n end", "title": "" }, { "docid": "e0e6f9f5d8a8ab852d66b008d30230ac", "score": "0.63964176", "text": "def unsubscribe_clients(channel, _json_data)\n log_debug \"#{self.class} runs 'unsubscribe_clients' method with #{channel}\"\n return if channel.blank?\n unsubscribe_from_channel(channel)\n @server.subscribers[channel] = []\n end", "title": "" }, { "docid": "f6cf1d5d3246640a5c56c0c16085a12c", "score": "0.6384929", "text": "def unsubscribe(entity, eventName)\n\t\tif @subscriptions[eventName] \n\t\t\tfor i in 0..@subscriptions[eventName].length() - 1\n\t\t\t\tif entity == @subscriptions[eventName][i]\n\t\t\t\t\tputs \"[eventBus]Unsubscribing \" + entity.getName() + \" from channel \" + eventName\n\t\t\t\t\t@subscriptions[eventName][i] = nil \n\t\t\t\t\tbreak \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "387307f04016ce5f12f43a46b8ef9592", "score": "0.6381579", "text": "def unsubscribe_all(channel, data)\n info 'clearing connections'\n shutdown\n end", "title": "" }, { "docid": "2292a0faa10ddb13b5cbb66776966667", "score": "0.63716096", "text": "def unsubscribe(*args)\n params = arguments(args, required: [:topic, :callback]).params\n _merge_action!(\"unsubscribe\", arguments.topic, arguments.callback, params)\n params['headers'] = HEADERS\n\n post_request(\"/hub\", params)\n end", "title": "" }, { "docid": "08a318ab0887755ae9f830591a79eab0", "score": "0.6369921", "text": "def unsubscribe(opts = {})\n\t\t\tconsumer_tag = opts[:consumer_tag] || name\n\t\t\t\n\t\t\t# ignore the :nowait option if passed, otherwise program will hang waiting for a\n\t\t\t# response from the server causing an error\n\t\t\topts.delete(:nowait)\n\t\t\t\n client.send_frame( Qrack::Protocol::Basic::Cancel.new({ :consumer_tag => consumer_tag }.merge(opts)))\n\n\t\t\traise Bunny::ProtocolError,\n\t\t\t\t\"Error unsubscribing from queue #{name}\" unless\n\t\t\t\tclient.next_method.is_a?(Qrack::Protocol::Basic::CancelOk)\n\t\t\t\t\n\t\t\t# return confirmation\n\t\t\t:unsubscribe_ok\n end", "title": "" }, { "docid": "34926f534253c02849bcb78fb660bab0", "score": "0.6326632", "text": "def unsubscribe queue_name, message_headers={}\n if @subscriptions[queue_name]\n @subscriptions[queue_name].remove\n @subscriptions.delete(queue_name) if @subscriptions[queue_name].count <= 0\n end\n end", "title": "" }, { "docid": "af17be625ec473a141acd09a7be52bcc", "score": "0.6313914", "text": "def unsubscribe(hub_url, token = nil)\n if token != nil\n @tokens << token.to_s\n end\n change_subscription(:unsubscribe, hub_url, token)\n end", "title": "" }, { "docid": "f83909f1130092c1c00007fdc352a16e", "score": "0.6304256", "text": "def unsubscribe_service(user_name, repo_name, service_name, params={})\n _validate_presence_of user_name, repo_name, service_name\n normalize! params\n event = params.delete('event') || 'push'\n topic = \"https://github.com/#{user_name}/#{repo_name}/events/#{event}\"\n callback = \"github://#{service_name}\"\n\n unsubscribe(topic, callback)\n end", "title": "" }, { "docid": "9a6962338ccc22e5853e3737deb4913f", "score": "0.629201", "text": "def remove_all(channel_id)\n socket.unsubscribe_from_all(channel_id)\n end", "title": "" }, { "docid": "9ab2638675efc90b2a9a4edc535aca2a", "score": "0.6281132", "text": "def unsubscribe_from_user(nickname)\n call_subscription_api('user/%s/subscribe?unsubscribe=1' % URI.encode(nickname))['status']\n end", "title": "" }, { "docid": "b56a800b8699dca855da18f288c7bc1a", "score": "0.62778306", "text": "def unsubscribe queue_name, message_headers={}\r\n @subscriptions[queue_name] -= 1\r\n @subscriptions.delete(queue_name) if @subscriptions[queue_name] <= 0\r\n end", "title": "" }, { "docid": "918091d81b9bc6d112d59f927b60520e", "score": "0.62759936", "text": "def unsubscribe(hub_url, async = false, token = nil)\n if token != nil\n @tokens << token.to_s\n end\n change_subscription(:unsubscribe, hub_url, async, token)\n end", "title": "" }, { "docid": "41b358010a6bb49ed8b695ae50eda2e7", "score": "0.62637573", "text": "def unsubscribed\n x = Chatroom.find(params[:id])\n x.unsubscribe()\n end", "title": "" }, { "docid": "9b6689d875ddfb0cce576d03a8e169d2", "score": "0.6258263", "text": "def unsubscribe subreddit\n subscribe(\"unsub\", subreddit)\n end", "title": "" }, { "docid": "499cb73a3d801a74b20d51712239941d", "score": "0.625037", "text": "def unsubscribe\n @actor << 'UNSUBSCRIBE'\n end", "title": "" }, { "docid": "18541d9596f7f547ac1eefafdeed1655", "score": "0.624698", "text": "def unsubscribe queue_name, message_headers={}\n if @subscriptions[queue_name]\n @subscriptions[queue_name].remove\n if @subscriptions[queue_name].count <= 0\n sub = @subscriptions.delete(queue_name)\n @queues_by_priority[sub.priority].delete(queue_name)\n end\n end\n end", "title": "" }, { "docid": "13518d719035e5d9b8d79dfc26b74824", "score": "0.62409866", "text": "def unsubscribe(subscription_id)\n @broker.consumer_channel.unsubscribe(subscription_id)\n @subscriptors.delete subscription_id\n end", "title": "" }, { "docid": "9d63bf0078af6c0f125fc5f5c2a64733", "score": "0.6226952", "text": "def unsubscribe(exchange_name, routing_key, auto = false)\n @queue.unbind(exchange_name.to_s, :routing_key => routing_key.to_s)\n if subscriptions[exchange_name.to_s]\n subscriptions[exchange_name.to_s].delete(routing_key.to_s)\n end\n Myxi.logger.debug \"[#{id}] \\e[42;37mUNSUBSCRIBED\\e[0m \\e[32m#{exchange_name} / #{routing_key}\\e[0m\"\n send('Unsubscribed', :exchange_name => exchange_name, :routing_key => routing_key, :auto => auto)\n end", "title": "" }, { "docid": "4f09cd043e004b263805bbb6d92030d1", "score": "0.62237245", "text": "def Unsubscribe eventName\n\t\t\tif !$dipsSubscriptions[eventName].nil?\n\t\t\t\t$dipsSubscriptions.delete(eventName)\n\t\t\t\t#send the unsubscription to the server\n\t\t\t\tevent = { \"EventName\" => eventName , \"ClientId\" => @clientId, \"MessageType\" => \"unsubscribe\" }\n\t\t\t\t#send the event\n\t\t\t\[email protected] JSON.generate(event)\n\t\t\telse\n\t\t\t\traise \"You are not subscribed to that event\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "e9a6b3e5a5b519336b98d51a451e29dc", "score": "0.6220391", "text": "def unsubscribe(topic, callback); end", "title": "" }, { "docid": "c855f4021bb384ad0e9d412bb3f98212", "score": "0.6216204", "text": "def delete_channel!(channel)\n sns.delete_topic(topic_arn: channel.arn)\n end", "title": "" }, { "docid": "667cb161654617810a132b8f997a60ee", "score": "0.6214782", "text": "def unsubscribe(subscription)\n end", "title": "" }, { "docid": "bc33c2d9670ea0b4bf681d519911134b", "score": "0.62139624", "text": "def unsubscribe(subreddit)\n edit_subscription(:unsub, subreddit)\n end", "title": "" }, { "docid": "f6be586dd90383add8ea0b6c33c51267", "score": "0.6210843", "text": "def unsubscribe(topic, symbol = nil)\n @callbacks[topic.to_s] = nil\n\n payload = { op: :unsubscribe, args: [subscription(topic, symbol)] }\n @faye.send payload.to_json.to_s\n end", "title": "" }, { "docid": "ae9a5d06c8d0209d8014f73c1e3e9479", "score": "0.62046516", "text": "def remove_channel(cid)\n return self.channels.delete(cid)\n end", "title": "" }, { "docid": "698bc3f764fb81e69fa5c4e6c8013bef", "score": "0.61672485", "text": "def unsubscribe(topic, callback, params={})\n _validate_presence_of topic, callback\n normalize! params\n _merge_action!(\"unsubscribe\", topic, callback, params)\n\n post_request(\"/hub\", params)\n end", "title": "" }, { "docid": "079add75049da86b8934af39dace1719", "score": "0.6166261", "text": "def unsubscribe_service(*args)\n params = arguments(args, required: [:user, :repo, :service]).params\n event = params.delete('event') || 'push'\n topic = \"#{site}/#{arguments.user}/#{arguments.repo}/events/#{event}\"\n callback = \"github://#{arguments.service}\"\n\n unsubscribe(topic, callback)\n end", "title": "" } ]
170952720094e6b8c9574b7ea67f01e9
The `block` or `numblock` node associated with this method dispatch, if any.
[ { "docid": "fc7c69e40a66ec8b135ee5c4f7f1ca7d", "score": "0.70371586", "text": "def block_node; end", "title": "" } ]
[ { "docid": "a973b709cc0d84320fbab5cfd9e19a24", "score": "0.71095395", "text": "def block_node\n case sexp_type\n when :method_add_block\n self[2]\n end\n end", "title": "" }, { "docid": "845eac4cc0e461348d838912ea325c1b", "score": "0.6910919", "text": "def process_block(node)\n node\n end", "title": "" }, { "docid": "e997d167464be890f1d0945e288b7aa6", "score": "0.6777642", "text": "def block_node\n parent if block_literal?\n end", "title": "" }, { "docid": "1ee2226743e1ca30e572cac2ab773d91", "score": "0.6656753", "text": "def block_node=(_); end", "title": "" }, { "docid": "1ee2226743e1ca30e572cac2ab773d91", "score": "0.6656753", "text": "def block_node=(_); end", "title": "" }, { "docid": "e54e7187b1fd0fdabbef80a5dfa57ad1", "score": "0.6517905", "text": "def visit_block(node); end", "title": "" }, { "docid": "9b8ba6772a3a60edebb31bca6d00af00", "score": "0.6446649", "text": "def netblock\n return @netblock\n end", "title": "" }, { "docid": "ca63ee1dac7dff07509e72cf034cdad1", "score": "0.63422394", "text": "def block_type\n type.block_type\n end", "title": "" }, { "docid": "c1b72d7ae8c82c0f9273f43ab535dc34", "score": "0.6324485", "text": "def cur_block\n return HDLRuby::High.cur_block\n end", "title": "" }, { "docid": "a4727132c96541e82c912b0ad68258a5", "score": "0.625092", "text": "def BlockNode(opening, block_var, bodystmt); end", "title": "" }, { "docid": "4f587229678da5c797e0279f11acf0cb", "score": "0.62213564", "text": "def node\n return @node\n end", "title": "" }, { "docid": "6db10047feb52211330cba841b8234f3", "score": "0.6216849", "text": "def active_block\n @nodes\n end", "title": "" }, { "docid": "381a286b0ca46424966114d99c5fcabe", "score": "0.6149854", "text": "def visit_blockarg(node); end", "title": "" }, { "docid": "67a5da4a16761c4a36ea7f048f4235b5", "score": "0.6140173", "text": "def node()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "5fdf737b6dfb2df21387f7374395ab72", "score": "0.61289096", "text": "def node\n @current_node\n end", "title": "" }, { "docid": "ccf83257b5c79736eb178a947db86421", "score": "0.6127765", "text": "def node()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ccf83257b5c79736eb178a947db86421", "score": "0.6127765", "text": "def node()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ccf83257b5c79736eb178a947db86421", "score": "0.6127765", "text": "def node()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "73c3852a39928586a67239d9a7a14478", "score": "0.61086106", "text": "def node\n c[:node]\n end", "title": "" }, { "docid": "67b6d5f8f6d1cfb87bb1898d5d1fe5e9", "score": "0.6077061", "text": "def node\n @node\n end", "title": "" }, { "docid": "e11617d588e63f4e79f3d3b14f554df5", "score": "0.6034377", "text": "def current_block\n @blocks.last\n end", "title": "" }, { "docid": "9ae813c08724d05e05a9cf9cdaed8a33", "score": "0.60217", "text": "def caller\n if :block == self.type\n self.children[0]\n else\n raise Synvert::MethodNotSupported.new \"caller is not handled for #{self.inspect}\"\n end\n end", "title": "" }, { "docid": "99d7c5a66202f95f4a2fd9cb8f67f571", "score": "0.5989352", "text": "def node\n\t\t@current_node\n\tend", "title": "" }, { "docid": "6f1a8754d92360d80413402e9df0439d", "score": "0.59610337", "text": "def find_ancestor_method_dispatch_node(node)\n return unless (ancestor = node.parent.parent)\n return unless ancestor.call_type? || ancestor.super_type? || ancestor.yield_type?\n return if brackets?(ancestor)\n\n ancestor\n end", "title": "" }, { "docid": "6a0fdc80beea896953f32f11fd8dc958", "score": "0.5945613", "text": "def block\n collected[:block]\n end", "title": "" }, { "docid": "e284adb1e1575edba5b1fd4cb0faf836", "score": "0.59358597", "text": "def caller\n if :block == self.type\n self.children[0]\n else\n raise Synvert::Core::MethodNotSupported.new \"caller is not handled for #{self.debug_info}\"\n end\n end", "title": "" }, { "docid": "1c84b2b477c8fb75ab2a0c42fded43bd", "score": "0.59201974", "text": "def current_block\n Near::Block.new(get('/block'))\n rescue Common::IndexerClient::NotFoundError\n nil\n end", "title": "" }, { "docid": "57ba9c6e755915061c5344c9ea1a4cb4", "score": "0.5910894", "text": "def block\n @block || @parent && @parent.block\n end", "title": "" }, { "docid": "a63f100541fa2340da9bf81a8d06b911", "score": "0.5877833", "text": "def node\n read_attr :node\n end", "title": "" }, { "docid": "71382cdabd0c4a3527ed15b61de57bbd", "score": "0.5848256", "text": "def block_def_node\n if @ast == nil\n # Get array of block parameter names\n block_params = block.parameters.map do |param|\n param[1]\n end\n\n parser_local_vars = command_binding.local_variables + block_params\n source = Parsing.parse_block(block, parser_local_vars)\n @ast = AST::BlockDefNode.new(\n parameters: block_params,\n ruby_block: block, # necessary to get binding\n body: AST::HostSectionBuilder.from_parser_ast(source))\n end\n\n return @ast\n end", "title": "" }, { "docid": "eb838479fa07961cb4193072d0c00be4", "score": "0.5823858", "text": "def find_block(node, block_name)\n return if node.nil?\n\n node.each_child_node(:block) do |block_node|\n next if block_node.method_name != block_name\n\n @offensive_node = block_node\n @offense_source_range = block_node.source_range\n return block_node\n end\n # If not found then, parent node becomes the offensive node\n @offensive_node = node.parent\n @offense_source_range = node.parent.source_range\n nil\n end", "title": "" }, { "docid": "aebf16d17b72337b1cd2a2aef1482334", "score": "0.57951", "text": "def node\n if @node\n @node\n else\n structure.regions.breadth_each do |node|\n @node = node[self.id]\n break if @node\n end\n @node\n end\n end", "title": "" }, { "docid": "48e18221712714ae24385d13a3fa8579", "score": "0.5789711", "text": "def current_block\n Coda::Block.new(get('/block'))\n end", "title": "" }, { "docid": "fbef6b71d55f2c9c45d60aa5f7ed13b3", "score": "0.57772297", "text": "def block\n @block\n end", "title": "" }, { "docid": "428773ccc4326ffeac390f2d1de0e11e", "score": "0.5757995", "text": "def get_current_node\n\t\t@node\n\tend", "title": "" }, { "docid": "e789a86a73fec8495bf4ed47481342f4", "score": "0.5748174", "text": "def node\n attributes['node']\n end", "title": "" }, { "docid": "e789a86a73fec8495bf4ed47481342f4", "score": "0.5748174", "text": "def node\n attributes['node']\n end", "title": "" }, { "docid": "e789a86a73fec8495bf4ed47481342f4", "score": "0.5748174", "text": "def node\n attributes['node']\n end", "title": "" }, { "docid": "e789a86a73fec8495bf4ed47481342f4", "score": "0.5748174", "text": "def node\n attributes['node']\n end", "title": "" }, { "docid": "2f6e3ae7ff82155209746392790bb011", "score": "0.574791", "text": "def neo_blockchain_get_block\n raise NotImplementedError\n end", "title": "" }, { "docid": "42bf6e9eb0de876e9bc71a2521207821", "score": "0.5746968", "text": "def max\n block_given? ? super : @node.max\n end", "title": "" }, { "docid": "c9b969c268b4d8969b40201bcae8167f", "score": "0.57236916", "text": "def block\n if self.is_a?(Block)\n return self\n elsif self.parent.is_a?(Scope)\n # No block\n return nil\n else\n return self.parent.block\n end\n end", "title": "" }, { "docid": "a130b3d6c9aaec90028376299d3cd0c7", "score": "0.5719432", "text": "def next_block\n\t\t\[email protected]_block(@next_block_id)\n\t\tend", "title": "" }, { "docid": "42fbaafe7cecda526e438c44d31dec78", "score": "0.57104653", "text": "def node\n self\n end", "title": "" }, { "docid": "cf1548dc3e7da45699e4c976d7b29109", "score": "0.5706912", "text": "def block_argument\n args(:block).first\n end", "title": "" }, { "docid": "ab2de9eae67ed1ca96ebac4b41b91dae", "score": "0.57029384", "text": "def node\n attributes['node']\n end", "title": "" }, { "docid": "8c0a99fb5c4b33e530cdcb39b5733422", "score": "0.5701762", "text": "def node\n run_context && run_context.node\n end", "title": "" }, { "docid": "abdcc07862a3f9b3667c7b3517a9a1f6", "score": "0.56864655", "text": "def method_missing(method_sym, *args, &block)\n super if method_sym.to_s == 'anonymous' #these aren't actual node names\n\n begin\n #does a node with that name exist?\n node=get_node(method_sym.to_s)\n rescue RuntimeError => err_node\n #what about an edge?\n begin\n edge = get_edge(method_sym.to_s)\n rescue RuntimeError => err_edge\n #no luck, sorry\n super\n else\n edge\n end\n else\n node\n end\n end", "title": "" }, { "docid": "8bff7ddb323cc44dc4e39f1437d99558", "score": "0.56757575", "text": "def block_method\n children.first\n end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673545", "text": "def node; end", "title": "" }, { "docid": "28591c192d02897f69d772480c5f7d11", "score": "0.5673417", "text": "def node; end", "title": "" }, { "docid": "b93ae3647c859f7c9e3827aa6648e645", "score": "0.56572664", "text": "def block_method(&block)\n block.class\nend", "title": "" }, { "docid": "696565e95056febd8d66b2ef91c2b530", "score": "0.564384", "text": "def _current_node\n current_node\n end", "title": "" }, { "docid": "ef77f2fd544bd3036fb671872563950e", "score": "0.5627397", "text": "def block_label; end", "title": "" }, { "docid": "ef77f2fd544bd3036fb671872563950e", "score": "0.5627397", "text": "def block_label; end", "title": "" }, { "docid": "92fb9790abbfe2d9dbbc8ace3cade21d", "score": "0.5616085", "text": "def get_node\n node = nil\n node = $1 if self.current_file.to_s =~ /\\/(\\we\\d)\\//\n node = 'unknown' if node.nil? or node.empty?\n node\n end", "title": "" }, { "docid": "7eebba48bc59cad396e39e3382b96fc5", "score": "0.5612554", "text": "def __node ; @node ; end", "title": "" }, { "docid": "2209874adce2da3f739d2408467cf1c3", "score": "0.5611456", "text": "def node_type()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "2209874adce2da3f739d2408467cf1c3", "score": "0.56095004", "text": "def node_type()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "2209874adce2da3f739d2408467cf1c3", "score": "0.56095004", "text": "def node_type()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "2209874adce2da3f739d2408467cf1c3", "score": "0.56095004", "text": "def node_type()\n #This is a stub, used for indexing\n end", "title": "" } ]
d82383a36dfa7c399827b4961b60f234
DELETE /clinic_services/1 DELETE /clinic_services/1.json
[ { "docid": "a29f7883327b5a033c5af7369aca692c", "score": "0.75389427", "text": "def destroy\n @clinic_service.destroy\n respond_to do |format|\n format.html { redirect_to clinic_services_url, notice: 'Clinic service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "86bd23d6faf3e6039b39f08e648a8bf8", "score": "0.71698284", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a954c53d7babf4437325fb9eb3f26df", "score": "0.71513146", "text": "def destroy\n @clinic = Clinic.find(params[:id])\n @clinic.destroy\n\n respond_to do |format|\n format.html { redirect_to clinics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a954c53d7babf4437325fb9eb3f26df", "score": "0.71510464", "text": "def destroy\n @clinic = Clinic.find(params[:id])\n @clinic.destroy\n\n respond_to do |format|\n format.html { redirect_to clinics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eddb7680c796c42b17a53483c3a5a9bf", "score": "0.6970979", "text": "def destroy\n @client_service = ClientService.find(params[:id])\n @client_service.destroy\n\n respond_to do |format|\n format.html { redirect_to client_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd6af730d04c2bf0e88fbc9954fb8fd0", "score": "0.6933844", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url, notice: 'Clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd6af730d04c2bf0e88fbc9954fb8fd0", "score": "0.6933844", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url, notice: 'Clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd6af730d04c2bf0e88fbc9954fb8fd0", "score": "0.6933844", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url, notice: 'Clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd6af730d04c2bf0e88fbc9954fb8fd0", "score": "0.6933844", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url, notice: 'Clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd6af730d04c2bf0e88fbc9954fb8fd0", "score": "0.6933844", "text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url, notice: 'Clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cea81539720c54414a6771cb0cbfb30d", "score": "0.6932177", "text": "def destroy\n @consultant_service = ConsultantService.find(params[:id])\n @consultant_service.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ec2e9002164b056208c610f43ea9c0fb", "score": "0.69054365", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to company_type_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "85a7c2e413d6dbe42f59a4fadf1531a3", "score": "0.6898627", "text": "def destroy\n @clinic_info = ClinicInfo.find(params[:id])\n @clinic_info.destroy\n\n respond_to do |format|\n format.html { redirect_to clinic_infos_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.68897676", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "ccab3c7fefcc7ac23111b4749b7cf217", "score": "0.6863035", "text": "def destroy\n @clinic = @reg.clinic\n @reg.destroy\n respond_to do |format|\n format.html { redirect_to @clinic}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b983d72b84a6e646dcfd82742ee17c87", "score": "0.6854235", "text": "def delete\n @clinic = Clinic.find(params[:id])\n end", "title": "" }, { "docid": "1939e1c8840932cd102454dd12ea5bb2", "score": "0.6827046", "text": "def destroy\n @clinic_visit.destroy\n respond_to do |format|\n format.html { redirect_to clinic_visits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.6782378", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "4b80e719427bc3c65957dc2a9f9813a5", "score": "0.67672956", "text": "def destroy\n @service = Service.where(:id => params[:id], :company_id => current_user.company.id).first\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "19b697638c5a42fe0e37f22258f6ce88", "score": "0.675112", "text": "def destroy\n @lservice = Lservice.find(params[:id])\n @lservice.destroy\n\n respond_to do |format|\n format.html { redirect_to lservices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "092cb857433a95fc7ea69f7784e49183", "score": "0.6750987", "text": "def destroy\n @clinica = Clinica.find(params[:id])\n @clinica.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e497d42e22753ca68a1bb18034fc9f6c", "score": "0.67311853", "text": "def destroy\n\n @service_location = @contract.service_locations.find(params[:id])\n @contract.service_locations.destroy(@service_location)\n\n respond_to do |format|\n format.html { redirect_to contract_url(@contract) }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "822696d49f31610649f3a2a897278ed6", "score": "0.6725347", "text": "def destroy\n @clinic = Clinic.find(params[:id])\n @clinic.destroy\n\n respond_to do |format|\n format.html { redirect_to(clinics_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d18254904f00c6c7f2c915c19db8aff1", "score": "0.6724547", "text": "def destroy\n @clinic_flow = ClinicFlow.find(params[:id])\n @clinic_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to clinic_flows_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "69b647d0fba19caa74d6918b92ba2528", "score": "0.67087406", "text": "def destroy\n service.destroy\n render json: service, status: 200\n end", "title": "" }, { "docid": "53ce5828dfdf0476ac8ec3ab989c1b26", "score": "0.66992086", "text": "def destroy\n #@incident.destroy\n render json: {}, status: 200\n end", "title": "" }, { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.6665793", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "84d557b04f6e804702e3249ac36b52fa", "score": "0.6642802", "text": "def destroy\n @clinic_patient.destroy\n respond_to do |format|\n format.html { redirect_to clinic_patients_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "10307d20bffd292c1b4440353cf00ef2", "score": "0.66168946", "text": "def destroy\n @risp_service = RispService.find(params[:id])\n @risp_service.destroy\n\n respond_to do |format|\n format.html { redirect_to risp_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3273deb534eadb44175032f597ae60a8", "score": "0.6614625", "text": "def destroy\n @customer_service = CustomerService.find(params[:id])\n @customer_service.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "59d6aab35021ee053708e2fcd79d3db0", "score": "0.6609351", "text": "def destroy\n @packages_clinic = PackagesClinic.find(params[:id])\n @packages_clinic.destroy\n\n respond_to do |format|\n format.html { redirect_to packages_clinics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7b83dc6ef77f6150046fc1bcafb4b98c", "score": "0.6599428", "text": "def destroy\n @crm_client.destroy\n respond_to do |format|\n format.html { redirect_to crm_clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f771df7d19346fc235fe7bb3807d51c9", "score": "0.65992427", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "5589a47217e9e631553accee1ddbb147", "score": "0.6596775", "text": "def destroy\n @service_of_dependence.destroy\n respond_to do |format|\n format.html { redirect_to service_of_dependences_url, notice: 'Service of dependence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b38747e81c4313e9ae5156f25f5b47d4", "score": "0.6590748", "text": "def destroy\n @servicelevel = Servicelevel.find(params[:id])\n @servicelevel.destroy\n\n respond_to do |format|\n format.html { redirect_to servicelevels_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7668a909fe280c1cd271820e08243337", "score": "0.65872645", "text": "def destroy\n @lab_service.destroy\n respond_to do |format|\n format.html { redirect_to lab_services_url, notice: 'Lab service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f189701a29081c00f588657e73e392b", "score": "0.65861624", "text": "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07983bef381b5c38c614c8c66b27c9bc", "score": "0.65667546", "text": "def destroy\n @polyclinic.destroy\n respond_to do |format|\n format.html { redirect_to polyclinics_url, notice: 'Polyclinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "52744ba98777952ac9e0078a51969252", "score": "0.6563313", "text": "def destroy\n @company_service.destroy\n respond_to do |format|\n format.html { redirect_to company_services_url, notice: 'Company service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42545090e1a7ef1958f7541876b190f1", "score": "0.6560141", "text": "def destroy\n @cms_reference_service = ReferenceService.find(params[:id])\n @cms_reference_service.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_reference_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8a67da3c0a80239b790a14b51d559de9", "score": "0.65467787", "text": "def destroy\n render json: @api_v1_client if @api_v1_client.destroy\n end", "title": "" }, { "docid": "9dda6c24345a882547d3ad82cc0e10cb", "score": "0.6540012", "text": "def destroy\n @covid19_clinic.destroy\n respond_to do |format|\n format.html { redirect_to covid19_clinics_url, notice: 'Covid19 clinic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "581030534cabe871f672bc3c618ac953", "score": "0.653482", "text": "def destroy\r\n @itinerary_service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to itinerary_services_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "ac6ce581a27e69d0fc21ae3d9c02ce26", "score": "0.6528644", "text": "def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end", "title": "" }, { "docid": "b8c37ef2daee9143c7858dcbc86c0040", "score": "0.65242565", "text": "def destroy\n @content_clinic.destroy\n respond_to do |format|\n format.html { redirect_to content_clinics_url, notice: 'Klinika została usunięta.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bedcd9acd0a5cee5bb9be5cca872d077", "score": "0.65159625", "text": "def destroy\n @servicecol = Servicecol.find(params[:id])\n @servicecol.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_servicecols_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "56d397e7de71769c4f2013df86e1c569", "score": "0.6503746", "text": "def destroy\n @companies_service.destroy\n respond_to do |format|\n format.html { redirect_to companies_services_url, notice: 'Companies service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42bf509d63cb36d4d195ef2f26ebbb10", "score": "0.6488635", "text": "def destroy\n @servicios = Servicio.find(params[:id])\n @servicios.destroy\n\n respond_to do |format|\n format.html { redirect_to(servicios_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "07f09ed4feab647cb98047c690685b4d", "score": "0.64881086", "text": "def destroy\n @optin_service.destroy\n respond_to do |format|\n format.html { redirect_to optin_services_url, notice: 'Optin service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75b5498d8dbcc2393dfbc14aea3b1b94", "score": "0.6484104", "text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75b5498d8dbcc2393dfbc14aea3b1b94", "score": "0.6484104", "text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75b5498d8dbcc2393dfbc14aea3b1b94", "score": "0.6484104", "text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75b5498d8dbcc2393dfbc14aea3b1b94", "score": "0.6484104", "text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f3d0762ae3f88958e0c1cafc998221f", "score": "0.6482759", "text": "def destroy\n @risp_project_service = RispProjectService.find(params[:id])\n @risp_project_service.destroy\n\n respond_to do |format|\n format.html { redirect_to risp_project_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6b49f9688757f4c44ca21c200e771013", "score": "0.64817137", "text": "def destroy\n @city_service = CityService.find(params[:id])\n @city_service.destroy\n\n respond_to do |format|\n format.html { redirect_to city_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dba38206dd14c962b59f4a4a584aaeea", "score": "0.6479302", "text": "def destroy\n @budget_service_detail.destroy\n respond_to do |format|\n format.html { redirect_to budget_service_details_url, notice: 'Budget service detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "193553ab0b8b27c9b580341c3ac4ebca", "score": "0.6479111", "text": "def destroy\n @horizon_service_item.destroy\n respond_to do |format|\n format.html { redirect_to horizon_service_items_url, notice: \"Horizon service item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cc08f323ba9ab1ad75ea4603595254b3", "score": "0.6478544", "text": "def destroy\n @ivr_service.destroy\n respond_to do |format|\n format.html { redirect_to ivr_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31e5a51b98ea334a62b796835e31f04b", "score": "0.6476642", "text": "def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end", "title": "" }, { "docid": "58f2d60b1fdfdf80c9b48173b70e86f9", "score": "0.64724123", "text": "def destroy\n @servicerequest.destroy\n respond_to do |format|\n format.html { redirect_to servicerequests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fafa1d8c481e931cea162a61649ac873", "score": "0.6470867", "text": "def destroy\n @clinic_history.destroy\n respond_to do |format|\n format.html { redirect_to clinic_histories_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fafa1d8c481e931cea162a61649ac873", "score": "0.6470867", "text": "def destroy\n @clinic_history.destroy\n respond_to do |format|\n format.html { redirect_to clinic_histories_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c1cde2518cb592b6add14fe05ae1b37d", "score": "0.6468687", "text": "def delete\n options = self.to_h \n uri = self.class.path_builder(:delete, self.id)\n data = {}\n data['id'] = self.id \n data = data.to_json\n VivialConnect::Client.instance.make_request('DELETE', uri, data)\n end", "title": "" }, { "docid": "9e067292454636b82df1831323ce2199", "score": "0.646503", "text": "def destroy\n #@service = Service.find(params[:id])\n @service = Service.new\n @service.id = params[:id]\n @service.app_id = params[:app_id]\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to app_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "67a020d7213b3d0fba15d1bf2946b771", "score": "0.64599407", "text": "def destroy\r\n @service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to services_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "763409068cb667db916000aacf992d9a", "score": "0.64581734", "text": "def destroy\n @service = Service.find(params[:id])\n @client = Client.find(@service.cl_id)\n @service.destroy\n mnglog = MngLog.new(cr_time: Time.now.getlocal, who: @staff_login.fullname+\" (\"+@staff_login.user+\")\", text: \"Удалил сервис #{srv_type_hash[@service.type_s]} для клиента: #{@client.name} #{@client.flag}, адрес:#{@service.addr}, скорость:#{@service.speed}, ipaddr:#{@service.ipaddr}, vlan:#{@service.vlan}\")\n mnglog.save\n respond_to do |format|\n format.html { redirect_to \"/services/?cl_id=#{params[:cl_id]}\", notice: @service.attributes[:notice] }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6ab0b24efa8a15020cd03e0d6960ba84", "score": "0.645478", "text": "def destroy\n\n @service.destroy\n respond_to do |format|\n format.html { redirect_to admin_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c13fffbd080bcb2bfb5f47f5cde5c703", "score": "0.64520705", "text": "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to new_salon_path, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea121a7d98c6f9ecf72534d7fef6a7f5", "score": "0.6451297", "text": "def destroy\n @agency_client = AgencyClient.find(params[:id])\n @agency_client.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_clients_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5bd11f7914ed312c2c8bb3613f0f0412", "score": "0.6449807", "text": "def destroy\n @service_version_so.destroy\n respond_to do |format|\n format.html { redirect_to service_version_sos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c17cd02fc84ff4dbf697dbd140e6f79b", "score": "0.6445272", "text": "def destroy\n @setservice = Setservice.find(params[:id])\n @setservice.destroy\n\n respond_to do |format|\n format.html { redirect_to setservices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "98560e832d4b2e4468de9e40d63c8242", "score": "0.6443642", "text": "def delete\n\t\tServiceRequest.find(params[:id]).destroy\n\t\tredirect_to :action => 'list'\n\tend", "title": "" }, { "docid": "2139bd75c39ddfc740753cd569ba3a27", "score": "0.6442917", "text": "def destroy\n bonus = Bonus.find_by_service_id(params[:id])\n if bonus\n bonus.delete\n end\n @service = Service.find(params[:id])\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { render json: @service.id}\n end\n end", "title": "" }, { "docid": "0fd6e28af60b19841bdadb22230b3c65", "score": "0.6439514", "text": "def delete_service(service_id)\n request(:delete, \"/service/#{service_id}\")\n end", "title": "" }, { "docid": "9f89a9b2d2bda6bc1d3d433ae1febffb", "score": "0.6439464", "text": "def delete\n render json: AppraisalCompany.delete_by_id(params[:id])\n end", "title": "" }, { "docid": "64b6fe1ec4b356d1d14b72664ddf3134", "score": "0.6437753", "text": "def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "319a15602e32fc5521bc9c512ca74540", "score": "0.6433827", "text": "def destroy\n @cst = Cst.find(params[:id])\n @cst.destroy\n\n respond_to do |format|\n format.html { redirect_to csts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "12ef5be416425ec2398545f0a462a561", "score": "0.6433507", "text": "def destroy\n @service.destroy\n render json: { status: \"your service was deleted\" }\n end", "title": "" }, { "docid": "7a0e69d4b1958684e5ebe80d49ead9e9", "score": "0.64297605", "text": "def destroy\n http_api.delete(\"clients/#{@name}\")\n end", "title": "" }, { "docid": "dd5c041547919b45704bc0c9874f2d91", "score": "0.6428906", "text": "def destroy\n @project_service = ProjectService.find(params[:id])\n @project_service.destroy\n\n respond_to do |format|\n format.html { redirect_to project_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fbdabb3b4461c508acf7c0e212f196ef", "score": "0.6427165", "text": "def destroy\n @service_record.destroy\n respond_to do |format|\n format.html { redirect_to service_records_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "773e5d611adeb09776f9c841e1b876cc", "score": "0.6422776", "text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end", "title": "" }, { "docid": "ed8b26ac67988906e766a7c8953dce37", "score": "0.6420421", "text": "def rest_delete(url, token_id, ssl_ca_file = @ssl_ca_file)\n begin\n RestClient::Request.execute(method: :delete, url: \"#{url}\", headers: {'accept': 'application/json', 'x-auth-token': token_id}, :ssl_ca_file => \"#{ssl_ca_file}\")\n rescue\n RestClient::Request.execute(method: :delete, url: \"#{url}\", headers: {'accept': 'application/json', 'x-auth-token': token_id}, verify_ssl: false)\n end\n end", "title": "" }, { "docid": "70e746a9f9bdf561ffa649beafb8af77", "score": "0.6418886", "text": "def destroy\n @complex_graph = ComplexGraph.find(params[:id])\n @complex_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to url_for(:controller=>:service, :action => :index) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea5cb48b122940eb90dec878a00411e6", "score": "0.641867", "text": "def destroy\n service = Service.find_by(id: params[:id])\n service.destroy\n end", "title": "" }, { "docid": "f5db887052543f47a4adc43c43fb045a", "score": "0.64181566", "text": "def destroy\n @costa_tropical = CostaTropical.find(params[:id])\n @costa_tropical.destroy\n\n respond_to do |format|\n format.html { redirect_to costa_tropicals_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d67e06e8e49bec14fd671ec823feeeb4", "score": "0.6411974", "text": "def destroy\n @cysteine = Cysteine.find(params[:id])\n @cysteine.destroy\n\n respond_to do |format|\n format.html { redirect_to cysteines_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "169cce382a2b02712a79b7a6e5ce8456", "score": "0.6408625", "text": "def destroy\n @service = @definition.service\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to @service, notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "26f009e39253331264daf8deedd10115", "score": "0.64048153", "text": "def destroy\n @clinician = Clinician.find(params[:id])\n @clinician.destroy\n respond_to do |format|\n format.html { redirect_to(edit_clinic_path(current_user.clinic.id), :notice => 'Clinician was successfully deleted.') } # supply clinic id as argument on call not clinic id=344; always goes to id=1; why?\n format.xml { head :ok }\n\n end\n end", "title": "" }, { "docid": "4d9afad932585da0f1ade6748d270627", "score": "0.6403727", "text": "def destroy\n @net_svc = NetSvc.find(params[:id])\n @net_svc.destroy\n\n respond_to do |format|\n format.html { redirect_to net_svcs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "145dc2267a20a7ae9db0935f4f5b9bb5", "score": "0.6402795", "text": "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Solicitud de servicio borrada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d4324ced9ce2f2d3f4e5afe8b72d97d", "score": "0.64015007", "text": "def destroy\n @event_service = Event::Service.find(params[:id])\n @event_service.destroy\n\n respond_to do |format|\n format.html { redirect_to event_services_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c7d79b440f49ed008c04c56bc999cbaf", "score": "0.64000356", "text": "def delete service\n\t @name_services.delete service\n\tend", "title": "" }, { "docid": "b9f43dc5113fc2a66e168287aa37e46d", "score": "0.6396787", "text": "def destroy\n @clinic_event.destroy\n respond_to do |format|\n format.html { redirect_to clinic_events_url, notice: 'Clinic event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a740d444f7658781a7811d9018ab3f63", "score": "0.63967675", "text": "def destroy\n @client = current_client\n @calificacion = Calificacion.find(params[:id])\n if @cotizacion.destroy\n respond_to do |format|\n format.html { redirect_to client_cotizacion_path, notice: 'Calificacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "ae0ace6a7727a70faa73f073da31289f", "score": "0.63949746", "text": "def destroy\n @servico = Servico.find(params[:id])\n @servico.destroy\n\n respond_to do |format|\n format.html { redirect_to servicos_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
0212582f16ef753b716f6bb5594e0a91
prints the map to the log as tables
[ { "docid": "96e20ef60223b9b885d9c12eb29963c4", "score": "0.76899767", "text": "def print_map\n\t\tLog.full \"Junctions: #{junctions.count}\"\n\t\tLog.full \" \" << Junction.list_header\n\t\tjunctions.each_with_index { |junction,i| Log.full \"(#{i}) #{junction.as_list_line}\" }\n\n\t\tLog.full \"Roads: #{roads.count}\"\n\t\tLog.full Road.list_header\n\t\troads.each { |road| Log.full road.as_list_line }\n\n\t\tLog.full Car.list_header\n\t\tcars.each { |car| Log.full car.as_list_line }\n\t\t\"\"\n\tend", "title": "" } ]
[ { "docid": "7becc9283c00f277f9429a9a77056311", "score": "0.69360715", "text": "def printmap\n\t\[email protected] { |row|\n\t\t\tprintf \"%d to %d is a range of %d, translating to %d / %s to %s\\n\",row[0],row[1],row[1]-row[0],row[2],\n\t\t\t\tip(row[2].to_i),ip(row[3].to_i)\n\t\t}\n\tend", "title": "" }, { "docid": "d97e9fbf7c84d155dce3094016b5772c", "score": "0.68127126", "text": "def print_map\n \n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n \n print @map.name + \"\\n\\n\"\n \n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n print \" \"\n end\n row.each_with_index do |tile, t|\n if ((@location.first == r) && (@location.second == t))\n print \"¶ \"\n elsif (!tile.seen)\n print \" \"\n else\n print tile.graphic + \" \"\n end\n end\n\t\t\tprint \"\\n\"\n end\n \n print \"\\n\"\n \n # Provide some spacing to center the legend.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n \n # Prints the legend.\n puts \"¶ - #{@name}'s \\n location\\n\\n\"\n end", "title": "" }, { "docid": "90b0721a266f5929765c5166743790db", "score": "0.6812109", "text": "def show_map(map=@map)\n puts \"This is your map\"\n for i in 0..(map.size-1)\n for j in 0..(map.size-1)\n if j==map.size-1\n puts map[i][j]\n else\n print map[i][j]\n STDOUT.flush\n end\n end\n end\n end", "title": "" }, { "docid": "fccee184cd5a934642d4c6169e28c5e8", "score": "0.6659444", "text": "def show_map\n map if @partitions.size == 0\n @partitions.each do |partition|\n partition.nodes.reject { |n| n.node.map.nil? }.each do |node|\n puts\n puts node\n node.node.map.each_pair do |action, map|\n puts ' - ' + action.to_s\n map[:routes].each { |r| puts \"\\t\" + r }\n end\n end\n end\n end", "title": "" }, { "docid": "62d619b8e14278ba469b235165680f55", "score": "0.664562", "text": "def print_map\n\n # Provide some spacing from the edge of the terminal.\n 3.times { print \" \" };\n\n print @location.map.name + \"\\n\\n\"\n\n @location.map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n 2.times { print \" \" }\n\n row.each_with_index do |tile, t|\n print_tile(C[r, t])\n end\n print \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n 3.times { print \" \" }\n\n # Prints the legend.\n print \"¶ - #{@name}'s\\n location\\n\\n\"\n end", "title": "" }, { "docid": "7c7ab1e311b6ccc1a4c9d68e4ea3e5a2", "score": "0.66180784", "text": "def command_showAll\r\n @log.getMap.each_key do |key|\r\n puts key.strftime('%m/%d/%Y')\r\n @log.get_entries(key).each do |i|\r\n puts \" #{i.name}\"\r\n end end\r\n puts $INPUT_RECORD_SEPARATOR\r\n end", "title": "" }, { "docid": "3c21776becd76418525bc87c323eea0c", "score": "0.6555139", "text": "def print_map\n routes = Array.new\n @map.routes.each do |key, value|\n routes.push(key.join('-'))\n end\n puts 'Check map at: http://www.gcmap.com/map?P=' << routes.join(',') << '&MS=wls&MR=800&MX=800x800&PM=*'\n end", "title": "" }, { "docid": "e61e6180ea0a45b8597e545edcb1529e", "score": "0.65285844", "text": "def printMap(theMap)\n\n\ttheMap[:text].each do |theLine|\n\t\tputs theLine.join;\n\tend\n\t\n\tputs \"\";\n\nend", "title": "" }, { "docid": "ed540eff829723ffbb0d3e26a598dc5f", "score": "0.6520956", "text": "def show_map(map=@map)\r\n system('cls')\r\n puts \"SATRIA VILLAGE MAP\"\r\n puts \"\\n\"\r\n for i in 0..(map.size-1)\r\n for j in 0..(map.size-1)\r\n print map[i][j]\r\n end\r\n print \"\\n\"\r\n end\r\n end", "title": "" }, { "docid": "3d586e74a9cb7fafdb7902aea282df83", "score": "0.6460578", "text": "def print\n\t\[email protected] do |e|\n\t\t\tif e\n\t\t\t\tputs \"#{e.key}: #{e.value}\"\n\t\t\telse\n\t\t\t\tputs \"empty\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a905b12cce8cfeae23466e5ee6b9b6aa", "score": "0.63973933", "text": "def print_map\n # work out how long our horizontal line should be, create a string with that many minus signs\n horizontal_line = '-' * (($world[:width] * 6) + 7)\n # work out what a separator line looks like (based on how many columns the map has)\n spacing_line = '| ' + (' | ' * $world[:width]) + ' |'\n\n puts horizontal_line\n\n # print each row's data\n for y in 0..$world[:height] do\n row = $world[:height] - y # print highest to lowest rows, as x=0 y=0 is the bottom row to be shown\n puts '| ' + $world[:map][row].join(' | ') + ' |'\n puts spacing_line\n end\n\n puts horizontal_line\n puts\n puts\nend", "title": "" }, { "docid": "2d72cf13d4512d1c4d8844611efe0e92", "score": "0.63806844", "text": "def show_map(map)\n if(!map.empty?)\n map.each do |x|\n x.each do |y|\n print y\n end\n puts\n end\n end\n end", "title": "" }, { "docid": "618940483a8beb5f6d0d8e7930790332", "score": "0.63589424", "text": "def print_map\n puts \"LIFE: #{player.life} GOLD: #{player.gold} EXPERIENCE: #{player.experience}\".border\n puts\n puts \"-- Dungeon Map --\".align_center\n puts\n puts_formatted_dungeon_map\n puts\n puts \"--- Use arrow keys to move. Beware lurking monsters ---\".border\n end", "title": "" }, { "docid": "9fbe0a6233fb2c8c0f77fc5b2fb50db1", "score": "0.6336134", "text": "def to_s\n table = \"#\" + @mapping_header.join(\"\\t\") + $/\n\n @mapping_table.each do |row|\n table << row.join(\"\\t\") + $/\n end\n\n table.chomp\n end", "title": "" }, { "docid": "6fa1907420cb8ddcd852c8c04dd7a8f4", "score": "0.6322313", "text": "def print_map\n\n puts \"\\nYou're in \" + @map.name + \"!\\n\\n\"\n row_count = 0\n @map.tiles.each do |sub|\n #centers each row under the \"welcome\" sign\n for i in 1..(@map.name.length/2)\n print \" \"\n end\n col_count = 0\n sub.each do |tile|\n if tile.seen\n if tile.passable\n if row_count == @location.first && col_count == @location.second\n print \"¶\"\n else\n print \"·\"\n end\n else\n print \"■\"\n end\n else\n print \" \"\n end\n col_count += 1\n end\n row_count += 1\n puts \"\"\n end\n puts \"\\n· - passable space\" +\n \"\\n■ - impassable space\" +\n \"\\n¶ - your location\\n\\n\"\n end", "title": "" }, { "docid": "2600e749d2da8b0f035f0c67818340a3", "score": "0.6293328", "text": "def printtable\n output = \"\"\n @table.each do |r|\n # maps to a table, adding extra spaces to make each width the same\n output += r.map { |p| p.to_s+\" \"*(@table.last.last.to_s.length-p.to_s.length)}.join(\" | \")+\"\\n\"\n end\n $stdout.write output\n \n end", "title": "" }, { "docid": "5bff5083060eedb4c34d1b2e16086833", "score": "0.62698257", "text": "def print_nicely_map(map)\n puts\n for i in 0...map.length\n for j in 0...map[i].length\n print \"\\t#{map[i][j]}\"\n end\n puts\n end\n puts\nend", "title": "" }, { "docid": "555a0443ee1c86630e2fbe5c29323b3d", "score": "0.6269346", "text": "def display\n num_columns = @map.length\n num_rows = @map[0].length\n for r in (0...num_rows)\n str = \"\"\n for c in (0...num_columns)\n str += @map[c][r]\n end\n puts str\n end\n end", "title": "" }, { "docid": "81caef883f9ecde3906fe139586f1f59", "score": "0.62470245", "text": "def print_map\n\t\[email protected] do |row|\n\t\t\trow.each do |cell|\n\t\t\t\tif cell < 0\n\t\t\t\t\tprint 5\n\t\t\t\telsif cell > 0\n\t\t\t\t\tprint 1\n\t\t\t\telse\n\t\t\t\t\tprint 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\tend", "title": "" }, { "docid": "fce80bbfa2ca25c31af4c65cafdd84f2", "score": "0.62461036", "text": "def print_mappings\n spoonerism.to_h.each do |k, v|\n printf(\"%-#{longest_word_length}s => %s\\n\", k, v)\n end\n end", "title": "" }, { "docid": "35833c1bc9449193ed8584cfa8cf7352", "score": "0.6160729", "text": "def inspect\n map.inspect\n end", "title": "" }, { "docid": "03b5e031fbbad180b17625215de7c6d2", "score": "0.61177135", "text": "def debug_display_map\n floor = @player.location.last\n lines = []\n (1..8).each do |row|\n lines << ''\n (1..8).each do |col|\n c = @player.knows_room?(row, col, floor) ? @castle.room(row, col, floor).display : '?'\n lines.last << (@player.location == [row, col, floor]) ? \"<#{c}> \" : \" #{c} \"\n end\n lines << ''\n end\n lines << Strings.you_are_here(@player)\n puts lines\n puts\n end", "title": "" }, { "docid": "743eac33806cb76e97387f1cbf7b2621", "score": "0.6116721", "text": "def emit_table(hash)\n table = Text::Table.new\n if hash.values.any?{ |val| val.is_a?(Hash) }\n emit_complex_table(hash, table)\n else\n emit_simple_table(hash, table)\n end\n @file.write(table.to_s + \"\\n\\n\")\n end", "title": "" }, { "docid": "3a15e91e1842761f8ebd0d3e18607252", "score": "0.60323244", "text": "def temp_print_world\n puts \"=======================================\"\n @tiles.each do |row|\n row.each do |tile|\n print \"#{tile.to_s}\\t\"\n end\n puts\n end\n puts \"=======================================\"\n end", "title": "" }, { "docid": "79d3ab543d55aac0d0573b42f3a6a083", "score": "0.6018084", "text": "def print\n @g.each{|k,v|\n p k.to_s + \" --> \" + v.collect{|v| v.values.join(\"_\")}.join(\",\")\n }\n end", "title": "" }, { "docid": "ae347da421509ee19d2e5ab4a0cb050f", "score": "0.5971674", "text": "def print_table(state)\r\n\t\tprint_report_header(state)\r\n\t\ti = 1\r\n\t\[email protected] do |bucket|\r\n\t\t\tunless bucket == nil\r\n\t\t\t\t\tputs \"Bucket #{i}:\"\r\n\t\t\t\t\tj = 1\r\n\t\t\t\tbucket.each do |slot|\t\t\t\r\n\t\t\t\t\tprintf \"%45s \\n\", \"Slot #{j}: #{slot[:key]} #{slot[:value]}\"\r\n\t\t\t\t\tj += 1\r\n\t\t\t\tend\r\n\t\t\t\tputs \" Count: #{bucket.count}\"\r\n\t\t\tend\r\n\t\t\ti += 1\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "387b727679969103fa25db1d2854c6fb", "score": "0.5895167", "text": "def push_map\n @fighters.each do |fighter|\n fighter.connection.puts blank_lines\n fighter.connection.puts map\n end\n end", "title": "" }, { "docid": "387b727679969103fa25db1d2854c6fb", "score": "0.5895167", "text": "def push_map\n @fighters.each do |fighter|\n fighter.connection.puts blank_lines\n fighter.connection.puts map\n end\n end", "title": "" }, { "docid": "4c0675628f1bb5b809e3b5f087b73ec3", "score": "0.587735", "text": "def print_table( keys_and_pretty_names, ares_collection)\n t = Array.new\n row = Array.new\n keys_and_pretty_names.each do |key, pretty_name|\n row.push pretty_name\n end\n t.push row\n ares_collection.each do |ares|\n row = Array.new\n keys_and_pretty_names.each do |key, pretty_name|\n row.push ares.attributes[key].to_s\n end\n t.push row\n end\n # use Thor's shell.print_table()\n self.shell.print_table(t)\n end", "title": "" }, { "docid": "f2a1cc16a9b85668f26e12d5b80270c4", "score": "0.586087", "text": "def dump\n output = ''\n @values_table.keys.sort.each do |key|\n #\n # Use inspect, to make ruby 1.8.7 and ruby 1.8 and higher compatible\n output << \"#{key} = #{lookup(key).inspect}\\n\"\n end\n output\n end", "title": "" }, { "docid": "9a1ca85ee3bbf03d032c91186e7cfd21", "score": "0.5843473", "text": "def print_table_info\n puts \"\\n\\nTRAINING AND FREQUENCY TABLE INFO\"\n # puts \"``````````````````````````````````\"\n puts \"----------------------------------\"\n if @cleaned then puts \"** Note some entries have been removed by feature selection\" end\n printf(\"Total unique #{@token_type}s in all spam messages: %16d\\n\", @spam_table.length)\n printf(\"Total unique #{@token_type}s in all ham messages: %16d\\n\", @ham_table.length)\n printf(\"Total unique #{@token_type}s in all combined messages:%16d\\n\", @frequency_table.length)\n printf(\"Total number of spam emails: %36d\\n\", Dir[\"#{@parent_dir}spam/**/*\"].length)\n printf(\"Total number of ham emails: %36d\\n\", Dir[\"#{@parent_dir}ham/**/*\"].length)\n printf(\"Total tokens in spam emails: %36d\\n\", @total_s_toks)\n printf(\"Total tokens in ham emails: %36d\\n\", @total_h_toks)\n end", "title": "" }, { "docid": "80150459ef4ca128c9866dbb7e04f28f", "score": "0.58394146", "text": "def print_each\n operate do |dbm|\n dbm.each_pair {|key, value| puts \"[#{key}]:#{value}\"}\n end\n end", "title": "" }, { "docid": "4e9662ac1ba6c4e9a5abc6fcc92160ef", "score": "0.58252525", "text": "def print_table( keys_to_pretty_names, ares_collection)\n t = Array.new\n\n # Add the first row, the column headings\n t.push keys_to_pretty_names.values\n\n # Add the data\n ares_collection.each do |ares|\n row = Array.new\n keys_to_pretty_names.keys.each do |key|\n row.push ares.attributes[key].to_s\n end\n t.push row\n end\n\n # use Thor's shell.print_table()\n self.shell.print_table(t)\n end", "title": "" }, { "docid": "4e9662ac1ba6c4e9a5abc6fcc92160ef", "score": "0.58252525", "text": "def print_table( keys_to_pretty_names, ares_collection)\n t = Array.new\n\n # Add the first row, the column headings\n t.push keys_to_pretty_names.values\n\n # Add the data\n ares_collection.each do |ares|\n row = Array.new\n keys_to_pretty_names.keys.each do |key|\n row.push ares.attributes[key].to_s\n end\n t.push row\n end\n\n # use Thor's shell.print_table()\n self.shell.print_table(t)\n end", "title": "" }, { "docid": "0e8c836aa17a3d535df0d8684ed4edfe", "score": "0.58179307", "text": "def individual_table(table, stream)\n dump = StringIO.new\n table(table, dump)\n dump.rewind\n dump.each_line {|t|stream.puts \" #{t}\"}\n end", "title": "" }, { "docid": "0e8c836aa17a3d535df0d8684ed4edfe", "score": "0.58179307", "text": "def individual_table(table, stream)\n dump = StringIO.new\n table(table, dump)\n dump.rewind\n dump.each_line {|t|stream.puts \" #{t}\"}\n end", "title": "" }, { "docid": "98748e042fb65b25ef6dfdf57045c511", "score": "0.5812032", "text": "def display\n puts \" | \" + COLS.keys.sort.collect{|p| p.to_s }.join(\" | \")\n puts \"----------------------------------\"\n @tiles.each_with_index do | row, r |\n puts \"#{r + 1} | \" + row.collect {|p| p.nil? ? \" \" : p.name }.join(\" | \")\n end\n end", "title": "" }, { "docid": "8ed5cb695044da6bbfd6bcc6bf6336c6", "score": "0.58104897", "text": "def print_toc(table_hash, line_width)\n table_hash.each do |key, value|\n if value.nil?\n puts key.center(line_width)\n else\n print key.ljust(key.length)\n puts value.rjust(line_width - key.length)\n end\n end\nend", "title": "" }, { "docid": "9a9efe83f2eca468bf341e5155dd6b7d", "score": "0.58044344", "text": "def tables_to_dump\n only_tables.map do |table|\n \"--table='#{table}'\"\n end.join(\"\\s\")\n end", "title": "" }, { "docid": "e0cad3373fbaa060a37173aea76cd438", "score": "0.5775713", "text": "def printMap(map)\r\n for y in 0..map.height-1\r\n for x in 0..map.width-1\r\n printf(\"%c\", map.grid[y][x])\r\n end\r\n printf(\"\\n\")\r\n end\r\nend", "title": "" }, { "docid": "80dc8a991aa7d705bf361b1fdea00b2a", "score": "0.5774659", "text": "def table_print\n @table.each do |row|\n p row\n end\n end", "title": "" }, { "docid": "e516e09180eae4060aee13bd00cd8210", "score": "0.5769135", "text": "def print_data\n @report_data.keys.each do |request_id|\n @column_size_for = {}\n\n io.puts \"/#{request_id.gsub(\"%\", \"/\")}\"\n print_headers request_id\n print_spacers request_id\n print_row_data request_id\n end\n end", "title": "" }, { "docid": "e03a84d7ae1c519fb7b08a29ea2e841f", "score": "0.5768941", "text": "def print_table\n puts\n\n data = get_total_data\n puts(\"Metrics for: \" +\"'\" + data[0] + \"', \" + data[1] + \" Requests, \" + data[2] + \"MB downloaded. \" + \"Load time: \" + data[3] + \"s\")\n\n puts\n print_rows\n puts\n end", "title": "" }, { "docid": "f08853b5dc0124411a680172ca3bdebe", "score": "0.57536846", "text": "def print_hash_table table\n \n\ttable.sort.each do |key, value|\n puts \"#{key} - #{value} - \" + \"\".ljust(value, '*')\n end \nend", "title": "" }, { "docid": "52e28953961f94456ead845ea1ded44e", "score": "0.5750052", "text": "def display_midi_table\n\t\t\t# write the column names\n\t\t\t@midi_table['A'].each do |key, value|\n\t\t\t\tprint \" #{key}\"\n\t\t\tend\n\n\t\t\tputs # just for a newline\n\n\t\t\t@midi_table.each do |na, aa_hash|\n\t\t\t\tprint na \n\t\t\t\taa_hash.each do |aa, midi|\n\t\t\t\t\t#print \" #{'%02X' % midi}\"\n\t\t\t\t\tprint \" #{midi}\"\n\t\t\t\tend\n\t\t\t\tputs\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "275d0b62a3c5f9d97ffe93937caf4e60", "score": "0.5747592", "text": "def putMap\n\t\n\t\t# Find the bounds\n\t\tboundsMin = Point.new;\n\t\tboundsMax = Point.new;\n\t\t\t\t\n\t\[email protected]_key do |thePoint|\n\t\t\n\t\t\tif ( thePoint.x < boundsMin.x)\n\t\t\t\tboundsMin.x = thePoint.x;\n\t\t\tend\n\n\t\t\tif ( thePoint.x > boundsMax.x)\n\t\t\t\tboundsMax.x = thePoint.x;\n\t\t\tend\n\n\t\t\tif ( thePoint.y < boundsMin.y)\n\t\t\t\tboundsMin.y = thePoint.y;\n\t\t\tend\n\n\t\t\tif ( thePoint.y > boundsMax.y)\n\t\t\t\tboundsMax.y = thePoint.y;\n\t\t\tend\n\t\t\n\t\tend\n\t\t\n\t\tboundsMin.x -= 1;\n\t\tboundsMax.x += 1;\n\n\t\tboundsMin.y -= 1;\n\t\tboundsMax.y += 1;\n\n\n\n\t\t# Print the map\n\t\tputs ANSI_CLEAR;\n\t\n\t\tboundsMax.y.downto(boundsMin.y) do |y|\n\t\t\tboundsMin.x.upto(boundsMax.x) do |x|\n\t\t\t\n\t\t\t\ttheTile = getTile(Point.new(x, y), TILE_UNKNOWN);\n\n\t\t\t\tcase theTile\n\t\t\t\twhen TILE_UNKNOWN\n\t\t\t\t\tprint '#';\n\n\t\t\t\twhen TILE_OXYGEN\n\t\t\t\t\tprint ANSI_GREEN + 'O' + ANSI_OFF;\n\t\t\t\t\n\t\t\t\twhen TILE_ROBOT\n\t\t\t\t\tprint ANSI_BLUE + 'D' + ANSI_OFF;\n\n\t\t\t\twhen TILE_WALL\n\t\t\t\t\tprint '+';\n\n\t\t\t\twhen TILE_EMPTY\n\t\t\t\t\tprint ' ';\n\t\t\t\t\n\t\t\t\twhen TILE_START\n\t\t\t\t\tprint ANSI_RED + 'S' + ANSI_OFF;\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tprint '?'\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tputs \"\";\n\t\tend\n\t\t\n\t\tputs \"\";\n\n\tend", "title": "" }, { "docid": "d738d8af6c4d31126a3317ddcb99fa52", "score": "0.57224965", "text": "def print_log\n s = Spoonerize::Log.new(spoonerism.logfile_name)\n s.each { |row| print row.join(\" | \") + \"\\n\" }\n end", "title": "" }, { "docid": "364cb85a7be9df9658839d23c032b7ca", "score": "0.57085836", "text": "def printable\n printstring = \"\"\n @entries.keys.sort.each do |keyword|\n printstring << \"[#{keyword}] \\\"#{@entries[keyword]}\\\"\\n\"\n end\n printstring.strip\n end", "title": "" }, { "docid": "cf77d682ed3ec854d773b68e9835ff3c", "score": "0.57076955", "text": "def report\n puts to_s\n puts Matrix.new(table.position, direction).to_s\n say_position\n end", "title": "" }, { "docid": "60d8ceaa2ce4b8ee21856801ecebaeff", "score": "0.570463", "text": "def tables_to_dump\n only_tables.map do |table|\n \"--table='#{table}'\"\n end.join(' ')\n end", "title": "" }, { "docid": "e4c86e5b594d6169c63b5e09d023750d", "score": "0.5692722", "text": "def print_annotated_matrix matrix, io=$stdout\n labels = self.stations.map {|s| s.label}\n\n # clear diagonal\n (0...(matrix.size)).each do |i| matrix[i][i] = \"\"; end\n\n io.puts <<OD\n\\t#{labels.join(\"\\t\")}\n#{labels.zip(matrix).map {|row| row.flatten.join(\"\\t\")}.join(\"\\n\")}\nOD\n end", "title": "" }, { "docid": "0802546d3791aadd08be4d1e88648d8b", "score": "0.56568974", "text": "def print_table(table)\n @shell.print_table(table)\n end", "title": "" }, { "docid": "235597988de0d1b2d555dde7d17d3ba1", "score": "0.5643743", "text": "def data_dictionary_tables(innodb_system)\n puts \"%-32s%-12s%-12s%-12s%-12s%-12s%-15s%-12s\" % %w[\n name\n id\n n_cols\n type\n mix_id\n mix_len\n cluster_name\n space\n ]\n\n innodb_system.data_dictionary.each_table do |record|\n puts \"%-32s%-12i%-12i%-12i%-12i%-12i%-15s%-12i\" % [\n record[\"NAME\"],\n record[\"ID\"],\n record[\"N_COLS\"],\n record[\"TYPE\"],\n record[\"MIX_ID\"],\n record[\"MIX_LEN\"],\n record[\"CLUSTER_NAME\"],\n record[\"SPACE\"],\n ]\n end\nend", "title": "" }, { "docid": "2273408f483122395e097031a320263b", "score": "0.56430763", "text": "def print\n report = self.report\n puts\n print_logo\n puts\n puts Rainbow(\"IPs\").cyan\n puts Rainbow(\"———\").cyan\n report[:ips].each { |ip| puts ip }\n puts\n puts Rainbow(\"Nodes\").cyan\n puts Rainbow(\"———\").cyan\n report[:nodes].each do |node|\n puts \"#{node[:id]}: #{node[:name]}\"\n end\n puts\n if report[:patches].count > 0\n puts Rainbow(\"Patches\").cyan\n puts Rainbow(\"———\").cyan\n report[:patches].each_with_index do |patch, i|\n puts \"#{i+1}. #{patch[:name]}\"\n puts Rainbow(\"|\").cyan\n puts Rainbow(\"| Node Map\").cyan\n puts Rainbow(\"| ———\").cyan\n patch[:maps].each { |map| puts Rainbow(\"| \").cyan + map }\n puts Rainbow(\"|\").cyan\n puts Rainbow(\"| Actions\").cyan\n puts Rainbow(\"| ———\").cyan\n chunked_actions(patch[:actions]).each do |chunk|\n puts Rainbow(\"| \").cyan + chunk\n end\n puts Rainbow(\"|\").cyan\n puts\n end\n else\n puts\n end\n unless report[:log].nil?\n puts \"Logging to #{report[:log]}\"\n puts\n end\n self\n end", "title": "" }, { "docid": "1975991f915282964801fd4b599e8058", "score": "0.5619542", "text": "def print_message_logs\n messages = build_message_logs\n\n messages.each do |msg_hash|\n puts \"=\" * 40\n pp msg_hash\n end\nend", "title": "" }, { "docid": "558863d734db38c642feb7692221c06e", "score": "0.5609907", "text": "def print\n puts @table\n end", "title": "" }, { "docid": "5c7057386d43f98bae80020a622b6ab2", "score": "0.5584053", "text": "def printTable(table)\n puts table\n puts \"\"\n end", "title": "" }, { "docid": "dc67a173ff78886ce18a567717114d8e", "score": "0.5577541", "text": "def log\n Tables.log[value]\n end", "title": "" }, { "docid": "c8e94aa58305836848724b61bfff0b58", "score": "0.5570573", "text": "def print_tables()\n if @class_directories != nil\n @class_directories.print_classes()\n end\n\n if @function_directories != nil\n @function_directories.print_functions()\n end\n\n @variable_directories.print_variables()\n end", "title": "" }, { "docid": "b489457a4656a70a97d30a3bde70084c", "score": "0.55645704", "text": "def write_map_header(n)\n end", "title": "" }, { "docid": "8ddbd35d077e78d2adffaa7b8ba7f34e", "score": "0.5564564", "text": "def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end", "title": "" }, { "docid": "24030acd6cd3a03c5576c92bc26d907a", "score": "0.5543766", "text": "def puts_formatted_dungeon_map\n \n # reset the player's old location to :room\n map.each { |subarray| subarray[subarray.index(0)] = :room if subarray.include?(0) }\n \n # set the player's current location to '0's\n map[player.coordinates.first][player.coordinates.last] = 0\n \n # (a) convert to string, (b) replace :wall with 'X' and :room with '_', (c) replace ']' with '\\n' (d) delete ',' and '[' \n formatted_map = map.inspect.gsub(/:wall/, \"X\").gsub(/:room|:end_of_game/, \"_\").gsub(/\\],|\\]\\]/, \"\\n\").delete(',').delete('[')\n\n # center the map on the screen\n formatted_map.each_line { |line| puts line.strip.align_center }\n\n end", "title": "" }, { "docid": "3c2468b65fdc3196b7a3069e93239ad1", "score": "0.5539056", "text": "def display_gym(gym_hash)\n puts \" ------------------ ------------------ \"\n gym_hash.each_value {|row| puts row.join}\n puts \" ---------------------------------------- \"\nend", "title": "" }, { "docid": "0b892fb385476b9844651c2a1a5f197f", "score": "0.5537692", "text": "def dump\n Hash[ tables.map { |version, table| [\"v#{version}\", table.dump] } ]\n end", "title": "" }, { "docid": "a618c31fee55c6cb69a9decdd87cd7ed", "score": "0.5530865", "text": "def show\n @database.each do |database,db_info|\n puts \"Database : #{database}\"\n\n db_info.each do |table, tbl_info|\n puts \" Table : #{table}\"\n puts \" Columns: #{tbl_info.keys.inspect}\"\n puts\n end\n end\n end", "title": "" }, { "docid": "3f587ee4cb9dde994893bc8fbfccc42f", "score": "0.55256826", "text": "def printTargets(targetTable)\n\n\ttargetTable.each_pair do |theBearing, theTargets|\n\t\n\t\tputs \"Bearing: #{theBearing}\";\n\t\tputs \"Targets:\"\n\t\t\n\t\ttheTargets.each do |theTarget|\n\t\t\tputs \" Range: #{theTarget[:range]}, Point: #{theTarget[:point]}\";\n\t\tend\n\t\tputs \"\";\n\n\tend\n\nend", "title": "" }, { "docid": "7204354b74cd7723cd33f817940f01d3", "score": "0.5524496", "text": "def print_log_details\n\tprint_status(\"Retriving Event Log Configuration\")\n\ttbl = Rex::Ui::Text::Table.new(\n\t\t'Header' => \"Event Logs on System\",\n\t\t'Indent' => 1,\n\t\t'Columns' => [\n\t\t\t\"Name\",\n\t\t\t\"Retention\",\n\t\t\t\"Maximum Size\",\n\t\t\t\"Records\"\n\t\t])\n\t\t\n\teventlog_details = get_log_details\n\n\teventlog_details.each do |log_detail|\n\t\ttbl << [log_detail[:name],log_detail[:retention],\"#{log_detail[:size]}K\",log_detail[:num_of_records]]\n\tend\n\t\n\tprint_line(\"\\n\" + tbl.to_s + \"\\n\")\nend", "title": "" }, { "docid": "99941ae40a2e32c8111a2e9ea7928698", "score": "0.5507122", "text": "def print_data_hash_to_file(outfile,data,seperator=\" \")\n\n label_str= data.keys.sort.join(seperator)\n outfile.print(label_str)\n\n\n\n outfile.print(\"\\n\")\n\n # my_keys=data.keys\n\n for i in 0...data[data.keys.sort.first].size\n data.keys.sort.each do |key|\n outfile.print(data[key][i])\n\n if (key != data.keys.sort.last)\n outfile.print(seperator)\n end\n end\n\n outfile.print(\"\\n\")\n end\n\nend", "title": "" }, { "docid": "cbce6e9f31cc88d366cf09cf437dea13", "score": "0.550602", "text": "def print_log\n\n # First see if we have the HashPrint class already defined\n begin\n self.class.const_get :HashPrint # This throws an error so we need to use begin/rescue to catch\n rescue\n # Define out HashPrint class for this object\n define_hash_print_class\n end\n # Create an array to store our HashPrint objects\n attr_array = []\n # Take each element in our attributes_hash and store as a HashPrint object in our array\n @last_time = nil\n @model.log.each do\n |log_entry|\n @first_time ||= Time.at(log_entry[\"timestamp\"])\n @last_time ||= Time.at(log_entry[\"timestamp\"])\n @total_time_diff = (Time.at(log_entry[\"timestamp\"].to_i) - @first_time)\n @last_time_diff = (Time.at(log_entry[\"timestamp\"].to_i) - @last_time)\n attr_array << self.class.const_get(:HashPrint).new(%w(State Action Result Time Last Total Node),\n [state_print(log_entry[\"old_state\"].to_s,log_entry[\"state\"].to_s),\n log_entry[\"action\"].to_s,\n log_entry[\"result\"].to_s,\n Time.at(log_entry[\"timestamp\"].to_i).strftime(\"%H:%M:%S\"),\n pretty_time(@last_time_diff.to_i),\n pretty_time(@total_time_diff.to_i), node_uuid.to_s], line_color, header_color)\n @last_time = Time.at(log_entry[\"timestamp\"])\n end\n # Return our array of HashPrint\n attr_array\n end", "title": "" }, { "docid": "f3d2b37dc3fa22fdab410a072dbe3e2f", "score": "0.55028987", "text": "def print_frame_mapping(mapping)\n\n if mapping.size > 0\n\n mapping.each do | iface, frame_list |\n puts \" * #{iface}:\"\n frame_list.each do |frame|\n puts \" - \" + Racket::L2::Ethernet.new(frame).pretty()\n end\n end\n\n else\n puts \" * None\"\n end\n\nend", "title": "" }, { "docid": "33f9a501c9d36ac31116cd3130a2fec6", "score": "0.55008996", "text": "def printmap(data, animate: false)\n h = data.length\n w = data.first.length\n clear_screen!(h + 2)\n puts \"--------------------\"\n (0...h).each do |row|\n (0...w).each do |col|\n print \" \" if data[row][col] == 0 # Empty space\n print \"O \" if data[row][col] == 1 # Obstacle\n print \"* \" if data[row][col] == 2 # El roboto\n print \"X \" if data[row][col] == 3 # Goal\n print \". \" if data[row][col] == 4 # Trail\n print \"~ \" if data[row][col] == 5 # Quick sand\n print \"@ \" if data[row][col] == 6 # Stepped in quicksand\n end\n print \"\\n\"\n end\n puts \"--------------------\"\n sleep 0.05 if animate\nend", "title": "" }, { "docid": "d54393c76bb25e1b150338919186eca1", "score": "0.5499569", "text": "def print_maze\n print \"columns \", @cols, \" rows \", @rows, \"\\n\"\n print \"start \", @start, \" goal \", @goal, \"\\n\"\n puts @mazeMap\n end", "title": "" }, { "docid": "6c677023af210962eb9c1acc694c77da", "score": "0.54941595", "text": "def output_results_table(results={})\n puts\n puts \"----------------------------------------\"\n puts \"| Type | Mean | Median |\"\n puts \"----------------------------------------\"\n results.each do |label, hash|\n print \"| \" + label.ljust(10) + \" | \"\n print sprintf(\"%.6f\", hash[:mean]).rjust(10) + \" | \"\n puts sprintf(\"%.6f\", hash[:median]).rjust(10) + \" |\"\n end\n puts \"----------------------------------------\"\n puts\nend", "title": "" }, { "docid": "7096651612c6f52577b3119eff9186f3", "score": "0.5487583", "text": "def print(*cols)\n Sequel::PrettyTable.print(naked.all, cols.empty? ? columns : cols)\n end", "title": "" }, { "docid": "05f4f871267cc9070d7acaf82f42be69", "score": "0.54807216", "text": "def print_tree(out = $stdout)\n out.puts \"### Table: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Required: #{table_fragment['Required']}\"\n end", "title": "" }, { "docid": "ae591f08105ecb2ebd2de7c8261c4bcc", "score": "0.54792", "text": "def map\n @map.join\n end", "title": "" }, { "docid": "85ef4f155746bc92f11ef94dc09c5272", "score": "0.5477788", "text": "def print_object(hash)\n raise \"You must extend OutputterBase and implement print_object(hash)\"\n # prints the object, respecting @hide_columns and @display_columns\n # if @display_columns is nil, display all\n # if @hide_columns is not empty, reject any keys in it.\n end", "title": "" }, { "docid": "1f8e2cab7a7df44d940c3f25d829e0df", "score": "0.54768014", "text": "def print\n\t @results.keys.each do |k|\n\t puts \"#{k}: #{@results[k]}\"\n\t end\n\t end", "title": "" }, { "docid": "6afa2e762ffc5b1b3b8ab6f3b09b1c53", "score": "0.5476686", "text": "def individual_dump_table(table, stream)\n individual_header(table, stream)\n individual_table(table, stream)\n individual_footer_table(table, stream)\n puts \"Creating migration file for #{table.singularize.camelcase} model\"\n end", "title": "" }, { "docid": "234de4a1ce5a06f43d19fb97f86e4cc0", "score": "0.5470286", "text": "def log_to_console\n details_attrs = details.first(3) # remove additional details\n location_attrs = []\n if location[:line]\n location_attrs << \"line #{ location[:line] }\"\n end\n if location[:context]\n location_attrs << location[:context].inspect\n end\n [\n ' ',\n location_attrs.join(': ').ljust(50),\n details_attrs.join(': ')\n ].join\n end", "title": "" }, { "docid": "800416b2a42baee48e6314cbd2a417cb", "score": "0.5465342", "text": "def putMap\n\t\n\t\t# Find the bounds\n\t\tboundsMin = Point.new;\n\t\tboundsMax = Point.new;\n\t\t\t\t\n\t\[email protected]_key do |thePoint|\n\t\t\n\t\t\tif ( thePoint.x < boundsMin.x)\n\t\t\t\tboundsMin.x = thePoint.x;\n\t\t\tend\n\n\t\t\tif ( thePoint.x > boundsMax.x)\n\t\t\t\tboundsMax.x = thePoint.x;\n\t\t\tend\n\n\t\t\tif ( thePoint.y < boundsMin.y)\n\t\t\t\tboundsMin.y = thePoint.y;\n\t\t\tend\n\n\t\t\tif ( thePoint.y > boundsMax.y)\n\t\t\t\tboundsMax.y = thePoint.y;\n\t\t\tend\n\t\t\n\t\tend\n\t\t\n\t\tboundsMin.x -= 1;\n\t\tboundsMax.x += 1;\n\n\t\tboundsMin.y -= 1;\n\t\tboundsMax.y += 1;\n\n\n\n\t\t# Print the map\n\t\tputs \"\";\n\t\tputs \"Frame #{@frame}:\";\n\t\n\t\tboundsMax.y.downto(boundsMin.y) do |y|\n\t\t\tboundsMin.x.upto(boundsMax.x) do |x|\n\n\t\t\t\ttheTile = getMap(Point.new(x, y), TILE_OUTSIDE);\n\t\t\t\tprintTile(theTile);\n\n\t\t\tend\n\t\t\tputs \"\";\n\t\tend\n\t\t\n\t\tputs \"\";\n\n\tend", "title": "" }, { "docid": "d7d7dbbc7e175df1b1149591ad4281b9", "score": "0.546047", "text": "def print_tree(out = $stdout)\n out.puts \" LookupTable: #{name}\"\n out.puts \" Resource: #{resource.id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ table_fragment[\"LongName\"] }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \" Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end", "title": "" }, { "docid": "ab9b0d5deceeb6a808b0c6b3c7c7d731", "score": "0.5452298", "text": "def print_table()\n desc = []\n @table_throws.each do |thisthrow|\n thisthrow.items.each do |item|\n desc.push(item.to_string)\n end\n end\n desc\n end", "title": "" }, { "docid": "f1ee03ea674ff2547cadd133fa0772e9", "score": "0.5450993", "text": "def s\n ensure_map!\n @map.show\n end", "title": "" }, { "docid": "7d00b25b440378f22cb8b26c5d59a8f5", "score": "0.5445902", "text": "def inspect\n grid = [\n [\" \", @map.dup],\n [\"avg\", @avg.map{|num| num_to_str(num)} ],\n [\"min\", @min.map{|num| num_to_str(num)} ],\n [\"max\", @max.map{|num| num_to_str(num)} ],\n [\"tot\", @tot.map{|num| num_to_str(num)} ]\n ]\n\n longest = 9\n grid.flatten.each{|item| longest = item.length if longest < item.length }\n\n out = \"\"\n\n grid.each do |(name, ary)|\n out << \"#{name} #{ary.map{|item| item.ljust(longest, \" \")}.join(\" \")}\\n\"\n end\n\n out\n end", "title": "" }, { "docid": "3b66fee7389f350faf1501fef8e453b7", "score": "0.54421556", "text": "def print_info\n @items.each_with_index do |item, index|\n if !item.nil?\n puts \"Hash Index: \" + index.to_s\n puts \"Key: \" + item.key + \", \" + \"Value: \" + item.value\n end\n end\n puts \"Total_Nodes: \" + @total_nodes.to_s\n puts \"Load_Factor: \" + self.load_factor.to_s\n end", "title": "" }, { "docid": "e5c700e2aa778bf5d607184404f8fa7b", "score": "0.54399115", "text": "def print\n @@coffee_table.each do |key, value|\n value.print\n end\n end", "title": "" }, { "docid": "dba34d9cd62e59497d5c726b58a770d0", "score": "0.5438756", "text": "def to_s()\n\t\tres = \"Printing Map -#{self.object_id}-\\n\\t\"\n\t\tres += \" - Name : #{@name}\\n\\t\"\n\t\tres += \" - Difficulty : #{@difficulty}\\n\\t\"\n\t\tres += \" - Time to do : #{@timeToDo}\\n\\t\"\n\t\tres += \" - Hypotheses : \\n#{@hypotheses}\\n\\t\"\n\t\tres += \" - Solution : \\n#{@solution}\\n\\t\"\n\t\tres += \" - Columns solution: #{@clmSolution}\\n\\t\"\n\t\tres += \" - Lines solution : #{@lneSolution}\\n\"\n\t\tres += \" - Given Help : #{@givenHelp}\\n\"\n\t\tres += \" - Current Stat : #{@currentStat}\\n\"\n\t\tres += \" - All Stats : #{@allStat}\\n\"\n\t\treturn res\n\tend", "title": "" }, { "docid": "cdb3439ff3db368209845ad7a5950b32", "score": "0.54344964", "text": "def report\n check_placement && \"#{table.to_s(placement)}#{placement}\"\n end", "title": "" }, { "docid": "9338dee1c5d04282875c71eb678a8be3", "score": "0.54341215", "text": "def print_lines()\n\n array = @hash.keys \n puts array\n end", "title": "" }, { "docid": "13f2702e14211a5198c2d4b638daa3ff", "score": "0.5432723", "text": "def _list\n @listMap.each {|key, value| printPair(\"#{key}\", value)}\n end", "title": "" }, { "docid": "b14edfd005df74ae128d5775d9bc1c27", "score": "0.54303336", "text": "def printable\n\n\t\[email protected] { | k, v | \"[#{ k }] \\\"#{ v }\\\"\"}.join(\"\\n\")\n\n\n\tend", "title": "" }, { "docid": "2a43301b0b58d8bfd8207228c51ec0df", "score": "0.54277533", "text": "def print_minimap\n print \"\\n\"\n for y in (@location.coords.first-VIEW_DISTANCE)..(@location.coords.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y.negative?\n # centers minimap\n 10.times { print \" \" }\n for x in (@location.coords.second-VIEW_DISTANCE)..(@location.coords.second+VIEW_DISTANCE)\n # Prevents operations on nonexistent tiles.\n print_tile(C[y, x]) if (@location.map.in_bounds(y, x))\n end\n # new line if this row is not out of bounds\n print \"\\n\" if y < @location.map.tiles.size\n end\n print \"\\n\"\n end", "title": "" }, { "docid": "9084549f942edc6022dcad57c33c50dd", "score": "0.54241955", "text": "def emit record\n puts record.to_flat.join(\"\\t\")\n end", "title": "" }, { "docid": "d02007f90af0c126f21b3e1d390f2794", "score": "0.542046", "text": "def displays (hash)\n hash.map do |key , value|\n puts \"#{key}:#{value} students\"\n end\nend", "title": "" }, { "docid": "3e19ae4dc58a8ccb995638fdeaae9840", "score": "0.5417548", "text": "def display_board\n puts @keys.join(\" \")\n\n @board.transpose.map do |line|\n puts line.join(\" \")\n end\n end", "title": "" }, { "docid": "8e370804e1561e081179451e3e6ef620", "score": "0.54166645", "text": "def airbrake_format_table(data)\n lines = []\n\n data.each do |key, value|\n next if value.blank?\n\n if value.is_a?(String)\n lines << \"|@#{key}@|@#{value}@|\"\n elsif value.is_a?(Hash)\n lines << \"|@#{key}@|@#{value.map { |k, v| \"#{k}: #{v}\" }.join(', ')}@|\"\n end\n end\n\n lines.join(\"\\n\")\n end", "title": "" }, { "docid": "0dc9a0bdada27fdadccb48df43a3666b", "score": "0.54016393", "text": "def output_table(cmd, args, data)\n case data\n when Gitlab::ObjectifiedHash, Gitlab::FileResponse\n puts record_table([data], cmd, args)\n when Gitlab::PaginatedResponse\n puts record_table(data, cmd, args)\n else # probably just an error message\n puts data\n end\n end", "title": "" }, { "docid": "7d3f3b394b51071f2d6fc82d4fb18db1", "score": "0.53986037", "text": "def format_as_table(input)\n input.each do |row|\n hash = row\n array = hash.values\n puts array.join(' - ')\n end\nend", "title": "" }, { "docid": "3fd53702ed367519c87e5b1e4487da01", "score": "0.5393616", "text": "def setup\r\r\n @map_table = Table.new(200,200,3)\r\r\n @flag = {}\r\r\n end", "title": "" } ]
f9d36c29ca02572d0bf2e76f92e4f312
get complaint by complaint id
[ { "docid": "888b0c077f42394dce95608f30948321", "score": "0.6531626", "text": "def show_complaint_by_id\n complaint = Complaint.find(params[:id])\n if complaint\n complaint_status = ComplaintStatus.where(complaint_id: complaint.id).first\n if complaint_status\n complaint.status = complaint_status.status\n else\n complaint.status = \"New\"\n end\n render json: complaint, methods: [:status]\n else\n render json: {status: \"error\", error_message: \"complaint not found\"}\n end\n end", "title": "" } ]
[ { "docid": "4ce2a51611339aa807b3019c8f6455f3", "score": "0.72552073", "text": "def find_complaint\n\t\t@complaint = @company.complaints.find(params[:id])\n\tend", "title": "" }, { "docid": "5bd1f19e8477f9d8df4ef26618cc9e69", "score": "0.6756625", "text": "def complaints(id, params={})\n params[:groupby] = params.delete(:group_by) if params[:group_by]\n get(\"#{domain}/campaigns/#{id}/complaints\", params)\n end", "title": "" }, { "docid": "d5c488c298e20e233d11bff00964b434", "score": "0.66692203", "text": "def getCrateWithID(id)\n info \"Getting crate with ID: #{id}.\"\n @files = listFiles if @files.nil? # do not query the server each time a search is made.\n allCrates = @files['crates']\n for crate in allCrates\n if crate['id'] == id.to_i\n return crate\n end\n end\n end", "title": "" }, { "docid": "e31223e32b7b63da116f8c26504df783", "score": "0.6549564", "text": "def find_by_id(id)\n self.class.find_by_key_and_id(@jira_key, id)\n end", "title": "" }, { "docid": "d7a91b8d55046ea22b1f46d64903f965", "score": "0.63545525", "text": "def get_contact_by_id(id)\n require_relative 'contact'\n Contact.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/contacts/#{id}\"))\n end", "title": "" }, { "docid": "d7a91b8d55046ea22b1f46d64903f965", "score": "0.63545525", "text": "def get_contact_by_id(id)\n require_relative 'contact'\n Contact.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/contacts/#{id}\"))\n end", "title": "" }, { "docid": "d7a91b8d55046ea22b1f46d64903f965", "score": "0.6353904", "text": "def get_contact_by_id(id)\n require_relative 'contact'\n Contact.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/contacts/#{id}\"))\n end", "title": "" }, { "docid": "3cd2e8d899b388fef22adcf34cfe0dcb", "score": "0.6348376", "text": "def get_campaign_by_id(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "29088463c5ae349b9a3fb78945881d46", "score": "0.6215387", "text": "def get_company_from_id\n Company.find(params[:id]) if params[:id].present?\n end", "title": "" }, { "docid": "6775a9c7d3fdfa91fe20eefe9c2389f8", "score": "0.6211064", "text": "def by_id(id)\n id = id.to_i\n select {|p| p.id == id}.first\n end", "title": "" }, { "docid": "c99b6756897485b404b09ebc767d29b3", "score": "0.61920565", "text": "def scaffold_get_object(id)\n find(id.to_i)\n end", "title": "" }, { "docid": "fb99da71adcae9ccac2f06715fca3ed3", "score": "0.61556983", "text": "def get_by_id(id)\n fetch(@database, id)\n end", "title": "" }, { "docid": "2d6154223afc966740a157a6bc18fc18", "score": "0.6138631", "text": "def find_course(_id)\n if _id.blank?\n render json: {error: 'Course _id cannot be nil'}, status: :unprocessable_entity\n return nil\n end\n course = Course.where(_id: _id).first\n if course.nil?\n render json: {error: \"No course matching id #{_id} was found\"}, status: :unprocessable_entity\n return nil\n end\n return course\n end", "title": "" }, { "docid": "3421a41dcd6c57b8f58a2d48e5781454", "score": "0.6129436", "text": "def find_book_by_id(id, book_collection)\n result = book_collection.select { |b| b.get_id == id }\n result[0]\n end", "title": "" }, { "docid": "a4057eca0ea38a8d83ce81bf8a1b109d", "score": "0.61025906", "text": "def find(id)\n where(id: id).first\n end", "title": "" }, { "docid": "7ab124b994395852f923a5e77a095804", "score": "0.6101177", "text": "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "title": "" }, { "docid": "ce3d9f7b20abd5e7f0357c8c0539f936", "score": "0.6081928", "text": "def find_by_id(id)\n find_by(id: id)\n end", "title": "" }, { "docid": "8eeb654c5d5a8b5e926b22a989fe6fdf", "score": "0.607763", "text": "def find_by_id(project_id, ticket_id)\n find_by_attributes(project_id, :id => ticket_id).first\n end", "title": "" }, { "docid": "17a059c7c9cb12551bd998712c0b1cec", "score": "0.6068158", "text": "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/portfolios/#{id}\", options: options)).first, client: client)\n end", "title": "" }, { "docid": "7ea00c108aee964443c720a32cc95601", "score": "0.6063936", "text": "def find_by_number(id)\n id = @unilib.course_normalize(id)\n course = course_from_cache(id)\n\n if not course\n course = @unilib.find_by_number(id, @user.semester.year, @user.semester.semester, @user.semester.university.id)\n return nil if not course\n save_course_to_cache course\n course = course_from_cache(course['number'])\n end\n\n # Add events to course\n course['events'] = load_events(course['id'])\n # Add reception hours of staff\n course['reception_hours'] = load_recepetion_hours(course)\n course\n end", "title": "" }, { "docid": "ef89e550d19a6bfd27596e3263b257ec", "score": "0.6054839", "text": "def find_by_id(id)\n @client.get(\"/#{@model}/#{id}\")\n end", "title": "" }, { "docid": "6ebdf5ed4f129c7aa7e4a614b2077cc0", "score": "0.6046014", "text": "def set_complaint_detail\n @complaint_detail = ComplaintDetail.find(params[:id])\n end", "title": "" }, { "docid": "c13511770e3d16ffcbcc59c4c5dac2ce", "score": "0.6041771", "text": "def fetch(id)\n fetch_all(id).first\n end", "title": "" }, { "docid": "319e82ae88744cc969da123f37da8ce5", "score": "0.602313", "text": "def get_by_id(organization, number, id)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('number', number, String)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/#{CGI.escape(organization)}/customers/#{CGI.escape(number)}/addresses/book/contacts/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::CustomerAddressBookContact.new(r)\n end", "title": "" }, { "docid": "2d7b187de271b28be8aa2e9b491ee79d", "score": "0.60202926", "text": "def find_by_id(id)\n begin\n term = @cyc.find_cycl_object_by_compact_hl_external_id_string(id)\n if term and term!='<The'\n @factory.new(term,id)\n end\n rescue CycError\n nil\n end\n end", "title": "" }, { "docid": "70c37fa609def8fcf3a0dcc2a9377873", "score": "0.60102224", "text": "def find(id)\n contact_individual = Virtuous::ContactIndividual.new JSON.parse(connection.get(\"/ContactIndividual/#{id}\").body)\n end", "title": "" }, { "docid": "cfdc7b43be4b59319f31bc02e3b366e8", "score": "0.6008047", "text": "def find_by_id(id)\n @by_id[id]\n end", "title": "" }, { "docid": "2d6f8a7cbaa264fa421d3a8387ded28b", "score": "0.6001687", "text": "def get_by_id(id)\n\t\tself.find(id)\n\tend", "title": "" }, { "docid": "8ba6b0c4801592f75910cbc2294998d2", "score": "0.5989587", "text": "def get(id)\n results = search(id, :semantic_search_field => :oclcnum)\n\n raise (results.error[:exception] || Exception.new(results.error)) if results.failed?\n raise BentoSearch::NotFound.new(\"ID: #{id}\") if results.total_items == 0\n raise BentoSearch::TooManyFound.new(\"ID: #{ID}\") if results.total_items > 1\n \n return results.first \n end", "title": "" }, { "docid": "837b8f8e419020029f11562bd5092feb", "score": "0.5986764", "text": "def find_by_id(id)\n find(id) rescue nil\n end", "title": "" }, { "docid": "51a9c085ba507e2962f800f14a8a3184", "score": "0.598273", "text": "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n res = connection.exec_params('SELECT * FROM contacts WHERE id = $1::int;',[id])\n unless res.num_tuples.zero? \n person = Contact.new(res[0]['name'],res[0]['email'],res[0]['id'])\n person \n end\n end", "title": "" }, { "docid": "7cc455842b8bdcd8635cd5b4de50b479", "score": "0.59793174", "text": "def show\n @breadcrumb = 'read'\n @complaint_class = ComplaintClass.find(params[:id])\n @complaints = @complaint_class.complaints.by_no\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint_class }\n end\n end", "title": "" }, { "docid": "d2cbf5856e0fe62ea48bd88ae8ec69dc", "score": "0.5977856", "text": "def find(id)\n\t\[email protected] { |contact| contact.id == id }\n\tend", "title": "" }, { "docid": "4079fe0adf60aa9d59d9e99cb04f2b39", "score": "0.59655637", "text": "def retrieve_from_bibdata(id)\n conn = Faraday.new(url: \"https://bibdata.princeton.edu/bibliographic/\")\n response = conn.get(id)\n response.body\n end", "title": "" }, { "docid": "3c5cb918dc4c319dd498624604971f7e", "score": "0.5961258", "text": "def find(id)\n find!(id) rescue nil\n end", "title": "" }, { "docid": "705f84c280098d9711b1d2250accc5ae", "score": "0.5948089", "text": "def get(id)\n klass.find(klass.primary_key => wrap_key(id))\n end", "title": "" }, { "docid": "d9ad9883e7097329ecdce00899340aba", "score": "0.5942485", "text": "def find(id)\n raise ArgumentError, \"You must enter a valid ID.\" if id.nil?\n contact = Contact.all.find { |contact| contact.id == id }\n raise ContactNotFoundError, \"No contact with ID #{id} found.\" if contact.nil?\n contact\n end", "title": "" }, { "docid": "7d8975f1896760dd2b18e1c0681abe86", "score": "0.59301126", "text": "def get_comment(id)\n object_from_response(:get, \"comments/#{id}\", \"comment\")\n end", "title": "" }, { "docid": "362dad29e24fddde02abc845e1f86569", "score": "0.5929347", "text": "def show\n @breadcrumb = 'read'\n @complaint_status = ComplaintStatus.find(params[:id])\n @complaints = @complaint_status.complaints.by_no\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint_status }\n end\n end", "title": "" }, { "docid": "3c261da185408d948f015f0326c19050", "score": "0.5922587", "text": "def edit\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "9e2797591a2230f01d0e3eb51d90f460", "score": "0.59219086", "text": "def find_book_by_id(id)\n @books.each do |book|\n if id == book.id\n return book\n end \n end\n return nil\n end", "title": "" }, { "docid": "6a8d764fe4469d86a8500c4508cbe61b", "score": "0.5919126", "text": "def find(id)\n id = id.to_i\n if id == 0 || id > Contact.all.length\n raise \"Invalid ID\"\n end\n id -= 1\n all[id]\n end", "title": "" }, { "docid": "0c7abaaacd7126b84e503ce16507c3d8", "score": "0.5918563", "text": "def find_by_id(id)\n find(:first, :conditions => {_(:id) => id})\n end", "title": "" }, { "docid": "6b8e8917f66cfb4a8803b53e36ebb5c8", "score": "0.5914727", "text": "def find_one(id)\n client.get(\"#{path}/#{id}\")\n end", "title": "" }, { "docid": "df5cfcf0afe169da7622c00c228d09b2", "score": "0.5912793", "text": "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n csvarray = CSV.read(FILEPATH, 'r', converters: :numeric)\n csvarray[id - 1] ? csvarray[id - 1] : nil \n end", "title": "" }, { "docid": "b5a5c696826aaa89cacfb362ae2aa5c1", "score": "0.5906586", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "b5a5c696826aaa89cacfb362ae2aa5c1", "score": "0.5906586", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "47e2e13e0bc023f7b7f2ad05a33e0bb8", "score": "0.5906453", "text": "def get!(id)\n klass.find(klass.primary_key => wrap_key(id)) || raise(ArgumentError, \"#{klass.name} not found with #{klass.primary_key} of #{wrap_key(id)}\")\n end", "title": "" }, { "docid": "87e9ed4d6f9609bfffbe14a8bdcb595e", "score": "0.5904533", "text": "def find_by_id(id)\n all_budgets = find_all\n budget = all_budgets.select {|r| r.id == id}.first\n end", "title": "" }, { "docid": "e3e06931c0b90f3d17280872b7d3ddba", "score": "0.5902417", "text": "def account_by_id(id)\n\t ac = @accounts.select { |a| a.id == id }\n\t raise \"No such account\" unless ac.count == 1\n\t return ac[0]\n end", "title": "" }, { "docid": "d7a9c1e0dc5f47ad9d4ab5c0b290d9f7", "score": "0.5895147", "text": "def set_complaint\n @complaint = Complaint.includes(:user, :reviews).find(params[:id])\n end", "title": "" }, { "docid": "d0a4514eab625dd0084e53860b6b98ee", "score": "0.58929867", "text": "def ticket(id)\n ticket_purchases.where(ticket_id: id).first\n end", "title": "" }, { "docid": "4abd66de4c0ca7de9080d9743e518e6c", "score": "0.5885411", "text": "def get(id)\n id = id.to_i\n raise \"Expected Fixnum, got #{id.class} for #{self.to_s}.get\" \\\n unless id.class == Fixnum\n @@store.resources[self.to_s.make_key].each do |o|\n return o[1] if o[0] == id\n end\n nil\n end", "title": "" }, { "docid": "f17539eecabb0acfb237a9ec8f8a59b2", "score": "0.5883623", "text": "def get_contestcorrection\n @contestcorrection = Contestcorrection.find_by_id(params[:id])\n return if check_nil_object(@contestcorrection)\n @contestsolution = @contestcorrection.contestsolution\n @contestproblem = @contestsolution.contestproblem\n @contest = @contestproblem.contest\n end", "title": "" }, { "docid": "37149c199542c024abdf81e6f813e992", "score": "0.58795345", "text": "def find(id)\n self.new(Cubscout.connection.get(\"#{path}/#{id}\").body)\n end", "title": "" }, { "docid": "8d1872a9cf35216609528045b9fd2749", "score": "0.58708835", "text": "def find(id)\n result = [conn.send(collection_name).find {|item| item.id == id}].flatten.first\n result ? new(result) : nil\n end", "title": "" }, { "docid": "e46b94746d15a614d453b8cb077469b7", "score": "0.5870442", "text": "def with_id(prd_id)\n @recs.find {|p| p.prd_id == prd_id}\n end", "title": "" }, { "docid": "e7b268badbcfdbede82a95d246143fbe", "score": "0.58675104", "text": "def fetch_contact\n @contact = Contact.find_by_id(params[:id])\n end", "title": "" }, { "docid": "0be5d42e5cad8b7fa011bf482b95881e", "score": "0.5866718", "text": "def by_id(id)\n where(id: id)\n end", "title": "" }, { "docid": "0a962855bed5f7bb236cc63096884c0c", "score": "0.5866235", "text": "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "title": "" }, { "docid": "0a962855bed5f7bb236cc63096884c0c", "score": "0.5866235", "text": "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "title": "" }, { "docid": "0a962855bed5f7bb236cc63096884c0c", "score": "0.5866235", "text": "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "title": "" }, { "docid": "0a962855bed5f7bb236cc63096884c0c", "score": "0.5866235", "text": "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "title": "" }, { "docid": "9f8808bd942c7b7add7019f8482658d5", "score": "0.5863152", "text": "def find(id)\n get(\"#{domain}/campaigns/#{id}\")\n end", "title": "" }, { "docid": "0a700921c043897b468eef8852cbf0d2", "score": "0.58629405", "text": "def find(id)\n find_by_id(id)\n end", "title": "" }, { "docid": "9987a40d9f3fd3b228e893344b97a1b4", "score": "0.5855841", "text": "def set_complaint\r\n @complaint = Complaint.find(params[:id])\r\n end", "title": "" }, { "docid": "2bc12a17cb67ff61cee2fa6d81bf85d3", "score": "0.5855425", "text": "def show\n @issue = Proposal.where(id: params[:id]).first\n end", "title": "" }, { "docid": "bc02607331b3f605b1bdca0e3d645473", "score": "0.5854066", "text": "def getById(id)\n self.instance.getById(id) ;\n end", "title": "" }, { "docid": "a6c90ce69ad59da452a8cdbe81ec21a6", "score": "0.5841872", "text": "def get(id) # rubocop:disable Rails/Delegate\n query.get(id)\n end", "title": "" }, { "docid": "9622be372a54b52c72d13707034c209d", "score": "0.5837506", "text": "def find_referenced_issue_by_id(id)\n return nil if id.blank?\n\n # TODO - Add a Setting `Setting.risk_cross_project_ref?` and verifiy if the issue can be linked\n Issue.find_by_id(id.to_i)\n end", "title": "" }, { "docid": "ae04bfa9783ce33f8dc6415c224af19c", "score": "0.58369184", "text": "def show\n @complaint = @ward.complaints.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint }\n end\n end", "title": "" }, { "docid": "d52712024c779610225d080fa952d432", "score": "0.5835495", "text": "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n CSV.foreach(CONTACTS_DATABASE) do |row|\n p row if row[0] == id\n end\n end", "title": "" }, { "docid": "a8439009cfd725fb5bbb8b7a8ed3c514", "score": "0.583429", "text": "def get(id)\n klass.first :conditions => { klass.primary_key => wrap_key(id) }\n end", "title": "" }, { "docid": "b3295b834be7f7ecbe7cdc2c1792a486", "score": "0.5829676", "text": "def get(id)\n repository.get(build_path(id))\n end", "title": "" }, { "docid": "abb36f0f0a56fc9b5d90de311bd8e7b4", "score": "0.5828783", "text": "def getObject(id) ;\n @objectTable.get(:id, id) ;\n end", "title": "" }, { "docid": "8130634d8d373b8721e7b6a961646994", "score": "0.5819224", "text": "def find_by_id(id)\n find_customer_by_invoice_id(id)\n end", "title": "" }, { "docid": "7601899032d0597384b411a3b99c807e", "score": "0.581236", "text": "def get_by_id(id)\n api_project = client.get_project(id)\n\n from_api_project(api_project)\n end", "title": "" }, { "docid": "bfe16d04868709260792fa49d4e68d78", "score": "0.58068955", "text": "def query_by_id(id:)\n response = blacklight_connection.get(\"select\", params: { q: \"id:\\\"#{id}\\\"\", fl: \"*\", rows: 1 })\n docs = response[\"response\"][\"docs\"]\n docs.first\n end", "title": "" }, { "docid": "bfe16d04868709260792fa49d4e68d78", "score": "0.58068955", "text": "def query_by_id(id:)\n response = blacklight_connection.get(\"select\", params: { q: \"id:\\\"#{id}\\\"\", fl: \"*\", rows: 1 })\n docs = response[\"response\"][\"docs\"]\n docs.first\n end", "title": "" }, { "docid": "fd0dc6ad77ecb50fbbaf69294800e58d", "score": "0.5806127", "text": "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n excel = CSV.read('contacts.csv')\n excel.each {|person|\n return person if (excel.index(person)+1) == id\n }\n end", "title": "" }, { "docid": "27441564d6638995337bc9b683ce5052", "score": "0.5795343", "text": "def get_contr_from_id(object)\n return Contributor.where(:id_contr_rec => object.contr_rec_id).take\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "65b3baab37852804a1bf3f4a8ae0440e", "score": "0.5791855", "text": "def set_complaint\n @complaint = Complaint.find(params[:id])\n end", "title": "" }, { "docid": "63268346b4afe49786a9e279ae391696", "score": "0.57863724", "text": "def find_by_id(id)\n find_by(:id, id)\n end", "title": "" }, { "docid": "63268346b4afe49786a9e279ae391696", "score": "0.57863724", "text": "def find_by_id(id)\n find_by(:id, id)\n end", "title": "" } ]
754e24f6446686053eae33516cd099b0
Calculer le montant pour le recu d'impot
[ { "docid": "1291cf50b816b79ad3910cdc47537db4", "score": "0.66348004", "text": "def montantRecu(famille, membre, annee)\n return 0 unless membre.eligibleRecu(annee)\n ctes = Constantes.instance\n montant = 0.0\n\n # Si le membre a des activites, ajouter sa part de la cotisation de base\n if montant > 0 || !membre.activites.empty?\n if famille.cotisation.familiale\n montant += (ctes.baseFamille + famille.cotisation.ajustements).quo(famille.membres.size).round(2)\n else\n montant += ctes.baseIndividu + famille.cotisation.ajustements \n end\n end\n\n # Si un montant pour activites payantes, ajouter sa part\n if membre.aDesActivites?\n if famille.cotisation.familiale\n cnt = 0\n famille.membres.each { | m | cnt += 1 if m.aDesActivites? }\n montant += ctes.activiteFamille.div(cnt, 2)\n else\n montant += ctes.activiteIndividu\n end\n end\n\n # Ajoute le prorata des course de natation\n if membre.activites.find_by_code(Activite::CodeCoursDeNatation)\n total = montantDesCoursDeNatation(famille).total()\n cnt = famille.membres.sum {|m| m.activites.where(code: Activite::CodeCoursDeNatation).count}\n montant += total.quo(cnt).round(2)\n end\n\n # Ajoute le prorata pour les cours de bronze\n mem_cnt = membre.activites.where(code: [Activite::CodeCroixDeBronze, Activite::CodeMedailleDeBronze]).count()\n if !mem_cnt.nil? && mem_cnt > 0\n total = montantDesBronze(famille).total()\n cnt = famille.membres.sum{|m| m.activites.where(code: [Activite::CodeCroixDeBronze, Activite::CodeMedailleDeBronze]).count}\n montant += (mem_cnt * total).quo(cnt).round(2)\n end\n\n montant\n end", "title": "" } ]
[ { "docid": "ae7bacbe3572ff1b5c8822e13a41803a", "score": "0.7058372", "text": "def imc\n (@peso / (@talla * @talla)).round(1)\n end", "title": "" }, { "docid": "41ea24c209b78c534f6af6bb2a144da5", "score": "0.69895023", "text": "def impacto_mujer\n\t\timp=valor_energetico/2400*100\n\t\timp.round(1)\n\tend", "title": "" }, { "docid": "cfae9a1957fde20877bc1d6025fc9b02", "score": "0.6853755", "text": "def IMC()\n\t\treturn @masa / (@altura * @altura) \n\tend", "title": "" }, { "docid": "831f894a1297d756515e7c94e5fad6af", "score": "0.67855614", "text": "def metrosCalculo()\n \n metros = 0\n index = 0\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n metros += ( ( x.terrenoAño / 100 ) * y )\n end\n metros.round()\n end", "title": "" }, { "docid": "b1665fa0cbca8df2968547affd7866af", "score": "0.67715985", "text": "def IMC\n\t\t@imc=@peso/(@altura*@altura)\n\t\[email protected](2) # esta función la uso para que solo coja 2 decimales y no ponga 10\n\tend", "title": "" }, { "docid": "328f441ea0ac4f23e7af10ba34405d98", "score": "0.6731859", "text": "def cal_imc()\n\t\t@imc = (@paciente.peso/(@paciente.talla * @paciente.talla)).round(2)\n\tend", "title": "" }, { "docid": "a3179e8b133e760c40302cf5e6dadfc5", "score": "0.6683974", "text": "def imc1\n\t\t@alt=@altura/100.00\n\t\tvalor = @peso / ( @alt * @alt )\n\t\treturn valor\n\tend", "title": "" }, { "docid": "f81fb39329e92cb2fb506332a2cee782", "score": "0.66674024", "text": "def impacto_hombre\n\t\timp=valor_energetico/3000*100\n\t\timp.round(1)\n\tend", "title": "" }, { "docid": "bdb509b56579d96103414161ea1ae070", "score": "0.6664367", "text": "def calcula_imc(peso, altura)\n imc = peso / altura ** 2\n return imc\nend", "title": "" }, { "docid": "722926ee8f6c24c9253c20feb94ebba2", "score": "0.66537666", "text": "def impacto_mujer()\n impacto = (@valor_kcal / 2300.0) * 100.0\n impacto.round(2)\n end", "title": "" }, { "docid": "d720d502705753bdda43519b8c6bd2d9", "score": "0.66362333", "text": "def mm_per_mil\n circumference_mm / (mils_per_turn - 1)\n end", "title": "" }, { "docid": "840732cf74117fe923e5a2ff8ac09c29", "score": "0.64519525", "text": "def imc\n\t\tpeso/(talla*talla)\n end", "title": "" }, { "docid": "1ad543c1a4d0930887829cb1adb82d9c", "score": "0.6435029", "text": "def imc\n @imc= @peso/(@altura*@altura) \n @imc.round(4) \n end", "title": "" }, { "docid": "6d9cb391af1c4a5d70e84896ae98176a", "score": "0.6428603", "text": "def calc_imc\n return (poids_actu / (taille*taille)).to_s()\n end", "title": "" }, { "docid": "cc746e9d325233cb6d1b46c447928d38", "score": "0.6420878", "text": "def calculoIMC\n #puts '%.2f' % (@peso.to_f/(@altura.to_f * @altura.to_f))\n return '%.2f' % (@peso.to_f/(@altura.to_f * @altura.to_f))\n end", "title": "" }, { "docid": "d2680c125800da92941c1148b37488a0", "score": "0.63815004", "text": "def mass_teil\n @masse.reduce(:+)\n end", "title": "" }, { "docid": "a4167e8b75227dfb298f9f14c07abb29", "score": "0.63465285", "text": "def conjuntoPorcentaje\n aux= 0.0.to_d\n conjuntoAlimentos.size.times do |i|\n aux+= (conjuntoAlimentos[i].proteinas.to_d)* (conjuntoCantidades[i].to_d/1000.0)\n aux+= (conjuntoAlimentos[i].carbohidratos.to_d)* (conjuntoCantidades[i].to_d/1000.0)\n aux+= (conjuntoAlimentos[i].lipidos.to_d)* (conjuntoCantidades[i].to_d/1000.0)\n end\n return aux\n end", "title": "" }, { "docid": "f1fd21687b2ed734daf28585a6a48797", "score": "0.63009846", "text": "def calcular_promedio\n\t\tsuma = 0\n\t\tfor venta in ultimas_ventas\n\t\t\tsuma+=venta.valor\n\t\tend\n\t\treturn suma/ultimas_ventas.length\n\tend", "title": "" }, { "docid": "14fb12b72cf3aeaa3ac24ecca9f383cb", "score": "0.6268921", "text": "def emisionesCalculo()\n \n emisiones = 0\n index = 0\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n emisiones += ( ( x.gasEfectoInv / 100 ) * y )\n end\n emisiones.round()\n end", "title": "" }, { "docid": "fd64224eac5c6df258d9e346c0f5192f", "score": "0.6268851", "text": "def peso_teorico_ideal\n ((@datos.talla * 100) - 150) * 0.75 + 50 \n end", "title": "" }, { "docid": "3e22a799396ba408db98c1f73107fdee", "score": "0.6263492", "text": "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "title": "" }, { "docid": "9a781fabf73db57212fff6e226b43c04", "score": "0.62577075", "text": "def ingreso_neto_sujeto_a_impuesto_por_mes\n salary_minus_prev_discount = bruto_y_ticket_menos_desc_acum;\n deduction_acum = deducciones_generales_por_mes_acum \n apply_function_each_month {|mes| (salary_minus_prev_discount[mes] + deduction_acum[mes]<=0 ? 0.0: salary_minus_prev_discount[mes] + deduction_acum[mes]) }\n end", "title": "" }, { "docid": "77184af89e301f2b6d12410581d2d4a5", "score": "0.6248358", "text": "def imprime_na_tela_imc(peso, altura) \n imc = peso / altura ** 2\n puts \"IMC = \" + imc.to_s\nend", "title": "" }, { "docid": "3621a429a89387ce25e40226b1c51d2a", "score": "0.6246934", "text": "def porcentaje_fat\n\t\t@fat = (1.2 * @imc + 0.23 * @age - 10.8 * @sex - 5.4).round(2)\n\tend", "title": "" }, { "docid": "1dcc857c504afc799836ab52bd945498", "score": "0.6223165", "text": "def multiplicador_iva\n return 1.0 unless percepcion_iva.present?\n\n 1 + 0.01 * percepcion_iva\n end", "title": "" }, { "docid": "30eee7a7a47180d26921344276e8d274", "score": "0.62117743", "text": "def calcular_marcos_de_pagina()\n\treturn (cantidad_memoria_fisica_en_MB/tamanio_pagina_en_KB) * (1 << 10) # se multiplica por 2^10 para compensar la diferencia de unidades\nend", "title": "" }, { "docid": "a24e60f66700f0f97b22452b1ec1231c", "score": "0.61935335", "text": "def promedio\n (self.inject(0.0) { |suma, x| suma+x }) / @numeroDimensiones.to_f\n end", "title": "" }, { "docid": "52e66f888439c925bf9a274aeed40c24", "score": "0.6193213", "text": "def calc_puneggio(carte_prese_mano)\r\n punti = 0\r\n carte_prese_mano.each do |card_lbl|\r\n card_ifo = @deck_information.get_card_info(card_lbl)\r\n punti += card_ifo[:points]\r\n end\r\n \r\n return punti\r\n end", "title": "" }, { "docid": "af72f6049718fa186090b1345e5e126b", "score": "0.6189498", "text": "def valor_calorico\n auxNodo = @alimentos.head\n auxNodo1 = @gramos.head\n valor_calorico = 0\n while(auxNodo != nil && auxNodo1 != nil)\n valor_calorico += auxNodo.value.get_valor_kcal * auxNodo1.value\n auxNodo = auxNodo.next\n auxNodo1 = auxNodo1.next\n end\n return valor_calorico.round(1)\n end", "title": "" }, { "docid": "b767f6f578052cebeefb13554d8857fe", "score": "0.61785436", "text": "def vctCalculo()\n\n vct = 0\n index = 0\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n vct += ( ( x.valorEnergetico / 100 ) * y )\n end\n vct.round()\n end", "title": "" }, { "docid": "1e34976856a026db5b08a603fe2cea42", "score": "0.6157291", "text": "def peso_ideal\n ((@altura * 100) - 150) * 0.75 + 50\n end", "title": "" }, { "docid": "8ee78671664b0c99255de2c4ac3f0623", "score": "0.6154247", "text": "def porcentaje_carbono\n\t\thidratos = 0\n\t\ti = 0\n\t\tfor alimento in @alimentos\n\t\t\tif @hayblock\n\t\t\t\thidratos += valoresalimento[i][1]\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\thidratos += alimento.value.carbohidratos\n\t\t\tend\n\t\tend\n\t\taux = []\n\t\ti = 0\n\t\tfor alimento in @alimentos\n\t\t\tif @hayblock\n\t\t\t\taux << ((valoresalimento[i][1]/hidratos) * 100).round(2)\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\taux << ((alimento.value.carbohidratos/hidratos) * 100).round(2)\n\t\t\tend\n\t\tend\n\t\tif @hayblock\n\t\t\thidratos\n\t\tend\n\t\treturn aux\n\tend", "title": "" }, { "docid": "26f04347d20b60bf96d9c343a765be36", "score": "0.6140767", "text": "def cal_porcentaje_grasa()\n\t\tif @imc == 0.0\n\t\t\tcal_imc()\n\t\tend\n\t\t@porcentaje_grasa = ((1.2 * @imc) + (0.23 * @paciente.edad) - (10.8 * @paciente.sexo) - 5.4).round(2)\n\tend", "title": "" }, { "docid": "ce70c717cae27f105a13048a8c36de07", "score": "0.61193323", "text": "def calcular_e_imprimir_resultados\n @puestos.each do |puesto|\n puesto.pto = puesto.sto*100 / @t\n end\n pps = (@ss-@sll) / @nt\n\n puts \"Porcentaje de tiempo ocioso del primer puesto: #{@puestos[0].pto.round(5)}\"\n puts \"Porcentaje de tiempo ocioso del segundo puesto: #{@puestos[1].pto.round(5)}\"\n puts \"Porcentaje de tiempo ocioso del tercer puesto: #{@puestos[2].pto.round(5)}\"\n puts \"Promedio de permanencia en el sistema: #{pps.round(5.round(5))}\"\nend", "title": "" }, { "docid": "1f61a447489acde4720fa2e34884a63c", "score": "0.6116034", "text": "def nf_valorunit\n # ANTIGO FORMATO: 4.85\n valor_do_frete = 10.9\n val = (self.produto.preco - valor_do_frete)\n val += self.produto.plus_presente if self.presente\n return val\n end", "title": "" }, { "docid": "897889c4673d1097af9f5cbb53baf315", "score": "0.60824114", "text": "def lipsPorcent\n (((@alim_total.lip * 9) / @alim_total.valorEnergetico) * 100.00).round(3)\nend", "title": "" }, { "docid": "42aed0b394daa85d475ab0becedb2245", "score": "0.6079026", "text": "def porcentaje_hidratos_de_carbono\n\t\tresultado = ((hidratos_de_carbono / 260.0) * 100.0).round(2)\n\tend", "title": "" }, { "docid": "c1bd9ab72dcf979e65dbbc512966ca09", "score": "0.6074852", "text": "def importe\n return @valorUnitario*@cantidad\n end", "title": "" }, { "docid": "86ea2042d598839a1c78d6c89ffa6ef1", "score": "0.60697716", "text": "def calcule\n mInd = MontantCotisation.new\n mFam = MontantCotisation.new\n mInd.asIndividu(self.famille)\n mFam.asFamille(self.famille)\n familiale = mFam.net() < mInd.net()\n mc = familiale ? mFam : mInd\n self.cotisation_calculee = mc.total()\n self.non_taxable = mc.totalNonTaxable()\n \n # Si c'etait une cotisation familiale et maintenant individuel, on\n # enleve le rabais de pre-inscription\n self.rabais_preinscription = 0 if self.familiale && !familiale\n \n # Je ne reduit pas le rabais de pre-inscription si j'en ai deja un.\n self.rabais_preinscription = mc.rabaisPreInscription if self.rabais_preinscription < mc.rabaisPreInscription\n \n self.familiale = familiale\n\n # Sauver les details de la cotisation pour affichage. Pas utilise par la logique.\n desc = mc.description(self.famille.english? ? :en : :fr)\n self.frais1 = desc[0][1]\n self.frais1_explication = desc[0][0]\n self.frais2 = desc.size > 1 ? desc[1][1] : 0\n self.frais2_explication = desc.size > 1 ? desc[1][0] : ''\n self.frais3 = desc.size > 2 ? desc[2][1] : 0\n self.frais3_explication = desc.size > 2 ? desc[2][0] : ''\n self.frais4 = desc.size > 3 ? desc[3][1] : 0\n self.frais4_explication = desc.size > 3 ? desc[3][0] : ''\n self.frais5 = desc.size > 4 ? desc[4][1] : 0\n self.frais5_explication = desc.size > 4 ? desc[4][0] : ''\n self.frais6 = desc.size > 5 ? desc[5][1] : 0\n self.frais6_explication = desc.size > 5 ? desc[5][0] : ''\n \n save!\n end", "title": "" }, { "docid": "233095d608b0c7de147b809e8c6b441f", "score": "0.60645807", "text": "def impacto_hombre()\n impacto = (@valor_kcal / 3000.0) * 100.0\n impacto.round(2)\n end", "title": "" }, { "docid": "6210d6ca8c090e384143f288cdffe4a6", "score": "0.6048575", "text": "def calc_puneggio(carte_prese_mano)\n punti = 0\n carte_prese_mano.each do |card_lbl|\n @@deck_info[card_lbl]\n punti += @@deck_info[card_lbl][:points]\n end\n \n return punti\n end", "title": "" }, { "docid": "3d70fcc23589bdfa7f41daecdc97b41e", "score": "0.60198456", "text": "def protsPorcent\n (((@alim_total.prot * 4) / @alim_total.valorEnergetico) * 100.00).round(3)\nend", "title": "" }, { "docid": "9f3230dedbe45e9e57f16cef30735cd2", "score": "0.60155946", "text": "def valor_energetico\n\t\tvalor=0\n\t\taux = @alimentos.head\n\t\tauxgramos = @gramos.head\n\t\twhile(aux!=nil)\n\t\t\tvalor += aux.value.valor_energetico * (auxgramos.value/(aux.value.proteinas+aux.value.lipidos+aux.value.carbo))\n\t\t\taux = aux.next\n\t\t\tauxgramos = auxgramos.next\n\t\tend\n\t\tvalor.round(1)\n\tend", "title": "" }, { "docid": "9f3230dedbe45e9e57f16cef30735cd2", "score": "0.60155946", "text": "def valor_energetico\n\t\tvalor=0\n\t\taux = @alimentos.head\n\t\tauxgramos = @gramos.head\n\t\twhile(aux!=nil)\n\t\t\tvalor += aux.value.valor_energetico * (auxgramos.value/(aux.value.proteinas+aux.value.lipidos+aux.value.carbo))\n\t\t\taux = aux.next\n\t\t\tauxgramos = auxgramos.next\n\t\tend\n\t\tvalor.round(1)\n\tend", "title": "" }, { "docid": "3391f35701225ad293ca3c10459a491f", "score": "0.60128623", "text": "def inflation_reduction(v)\n monthly_adm_points v*(75.0/2.0/12)*0.25\n end", "title": "" }, { "docid": "3391f35701225ad293ca3c10459a491f", "score": "0.60128623", "text": "def inflation_reduction(v)\n monthly_adm_points v*(75.0/2.0/12)*0.25\n end", "title": "" }, { "docid": "31f940743de304a5745fbe2e06784692", "score": "0.59958375", "text": "def kilocalorias\n ((@proteinas* 4.0.to_d)+ (@lipidos* 9.0.to_d)+ (@carbohidratos* 4.0.to_d))\n end", "title": "" }, { "docid": "c4081afcb73fdd6f306dfcd10addd3cd", "score": "0.5994904", "text": "def mm(inVal)\r\n return inVal/2.54\r\nend", "title": "" }, { "docid": "ac37f843eb3d451c48e978d60475f9a5", "score": "0.5987014", "text": "def porcentaje_nulos\n total = @fil*@col\n no_nulos = 0\n \n i = 0\n while(i < @fil)\n j = 0\n while(j < @col)\n if(@matrix[i][j] != 0)\n no_nulos += 1\n end\n j += 1\n end\n i += 1\n end\n \n nulos = total - no_nulos\n nulos.to_f/total.to_f #/\n end", "title": "" }, { "docid": "ded52cd04af0fd9d69fc715b28dc8f2a", "score": "0.5986878", "text": "def moc\n MOC_2000_01_01 + ((self - T_2000_01_01) / 60).to_i\n end", "title": "" }, { "docid": "67351f1a1eaa64500b8ebeacab34ca67", "score": "0.5977133", "text": "def peso_teorico_ideal\n ((@talla*100-150)*0.75+50).round(2)\n end", "title": "" }, { "docid": "0127a0e836cc430d3cb4a8c45be8f0de", "score": "0.59723294", "text": "def calc_mi(t1, t2)\n v = `#{$lemur_path}/bin/calc_mi #{$lemur_path}/bin/param #@index_path #{t1} #{t2}`.split(\"\\n\").last.to_f\n (v > 0)? Math.log(v) : 0\n end", "title": "" }, { "docid": "5fc6863176b71da28a54da196e1a10e3", "score": "0.5965413", "text": "def pesoTeoricoIdeal ()\n (self.datosAntropometricos.talla * 100 - 150) * 0.75 + 50\n end", "title": "" }, { "docid": "a56102417d46f84593388093b5a5b5b4", "score": "0.59616166", "text": "def valor_energetico\n\t\tvalor=(4.0 * @carbo) + (9.0 * @lipidos) + (4.0 * @proteinas)\n\t\tvalor.round(1)\n\tend", "title": "" }, { "docid": "f23f6bc4600fba0fe39ce8d123994320", "score": "0.59616095", "text": "def promedio(notas)\n suma = 0\n notas.each do |nota|\n suma += nota.to_f\n end\n suma / notas.count\nend", "title": "" }, { "docid": "70890cd6148bf0ae0145a75a354e01dc", "score": "0.59437454", "text": "def Terreno_total\n\t\tr = 0\n n = @alimentos.head\n i = @gramos.head\n\n while !n.nil?\n\n r += ((n.value.terreno)*(i.value/100))\n n = n.next\n i = i.next\n end\n\n return (r).round(2)\n\tend", "title": "" }, { "docid": "56f9bef38d9386330d93beb0dd279ba8", "score": "0.59364784", "text": "def perimetras\n (@ilgis + @plotis) * 2\n end", "title": "" }, { "docid": "8add10a21ae0f0cc20137c55c6e7e29d", "score": "0.5925985", "text": "def total_cent\n return (@octave * @cents_per_octave) +\n (@semitone * CENTS_PER_SEMITONE) + @cent\n end", "title": "" }, { "docid": "526021932ca501c94b052517b6250b57", "score": "0.59243", "text": "def calculo_imc\n\t\t@imc = (@weight/@height**2).round(2)\n\tend", "title": "" }, { "docid": "657fc662731f79ab4a4c9f41cf6f76c9", "score": "0.5920116", "text": "def peso_kg\n self.peso/1000\n end", "title": "" }, { "docid": "7d07b0546e6377831e9dd37d16863c4a", "score": "0.591673", "text": "def valor_energetico\n\t\t(proteina*4+carb_hidr*4+lipido*9).round(2)\n\tend", "title": "" }, { "docid": "2f3cf8ba6ba83124f32295448171f565", "score": "0.5899897", "text": "def calcular_promedio(calificaciones)\n puts \"promedio\" \n \n suma =0\n calificaciones.each do |value|\n suma += value\n end\n\n promedio = suma / calificaciones.count\n\nend", "title": "" }, { "docid": "7a0a82404ebf5503ac3c198a35913675", "score": "0.5898867", "text": "def importe\n movimientos_en_moneda.collect(&:monto).sum.to_money(importe_moneda).abs\n end", "title": "" }, { "docid": "fe2919effbb24668282fbb03adc482f5", "score": "0.58967316", "text": "def get_valor_energetico_Kcal\n \t ((@grasas * 9) + (@hidratos_carbono * 4) + (@proteinas * 4) + (@sal * 6)).round(1)\n \tend", "title": "" }, { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.5890802", "text": "def numerator_units; end", "title": "" }, { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.5890802", "text": "def numerator_units; end", "title": "" }, { "docid": "2d73f833f49d33977d40c14eab5a8a11", "score": "0.5882063", "text": "def sumar_montos\n acum = 0\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.id)\n @lis_products.each do |product|\n product.quantity.times do\n acum = acum + product.product_product.price\n end\n end\n\n @lis_packages = Sale::PackageQuotation.where(sale_quotation_id: self.id)\n @lis_packages.each do |package|\n package.quantity.times do\n acum = acum + package.colection_package.total_amount\n end\n end\n return acum\n end", "title": "" }, { "docid": "e6aa2dc5121c1823449a34e58aa8e927", "score": "0.5868299", "text": "def pesoTeoricoIdeal ()\n \t(self.talla * 100 - 150) * 0.75 + 50\n \tend", "title": "" }, { "docid": "4038d2cf1484dbd9ca92de5c6b5a1925", "score": "0.5866596", "text": "def calc_punteggio(carte_prese_mano)\r\n punti = 0\r\n assi = 0\r\n pezze = 0\r\n carte_prese_mano.each do |card_lbl|\r\n card_info = @deck_information.get_card_info(card_lbl)\r\n punti += card_info[:points]\r\n assi += 1 if card_is_asso?(card_lbl)\r\n pezze += 1 if card_is_pezza?(card_lbl)\r\n end\r\n punti_info = {:tot=>punti / 3, :pezze=>pezze, :assi=>assi}\r\n \r\n return punti_info\r\n end", "title": "" }, { "docid": "98b19b53aa1bd7775e84bc9a3751e8d5", "score": "0.5865468", "text": "def carbsPorcent\n (((@alim_total.carbs * 4) / @alim_total.valorEnergetico) * 100.00).round(3)\nend", "title": "" }, { "docid": "645b22e15c41c098411371290e4ca147", "score": "0.58572125", "text": "def cal_rcc()\n\t\t@rcc = (@paciente.cir_cintura / @paciente.cir_cadera).round(2)\n\tend", "title": "" }, { "docid": "849a5117b0eb33ad9729d2b16690e088", "score": "0.5857019", "text": "def porc_fat\n\t\treturn (1.2 * imc + 0.23 * @age - 10.8 * @sex -5.4).round(2)\n\tend", "title": "" }, { "docid": "322457968c66cf6e46808ebb91150055", "score": "0.58440495", "text": "def total\n precio_unitario * cantidad\n end", "title": "" }, { "docid": "322457968c66cf6e46808ebb91150055", "score": "0.58440495", "text": "def total\n precio_unitario * cantidad\n end", "title": "" }, { "docid": "91883fc4ac401d1c32f896376699758e", "score": "0.5842132", "text": "def deg_per_met\n\t\tr = 6371000\n\t\tlatrad = lat.abs * (2*Math::PI/360) # Converts latitudinal degrees into radians for the sake of sake of Ruby's sin function.\n\t\trprime = r * Math.sin(latrad) # Using SOHCAHTOA to get the horizontal cross-sectional radius of the earth at the user's latitude.\n\t\treturn 360 / (rprime*2*Math::PI) # Takes this radius and uses it to get the cross-sectional circumference at that point in meters\n # and return 360 degrees by this circumferences to get degrees per meter.\n\tend", "title": "" }, { "docid": "91883fc4ac401d1c32f896376699758e", "score": "0.5842132", "text": "def deg_per_met\n\t\tr = 6371000\n\t\tlatrad = lat.abs * (2*Math::PI/360) # Converts latitudinal degrees into radians for the sake of sake of Ruby's sin function.\n\t\trprime = r * Math.sin(latrad) # Using SOHCAHTOA to get the horizontal cross-sectional radius of the earth at the user's latitude.\n\t\treturn 360 / (rprime*2*Math::PI) # Takes this radius and uses it to get the cross-sectional circumference at that point in meters\n # and return 360 degrees by this circumferences to get degrees per meter.\n\tend", "title": "" }, { "docid": "91883fc4ac401d1c32f896376699758e", "score": "0.5842132", "text": "def deg_per_met\n\t\tr = 6371000\n\t\tlatrad = lat.abs * (2*Math::PI/360) # Converts latitudinal degrees into radians for the sake of sake of Ruby's sin function.\n\t\trprime = r * Math.sin(latrad) # Using SOHCAHTOA to get the horizontal cross-sectional radius of the earth at the user's latitude.\n\t\treturn 360 / (rprime*2*Math::PI) # Takes this radius and uses it to get the cross-sectional circumference at that point in meters\n # and return 360 degrees by this circumferences to get degrees per meter.\n\tend", "title": "" }, { "docid": "cd96871158626689371b4f68a0a2db00", "score": "0.5839939", "text": "def augment(precio,factor)\n nuevo_precio = [] # Definiendo el array que guardará los nuevos precios, luego de aplicar el % de aumento.\n precio.each do |precios| # Aqui va la iteracion, la cual dependerá de la cantidad de precios que se quieran aumentar\n nuevo_precio.push(precios.to_i*factor) # Aqui se guarda los nuevos precios, sin convertirlo a entero no ejecutará el calculo\n end\n nuevo_precio # Es es lo que visualizará el usuario en pantalla\n end", "title": "" }, { "docid": "718f848897af01de58dde090e27d1b90", "score": "0.58392704", "text": "def fuel_calcuation(mass)\n (mass/3) - 2\nend", "title": "" }, { "docid": "7294ec56e097e9c0c793a35a78b83ce9", "score": "0.5831831", "text": "def proba_oo(user=nil) nb_presentation == 0.0 ? 0.0 : (nb_oo / nb_presentation) end", "title": "" }, { "docid": "f4ff152b3795c9821781fed8ede02dbf", "score": "0.5828169", "text": "def porcentaje_grasa\n\t\t@grasa=1.2*@imc+0.23*@edad-10.8*@sexo-5.4\n\t\[email protected](2)\n\tend", "title": "" }, { "docid": "35400bc7ecdb80fe1f60093b942abb4f", "score": "0.58250463", "text": "def calc(temp_f)\n\t\n\ttemp_f.to_i\n\t\n\t(temp_f - 32)* 5/9\n\nend", "title": "" }, { "docid": "16d796496f1cbe2fdf0ff972bb59e285", "score": "0.58184844", "text": "def get_temps_total\n nb_process = @@tab_process.size\n temps_total = 0\n for proc in @@tab_process\n ## proc correspond au tableau tab_step de chaque proc\n for step in proc\n temps_total += step[\"Computation_time\"]\n end\n end\n # on retourne la moyenne du temps\n (temps_total / nb_process )\nend", "title": "" }, { "docid": "f0e7aa7051e67784883fbaf7079cffe6", "score": "0.5808403", "text": "def apr_to_monthly_interest(apr_in_percent)\n (apr_in_percent / 100) / 12\nend", "title": "" }, { "docid": "9ae6e2fe8e4797e66bd5bab52139bfe5", "score": "0.58019584", "text": "def total_mass\n flay_masses.reduce(:+).to_i\n end", "title": "" }, { "docid": "81381b7a67b80baa4175ce7d9bc2c06e", "score": "0.57996845", "text": "def tmb\n 10*@peso + ((@altura * 100) * 6.25) - 5 * @edad + 5 + ((1-@sexo) * 166)\n end", "title": "" }, { "docid": "f6392b56f211f41e61f01d29ff01bebf", "score": "0.57956445", "text": "def valor_energetico_kcal()\n\n @ngrasas*9 + @grasas_m*9 + @grasas_p*9 + @hidratos*4 + @polialcoholes*2.4 + @almidon*4 + @fibra*2 + @proteinas*4 + @sal*6\n\n end", "title": "" }, { "docid": "4b7ffd6f67bdb80b58f9c6d3fecc2ec2", "score": "0.5795157", "text": "def porcentaje_grasa()\n\t\t(1.2 * imc + 0.23 * edad - 10.8 * sexo - 5.4).round(2)\n\tend", "title": "" }, { "docid": "1a0eb5c467e783bf15224da52efb284b", "score": "0.5794166", "text": "def ganancia_a_retener_por_mes \n ganancias_por_mes = impuesto_a_ganancias_por_mes\n retenido_mes_anterior = 0.0\n apply_function_each_month {|mes|\n a_retener = ganancias_por_mes[mes] + retenido_mes_anterior #OJO es '+' porque retenido_mes anterior es negativo\n retenido_mes_anterior = (-1) * a_retener + retenido_mes_anterior\n a_retener\n }\n \n end", "title": "" }, { "docid": "4f470d077e8d2a1cfe1e5e1390c1660c", "score": "0.5792684", "text": "def porcentaje_nulos\r\n total = @fil*@col\r\n no_nulos = 0\r\n \r\n i = 0\r\n while(i < @fil)\r\n # El tamaño de cada fila es el numero de elementos no nulos que hay en ellas\r\n no_nulos += @matrix[i].size\r\n i += 1\r\n end\r\n \r\n nulos = total - no_nulos\r\n nulos.to_f/total.to_f\r\n end", "title": "" }, { "docid": "0e9f3f9c1ec3cc3b506e7ec003a5e82f", "score": "0.5789165", "text": "def totient(prime_division)\n n = prime_division.map { |n, pow| n ** pow }.reduce(:*)\n m = prime_division.map { |n, pow| 1 - 1r/n }.reduce(:*)\n n*m\nend", "title": "" }, { "docid": "c205da3161d3352bb3998525b5093bc8", "score": "0.57849324", "text": "def hidratosCalculo()\n \n hidratos = 0\n index = 0\n sumaTotalGramos = 0\n @listaGramos.each { | gr | sumaTotalGramos += gr }\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n hidratos += ( ( x.carbohidratos / 100 ) * y )\n end\n (hidratos * 100 / sumaTotalGramos).round()\n end", "title": "" }, { "docid": "b09851b2ff329e7b997ab0120b459fca", "score": "0.578289", "text": "def metabolized\n (0.015 * 0.25)\n end", "title": "" }, { "docid": "02bdb70154c073b90b2c1f6253066b27", "score": "0.5777778", "text": "def pago_minimo_informativo(credito)\n pago = Pago.find(:first, :conditions => [\"credito_id = ?\", credito.id])\n return pago.capital_minimo.to_f + pago.interes_minimo.to_f\n end", "title": "" }, { "docid": "f8aefb8c8cfc968e43a81f98f7cefe70", "score": "0.57724994", "text": "def huella_nutricional\n (huellacarbono + energia) / 2.0\n end", "title": "" }, { "docid": "df5f86959b948e9f1894f85b24f1c48c", "score": "0.57699496", "text": "def pmt(interest, number_payments, principal)\nnumerator = principal * interest * ((1 + interest)**number_payments)\ndenominator = ((1+interest)**number_payments)-1\nreturn (numerator.to_f/denominator.to_f).round.to_f\nend", "title": "" }, { "docid": "f6121278e040405f496fe7adbe416637", "score": "0.57670736", "text": "def mi_in_km\n 1.0 / KM_IN_MI\n end", "title": "" }, { "docid": "0737675d548dfeedbcecca16fb8e0d13", "score": "0.57618314", "text": "def calcpi()\n\n pi = 0.0\n rep = $PI_ITER\n \n while rep >= 0\n \n pi += 1.0 / pow(16.0, rep) * (4.0 / (8.0 * rep + 1.0) - 2.0 / (8.0 * rep + 4.0) - 1.0 / (8.0 * rep + 5.0) - 1 / (8.0 * rep + 6.0))\n rep -= 1\n\t\t\n end\n\t\n return pi\nend", "title": "" }, { "docid": "05871c2de4d3239f2f7511cdca6e3fea", "score": "0.5757221", "text": "def fuel_calc(mass)\n # When dividing ints ruby automatically rounds down\n (mass.to_i/3) - 2\nend", "title": "" }, { "docid": "178b325eed151de521b86665e2339d7e", "score": "0.5754389", "text": "def get_valor_energetico_KJ\n \t ((@grasas * 37) + (@hidratos_carbono * 17) + (@proteinas * 17) + (@sal * 25)).round(1)\n \tend", "title": "" } ]
5ff6abb81e52162c0ca023c2ff1252f8
Get the list of properties and their various options for the supplied Entity name.
[ { "docid": "126dc1114768b3552b4a514ec5a04645", "score": "0.691733", "text": "def properties_for_entity(entity_name)\n type_definition = metadata.xpath(\"//EntityType[@Name='#{entity_name}']\").first\n raise ArgumentError, \"Unknown EntityType: #{entity_name}\" if type_definition.nil?\n properties_to_return = {}\n type_definition.xpath('./Property').each do |property_xml|\n property_name, property = process_property_from_xml(property_xml)\n properties_to_return[property_name] = property\n end\n properties_to_return\n end", "title": "" } ]
[ { "docid": "5b37d171837b4206ff5b7368fdbdb059", "score": "0.69078535", "text": "def properties_for_entity(entity_name)\n namespace, _, entity_name = entity_name.rpartition('.')\n raise ArgumentError, 'Namespace missing' if namespace.nil? || namespace.empty?\n schemas[namespace].properties_for_entity(entity_name)\n end", "title": "" }, { "docid": "5b37d171837b4206ff5b7368fdbdb059", "score": "0.69078535", "text": "def properties_for_entity(entity_name)\n namespace, _, entity_name = entity_name.rpartition('.')\n raise ArgumentError, 'Namespace missing' if namespace.nil? || namespace.empty?\n schemas[namespace].properties_for_entity(entity_name)\n end", "title": "" }, { "docid": "820cc277ed03e81ef92656f6297103ee", "score": "0.5746937", "text": "def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end", "title": "" }, { "docid": "cee6d423f0b40ec6c276752b5a2c2f2f", "score": "0.5594987", "text": "def get_properties(options={})\n return send_message(SkyDB::Message::GetProperties.new(options))\n end", "title": "" }, { "docid": "e205e63d5387df8673aa9d452b2bc8d1", "score": "0.55658287", "text": "def fetch_property(name)\n properties.where(\"name = ?\", name).first\n end", "title": "" }, { "docid": "963e1bac9b1147a6d7c93fc22bb3c99a", "score": "0.5548125", "text": "def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse(result.body)\n \n rescue\n @logger.error(\"Unable to retrieve entity:\\n#{$!}\")\n []\n end", "title": "" }, { "docid": "16b5f50f52de7e458d04c776a8342e1d", "score": "0.54945385", "text": "def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end", "title": "" }, { "docid": "5c568bfbc42ded07c6b4fd19e04061be", "score": "0.5420707", "text": "def property_names\n @properties.values.map(&:name)\n end", "title": "" }, { "docid": "f1e33c70795af8a0e8856add6da3ab0b", "score": "0.5343361", "text": "def list_properties 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_properties_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::Analytics::Admin::V1alpha::ListPropertiesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "8324e781a81aa5216211db5ddd0e7a98", "score": "0.5280775", "text": "def all\n @all ||= property_hashes.map do |hash|\n Entities::PropertyType.new(\n id: hash[\"id\"],\n name: hash[\"rentals_united_name\"],\n roomorama_name: hash[\"roomorama_name\"],\n roomorama_subtype_name: hash[\"roomorama_subtype_name\"]\n )\n end\n end", "title": "" }, { "docid": "a5349de3a283d19ee572c3c6c7235620", "score": "0.52776337", "text": "def entity_list(entity)\n case entity\n when Player then @players\n else @npcs\n end\n end", "title": "" }, { "docid": "a40ee4d0e2e504ac31b0ca4cb923e0b4", "score": "0.52662355", "text": "def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end", "title": "" }, { "docid": "a28d8ca042edfde083324bb7e4054437", "score": "0.526297", "text": "def get_property(property_name)\n command(\"get_property\", property_name)\n end", "title": "" }, { "docid": "54a273a56af3b87f604b4aab0197312c", "score": "0.5258819", "text": "def available_properties\n @properties ||= list.properties\n end", "title": "" }, { "docid": "84ead30045743ba4dc6468ae2f8f96be", "score": "0.5254067", "text": "def property_names\n trait[:PROPERTIES].keys\n end", "title": "" }, { "docid": "cb3673d1d8073053efa0c8453ad222f0", "score": "0.5209672", "text": "def propname_properties\n props = self.properties\n if supports_locking?\n props = props.dup if props.frozen?\n props << { name: 'lockdiscovery', ns_href: DAV_NAMESPACE }\n end\n props\n end", "title": "" }, { "docid": "07de55b71ea898e7437acdc069822c2c", "score": "0.51829326", "text": "def facts_for(entity, property)\n return [] if @facts[entity].nil? || @facts[entity][property].nil?\n return @facts[entity][property]\n end", "title": "" }, { "docid": "8adf410abc670cbc68ca9888d5750be9", "score": "0.51758146", "text": "def properties_get(opts = {})\n data, _status_code, _headers = properties_get_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "083b12ee62292d810dbeb8f583e6b1e7", "score": "0.5165255", "text": "def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end", "title": "" }, { "docid": "355ac013d84b9ea7563690c5aa7a93d8", "score": "0.5154516", "text": "def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend", "title": "" }, { "docid": "28bd4fd7a2f35b7839dde565878347f9", "score": "0.51506686", "text": "def property_names\n properties.symbolize_keys.keys\n end", "title": "" }, { "docid": "50b19f2d425786a09eea082bf67b1e62", "score": "0.5143548", "text": "def query\n self.class.instances.each do |instance|\n if instance.name == name || instance.name.downcase == name\n return instance.properties\n end\n end\n nil\n end", "title": "" }, { "docid": "68b4acb676bb0e3b77a79768e6b71da0", "score": "0.51377094", "text": "def relationship_get_property id, name\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n get_request 'relationship/' + id + '/properties/' + name, headers\n end", "title": "" }, { "docid": "59bb2e0c76acd4c250ec18d3bb2be61d", "score": "0.5124755", "text": "def query\n self.class.instances.each do |mod|\n return mod.properties if mod.name == name || mod.name.downcase == name\n end\n nil\n end", "title": "" }, { "docid": "64f5b00040bedf8174a065b88fa0c6e5", "score": "0.5112223", "text": "def property_keys\n headers = { 'Accept' => 'application/json; charset=UTF-8' }\n get_request 'propertykeys', headers\n end", "title": "" }, { "docid": "8bee5675e8c01a25df5be4675a5bb622", "score": "0.51069814", "text": "def properties\n properties = []\n relations = self.property_relations\n relations.each do |relationship|\n properties.push relationship.property\n end\n properties\n end", "title": "" }, { "docid": "9bbee38ce58b529a1dc09acc5b700fe8", "score": "0.50820124", "text": "def all(entity_name) # :nodoc:\n chk_conn\n @hibernate_session.create_criteria(entity_name).list.to_a\n end", "title": "" }, { "docid": "d240544001f21188e10ad2254228ea2d", "score": "0.50756395", "text": "def props\n ret = {}\n property_names.each do |property_name|\n ret[property_name] = respond_to?(property_name) ? send(property_name) : send(:[], property_name)\n end\n ret\n end", "title": "" }, { "docid": "351d27e00312367d913ff6192c73befd", "score": "0.50530946", "text": "def getProperties\n Category.select(:id)\n end", "title": "" }, { "docid": "6a6877366a40535a62ff2f1e88492566", "score": "0.5033397", "text": "def get_entity( name, parent_context = nil )\n id = @entity_names[ get_entity_unique_name(name, parent_context) ]\n @entity_list[ id ]\n end", "title": "" }, { "docid": "a4c825360b1eb581a9a2f9c32e8cc42f", "score": "0.5024918", "text": "def get_full_options\n result = {}\n usable_properties = self.class.held_properties\n usable_properties.delete(:from_class)\n usable_properties.each do |option|\n result[option] = self.send(option) if self.send(option) && self.send(option) != \"\"\n end\n result\n end", "title": "" }, { "docid": "030f626679736c73cbd3f6e231b44042", "score": "0.5024148", "text": "def select(property_name)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.select(property_name.to_sym)\n end", "title": "" }, { "docid": "1e99012872d6bfc18f90c6f6e04e0d6d", "score": "0.50126415", "text": "def property_options\n return @array.map {|property|\n {\n name: property.print_list,\n value: property.property_id\n }\n }\n end", "title": "" }, { "docid": "9e3d052b063ccae944ee4da89b47fae8", "score": "0.500623", "text": "def returning(*properties)\n @options['=.proplist'] ||= []\n properties.each do |property|\n @options['=.proplist'] << \"#{property}\"\n end\n self\n end", "title": "" }, { "docid": "4f3207a7d82d6c0afddd9b0fb13f7b5b", "score": "0.4986642", "text": "def property(name, opts)\n @properties ||= []\n @properties << Property.new(name, opts)\n end", "title": "" }, { "docid": "3bcbf354e04b6071ed7aa3899df3e626", "score": "0.498579", "text": "def [](name)\r\n\t\tif name == \"properties\" then @properties\r\n\t\telsif name == \"fields\" then @fields\r\n\t\telse @properties[prop_get(name)] || @fields[field_get(name)]\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "5c0a115764fec48f1d2523ff27a1aea1", "score": "0.49684396", "text": "def get_property(name)\n return @properties[name]\n end", "title": "" }, { "docid": "583e7c5eca5cc67ee4562cdbd5739344", "score": "0.49561492", "text": "def get(entity)\n @components[entity.id] \n end", "title": "" }, { "docid": "455790079ec39c030adf75fda3a3c1c3", "score": "0.49538946", "text": "def get_storage_account_properties(name)\n request_path = \"/services/storageservices/#{name}\"\n request = client.management_request(:get, request_path)\n response = request.call\n Serialization.storage_services_from_xml(response).first\n end", "title": "" }, { "docid": "d501be0218b0936eb83af2726df93240", "score": "0.4928085", "text": "def query\n self.class.instances.each do |instance|\n if instance.name == self.name or instance.name.downcase == self.name\n return instance.properties\n end\n end\n nil\n end", "title": "" }, { "docid": "c06eeb3b3e600c6d57942ab56e557c09", "score": "0.4923217", "text": "def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end", "title": "" }, { "docid": "261e117a979284289ef3ae597057c282", "score": "0.49220073", "text": "def properties\n component ? component.properties : []\n end", "title": "" }, { "docid": "42790c42678c6e4656d413740b6f0d6b", "score": "0.49192452", "text": "def property_names\n @property_names ||= properties.keys\n end", "title": "" }, { "docid": "3d290c81bc29db3268b11c0380e2bb9b", "score": "0.49188697", "text": "def list_options\n\t\t read_inheritable_attribute(:list_options)\n\t end", "title": "" }, { "docid": "f1d2f754855b65b53ebb91c18a74c1ee", "score": "0.49124688", "text": "def select_options\n @addresses = EntityAddress.order(entity: :asc).map do |o|\n {\n id: o.id,\n name: o.entity\n }\n end\n\n respond_to do |format|\n format.json { render json: @addresses }\n end\n end", "title": "" }, { "docid": "e23bba1c5ed67fed398b3495303d5f35", "score": "0.49101818", "text": "def property( name )\n ( @properties ||= Hash.new )[ name ]\n end", "title": "" }, { "docid": "30b51b1e4338b957363e899388e4cfdb", "score": "0.48882887", "text": "def properties(ctx)\n properties = Properties.new()\n ctx.each { |key, value| properties.put(key, value) }\n return properties\n end", "title": "" }, { "docid": "fde4b8af10b71b584c6aa33373630c79", "score": "0.48875773", "text": "def property_properties\n _property_properties\n end", "title": "" }, { "docid": "e1f2dc7a852a4008dd25140d8563ed8d", "score": "0.48816288", "text": "def property_map\n self.class.properties.map do |name, opts|\n if opts\n yreq = opts[:req] ? :req : :opt\n [\"@#{ name }\", yreq] if yreq\n end\n end.compact\n end", "title": "" }, { "docid": "80deeeb92d53afbce469b436589920b5", "score": "0.4879021", "text": "def properties\n self.class.properties.keys\n end", "title": "" }, { "docid": "570c6011b925840567e544c4e134251e", "score": "0.48787776", "text": "def zfs_properties(name)\n properties || parse_zfs_properties(zfs_get_properties(name))\nend", "title": "" }, { "docid": "7cd959f1709876f5709f9fbffe6311cd", "score": "0.48785874", "text": "def prop(name)\n properties.named(name).first.andand.value\n end", "title": "" }, { "docid": "2db668e73414e9338a9613a99110a193", "score": "0.48655024", "text": "def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end", "title": "" }, { "docid": "9986a504fe094c53bc2309ff8984a371", "score": "0.48650074", "text": "def get_property(name)\n Config::Collection.get(name)\n end", "title": "" }, { "docid": "5cbe46832695c83f9812afb69500d7bf", "score": "0.48490876", "text": "def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end", "title": "" }, { "docid": "bfe1334935a6ed964deaa8efe7effe7d", "score": "0.48476863", "text": "def fields\n properties.keys.map(&:to_sym)\n end", "title": "" }, { "docid": "bfe1334935a6ed964deaa8efe7effe7d", "score": "0.48476863", "text": "def fields\n properties.keys.map(&:to_sym)\n end", "title": "" }, { "docid": "ecd003b18dd29291f9d99a35de6285fb", "score": "0.48474628", "text": "def property_names\n raise NotImplementedError\n end", "title": "" }, { "docid": "fb79a86eb0ce51438ba85ac940ab6608", "score": "0.4828189", "text": "def props\n ret = {\"_neo_id\" => getId()}\n iter = getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = getProperty(key)\n end\n ret\n end", "title": "" }, { "docid": "4e201c52cb230272e1cb58b714fb9c8a", "score": "0.48260966", "text": "def get_properties(did, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(did, opts)\n return data\n end", "title": "" }, { "docid": "d060c885defbd0a307383655c106c5f3", "score": "0.48241436", "text": "def show\n @product_template = ProductTemplate.find(params[:id])\n @keys = @product_template.properties.keys\n @values = @product_template.properties.values\n end", "title": "" }, { "docid": "aa565fa2baed453cdc7a89d60580babe", "score": "0.48231605", "text": "def properties(path, property_names)\n result = properties_for_path(path, property_names, 0)\n if result[0].key?(200)\n return result[0][200]\n else\n return []\n end\n end", "title": "" }, { "docid": "a34042dabe62678f0b511c77b871e90d", "score": "0.48202443", "text": "def index\n @properties = Property.get_all(params[\"city\"], params[\"country\"])\n end", "title": "" }, { "docid": "14d00bee8a7ef28a4e747d83943f9dd6", "score": "0.48151183", "text": "def properties\n self.class.properties.collect { |prop| @parameters[prop.name] }.compact\n end", "title": "" }, { "docid": "269cf179725b3d864e72ab1021601c33", "score": "0.48148438", "text": "def get_property(name)\n if name[:ns_href] == DAV_NAMESPACE\n super\n else\n custom_props(name)\n end\n end", "title": "" }, { "docid": "1ae6d2338018324dfb60a62546a930d0", "score": "0.4807533", "text": "def properties\n model.properties\n end", "title": "" }, { "docid": "adebde5e9c2efe3177c5b723b5c697c3", "score": "0.4802437", "text": "def properties_via(group)\n properties = []\n property_relations_via(group).each do |relationship|\n property = relationship.property\n properties.push(property)\n end\n properties\n end", "title": "" }, { "docid": "0e833ef8e99e6651b8ecb4760460b3ef", "score": "0.48003703", "text": "def index\n @properties = @products.map(&:properties).flatten.uniq\n end", "title": "" }, { "docid": "e2f300f7e665dd4b7fba2e48b0bcc9fa", "score": "0.4800311", "text": "def index\n @contact_properties = @active_org.contact_properties\n\n if current_person.has_role?(:super_admin)\n @contact_properties = ContactProperty.all\n end\n end", "title": "" }, { "docid": "184811facbebab409a6a67c92296aa7f", "score": "0.4794163", "text": "def get_properties()\n return @properties\n end", "title": "" }, { "docid": "cfd5921a9878ce850bf60e0653514086", "score": "0.47846156", "text": "def method_missing(name)\n if @properties.key? name\n @properties[name]\n else\n super\n end\n end", "title": "" }, { "docid": "a5c4210ab2a68d6520cb212e75233648", "score": "0.4779939", "text": "def properties\n @properties\n end", "title": "" }, { "docid": "ea4ec22a908b0c888b492e99fa2e632d", "score": "0.47767338", "text": "def property(name); end", "title": "" }, { "docid": "23c3b493d75634888df28103fcb274ac", "score": "0.4775286", "text": "def each_property_name\n @properties_list.keys.each do |edge|\n yield(edge[1])\n end\n end", "title": "" }, { "docid": "ff7c8c4bc283ea9c79ec066bb625f1a0", "score": "0.4774826", "text": "def properties\n PropertySet.new(query.fields)\n end", "title": "" }, { "docid": "c21bc91e0f7e857de0b533ca1fbb17d1", "score": "0.47699675", "text": "def list\n if params[:keyword]\n name_pattern = \"%#{params[:keyword]}%\"\n else\n name_pattern = \"#{params[:letter]}%\"\n end\n \n @entities = GetText::Db::Entity.find(\n :all,\n :conditions => ['name like ?', name_pattern]\n )\n end", "title": "" }, { "docid": "9e09e0d003d6cd84e3fb0771a18d016a", "score": "0.4756477", "text": "def query\n self.class.instances.each do |pkg|\n return pkg.properties if pkg.name == @resource[:name]\n end\n return nil\n end", "title": "" }, { "docid": "5b7d37a5cd6d1f06b3ea1cb80dc8f6b6", "score": "0.47391635", "text": "def fetch_options(what, attr_name, default = nil)\n name = [attr_name, what].join('_')\n return object.send(name) if object.respond_to?(name)\n fetched = options[name.to_sym] || default\n raise \"undefined #{name}\" unless fetched\n fetched\n end", "title": "" }, { "docid": "d4a6e3b15cd1bcd7fcc4f5cdb1a6d18c", "score": "0.47274917", "text": "def name\n @property_name\n end", "title": "" }, { "docid": "744d0cfd3e82d914254c296d16c580ac", "score": "0.4725573", "text": "def properties\n decorate_with_methods(read_attribute(:properties))\n end", "title": "" }, { "docid": "df517da4fc6b43cb29dc19ed48f2d79e", "score": "0.47154427", "text": "def search_property(name) \n name = name.to_sym\n \n if properties[name]\n properties[name]\n elsif superclass.respond_to?(:search_property)\n superclass.search_property(name)\n else\n nil\n end\n end", "title": "" }, { "docid": "71aa6badc54f0713387fba8e555a7089", "score": "0.47108585", "text": "def get_properties(table)\n # TODO: use SHOW INDEXES to find out unique and non-unique indexes\n\n select(\"SHOW COLUMNS FROM #{table} IN #{options[:path][1..-1]};\").map do |column|\n type = get_type(column.type)\n auto_increment = column.extra == 'auto_increment'\n\n if type == Integer && auto_increment\n type = DataMapper::Types::Serial\n end\n\n attribute = {\n :name => column.field.downcase,\n :type => type,\n :required => column.null == 'NO',\n :default => column.default,\n :key => column.key == 'PRI',\n }\n\n # TODO: use the naming convention to compare the name vs the column name\n unless attribute[:name] == column.field\n attribute[:field] = column.field\n end\n\n attribute\n end\n end", "title": "" }, { "docid": "83246418ead34dc4ce87fb0d7906f597", "score": "0.4708218", "text": "def get_prop(values)\n cmd = \"{\\\"id\\\":1,\\\"method\\\":\\\"get_prop\\\",\\\"params\\\":[#{values}]}\\r\\n\"\n request(cmd)\n end", "title": "" }, { "docid": "456e185ec29e99eff0bdfe9958e737d6", "score": "0.46921575", "text": "def required_properties(entity)\n requireds = entity[:children]\n .select { |ch| ch[:required] == true }\n .map { |ch| ch[:name].to_s }\n pre_req = entity[:required].is_a?(Array) ? entity[:required] : []\n { required: requireds | pre_req }\n end", "title": "" }, { "docid": "4fd9474003dc0ef644633439fec30456", "score": "0.4690153", "text": "def get_entity(name)\n # These are the valid entities and their validators are defined\n if [\"Taluk\",\"Panchayat\",\"Place\"].include?(name)\n return name.constantize, name.downcase+\"_params\", name.downcase\n else\n return nil\n end\n end", "title": "" }, { "docid": "6c0e7f52cfa5605abe7bbd3386d9d0dc", "score": "0.4660483", "text": "def get_property _property\n send_cmd(\"get_property #{_property}\")\n end", "title": "" }, { "docid": "0b5ce240b57a0660d69de1cf4c6e1249", "score": "0.46499568", "text": "def list_options\n list_of_options = String.new\n Contacts.each { |contact| list_of_options = list_of_options + contact[0].to_s + \"(\" + contact[1][:name_choices] + \"),\" }\n return list_of_options \nend", "title": "" }, { "docid": "fb9fd305727c774183f2ccfcaff55440", "score": "0.46448344", "text": "def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end", "title": "" }, { "docid": "d68d74bf89c1113e5f073f53c7130081", "score": "0.46353275", "text": "def property_name\n property.display_name\n end", "title": "" }, { "docid": "0a20b969c6f2456fc46964a06a3999cb", "score": "0.4633152", "text": "def properties\n @properties\n end", "title": "" }, { "docid": "59458e6b9d1f4f2bb1aedcef9d96262d", "score": "0.46327314", "text": "def attribute_get(name)\n \n name = name.to_sym\n \n if properties.has_key?(name)\n properties[name].get(self)\n else\n nil\n end\n \n end", "title": "" }, { "docid": "39e1959980c4fdec53696b01a6ee1d59", "score": "0.46320388", "text": "def get_property(*args)\n return unless alive?\n\n command(\"get_property\", *args)[\"data\"]\n end", "title": "" }, { "docid": "3810bee6f813ef9c457ee4170203be54", "score": "0.4630662", "text": "def properties_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.properties_get ...\"\n end\n if opts[:'sort'] && !['listprice', '-listprice', 'listdate', '-listdate', 'beds', '-beds', 'baths', '-baths'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of listprice, -listprice, listdate, -listdate, beds, -beds, baths, -baths'\n end\n # resource path\n local_var_path = \"/properties\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'q'] = opts[:'q'] if opts[:'q']\n query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if opts[:'status']\n query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if opts[:'type']\n query_params[:'agent'] = opts[:'agent'] if opts[:'agent']\n query_params[:'brokers'] = @api_client.build_collection_param(opts[:'brokers'], :multi) if opts[:'brokers']\n query_params[:'minprice'] = opts[:'minprice'] if opts[:'minprice']\n query_params[:'maxprice'] = opts[:'maxprice'] if opts[:'maxprice']\n query_params[:'minarea'] = opts[:'minarea'] if opts[:'minarea']\n query_params[:'maxarea'] = opts[:'maxarea'] if opts[:'maxarea']\n query_params[:'minbaths'] = opts[:'minbaths'] if opts[:'minbaths']\n query_params[:'maxbaths'] = opts[:'maxbaths'] if opts[:'maxbaths']\n query_params[:'minbeds'] = opts[:'minbeds'] if opts[:'minbeds']\n query_params[:'maxbeds'] = opts[:'maxbeds'] if opts[:'maxbeds']\n query_params[:'maxdom'] = opts[:'maxdom'] if opts[:'maxdom']\n query_params[:'minyear'] = opts[:'minyear'] if opts[:'minyear']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'vendor'] = opts[:'vendor'] if opts[:'vendor']\n query_params[:'postalCodes'] = @api_client.build_collection_param(opts[:'postal_codes'], :multi) if opts[:'postal_codes']\n query_params[:'features'] = @api_client.build_collection_param(opts[:'features'], :multi) if opts[:'features']\n query_params[:'water'] = opts[:'water'] if opts[:'water']\n query_params[:'neighborhoods'] = @api_client.build_collection_param(opts[:'neighborhoods'], :multi) if opts[:'neighborhoods']\n query_params[:'cities'] = @api_client.build_collection_param(opts[:'cities'], :multi) if opts[:'cities']\n query_params[:'counties'] = @api_client.build_collection_param(opts[:'counties'], :multi) if opts[:'counties']\n query_params[:'points'] = @api_client.build_collection_param(opts[:'points'], :multi) if opts[:'points']\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :multi) if opts[:'include']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/vnd.simplyrets-v0.1+json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Listing>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#properties_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d02891af02fc92b3c098adc4f807018a", "score": "0.46275795", "text": "def fe_uncond esname, currentdb\n currentes = currentdb.hes[esname]\n keyattribnames = currentes.keyattribnames\n nonkeyattribnames = currentes.nonkeyattribnames\n \n currentes.hashofentities.each_pair{|key, value|\n puts 'Entity key: ' + key\n # puts 'Entity: ' + value.inspect\n }\n\n\nend", "title": "" }, { "docid": "9a60b23a06b65f93ea2293b531872959", "score": "0.46256226", "text": "def get_properties(uuid, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(uuid, opts)\n data\n end", "title": "" }, { "docid": "f5eb111f893b18a42dfa059c0f009b1f", "score": "0.4618942", "text": "def properties\n keys = @_properties.keys\n ret = []\n\n # example element, if there is one\n if @define\n @_properties['emptyElement'] = %($sel(\"#resources? .#{@item_id}:1:1\"))\n ret << _partial_properties(['emptyElement'])\n end\n\n # outlets first\n if keys.include?('outlets')\n outlets = @_properties['outlets']\n @_properties['outlets'] = '[\"' + (outlets * '\",\"') + '\"]'\n ret << _partial_properties(['outlets'])\n ret << _partial_properties(outlets,\",\\n\\n\")\n keys.reject! { |k| outlets.include?(k) || (k == 'outlets') }\n end\n\n bindings = keys.reject { |k| !k.match(/Binding$/) }\n if bindings.size > 0\n ret << _partial_properties(bindings)\n keys.reject! { |k| bindings.include?(k) }\n end\n\n if keys.size > 0\n ret << _partial_properties(keys)\n end\n\n ret = ret * \",\\n\\n\"\n ' ' + ret.gsub(\"\\n\",\"\\n \")\n end", "title": "" }, { "docid": "d7379dc39e5e5fe8a95e16bf8f08315a", "score": "0.46174192", "text": "def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end", "title": "" }, { "docid": "82adc80f83f9fef03d5f7c53c0e21586", "score": "0.4595329", "text": "def get_properties\n instance_methods.each_with_object([]) { |key, acc| acc << key.to_s.gsub(/=$/, '') if key.match(/\\w=$/) }\n end", "title": "" }, { "docid": "06e33b20218e4016261e4a716118c535", "score": "0.4594733", "text": "def property(name)\n @property_hash[name]\n end", "title": "" }, { "docid": "9c68cf270dedfc2508d58030e080f46b", "score": "0.45938328", "text": "def get_template_property_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TemplatesPropertiesApi.get_template_property_types ...\"\n end\n # resource path\n local_var_path = \"/templates/properties\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<PropertyFieldListResource>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesPropertiesApi#get_template_property_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
b77754cb160de006efa0432656783ec5
Crawls hash for all the request parameters and adds namespace reference for the keys. Args: args: Hash element of subtree of request parameters. Returns: Modified Hash with all keys updated and all values crawled.
[ { "docid": "c787eade7f698b8a2d4e8644a9182361", "score": "0.71428347", "text": "def prepare_hash_args(args)\n res = {}\n args.each do |key, value|\n res[prepend_namespace(key)] = prepare_args(value)\n end\n return res\n end", "title": "" } ]
[ { "docid": "b5398fe2c07b6928a6beec10ea2cbaae", "score": "0.6117563", "text": "def build_hash(args)\n define_method(:hash) do\n args.map { |arg| instance_variable_get(\"@#{arg}\") }.unshift(self.class).hash\n end\n end", "title": "" }, { "docid": "65ad46c6e1990f2c88fe23a2379adc31", "score": "0.60866636", "text": "def prepare_method_arg_hash(args)\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end", "title": "" }, { "docid": "78b3c6f31bbcb1187cc90363d70b5b0b", "score": "0.5844098", "text": "def compute_hash(args = {})\n args.stringify_keys!\n return nil unless args.include?('just_hash')\n args.delete('just_hash')\n url = args['url'].kind_of?(URI) ? args['url'].path : args['url']\n args.delete('url')\n spl = url.split '/'\n ret = (spl[-2] + '/' + spl[-1]) + ':'\n args.delete_if { |k,v| (v || \"\").to_s.length == 0 } # Delete keys if the value is nil\n h = args.stringify_keys\n ret += h.sort.flatten.collect{ |e| e.to_s }.join(':')\n ret.gsub(/:$/,'')\n end", "title": "" }, { "docid": "4acac3c65de03dcb306062d2a2363bc0", "score": "0.58013284", "text": "def %(args)\n raise \"non-array arg to %\" unless args.is_a?(Array)\n\n engine.eval_to_hash(node, args, cloned_params)\n end", "title": "" }, { "docid": "d1fc5ac659dd34d4c7a094844c666280", "score": "0.5746378", "text": "def hash_including(*args); end", "title": "" }, { "docid": "d1fc5ac659dd34d4c7a094844c666280", "score": "0.5746378", "text": "def hash_including(*args); end", "title": "" }, { "docid": "d1fc5ac659dd34d4c7a094844c666280", "score": "0.57458055", "text": "def hash_including(*args); end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.56491154", "text": "def hash_args; end", "title": "" }, { "docid": "6614bbecf53a9eb504aaaf298b74111b", "score": "0.56096053", "text": "def to_post_args\n args = {}\n\n # add namespace defs to the output\n @namespaces.each { |ns_uri, ns_alias|\n if @namespaces.implicit?(ns_uri)\n next\n end\n if ns_alias == NULL_NAMESPACE\n ns_key = 'openid.ns'\n else\n ns_key = 'openid.ns.' + ns_alias\n end\n args[ns_key] = ns_uri\n }\n\n @args.each { |k, value|\n ns_uri, ns_key = k\n key = get_key(ns_uri, ns_key)\n args[key] = value\n }\n\n return args\n end", "title": "" }, { "docid": "e22f2aaf0fc4b1d54ec2c0349d7984b4", "score": "0.560199", "text": "def args_hash\n {\n declared_namespaces: @declared_namespaces,\n declared_variables: @declared_variables,\n default_collation: @default_collation\n }\n end", "title": "" }, { "docid": "5ab025908264fdd2f7f400b39b1539ee", "score": "0.5577505", "text": "def update_args(namespace, updates); end", "title": "" }, { "docid": "bc1f2b026caf4c90fd679f4e649e4944", "score": "0.5511321", "text": "def hash_argument(args)\n return {} if args.length == 0\n return args.first if args.length == 1 && args.first.is_a?(Hash)\n\n order = [:sample_rate, :tags]\n hash = {}\n args.each_with_index do |value, index|\n hash[order[index]] = value\n end\n\n return hash\n end", "title": "" }, { "docid": "76218bf1e88e1362ae478a36b43db2f2", "score": "0.54938734", "text": "def update_args(namespace, updates)\n namespace = _fix_ns(namespace)\n updates.each {|k,v| set_arg(namespace, k, v)}\n end", "title": "" }, { "docid": "0f2c8ae33682d9d7a38485c8206596b4", "score": "0.54880863", "text": "def key_values_from_args(*args)\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n [key_values, args]\n end", "title": "" }, { "docid": "6e66a19ca1fa66615d8f37ba105fc2c3", "score": "0.54779345", "text": "def args_hash\n check_for_clashing_parameters!\n {\n default_collation: @default_collation,\n static_parameters: @static_parameters,\n global_parameters: @global_parameters,\n initial_template_parameters: @initial_template_parameters,\n initial_template_tunnel_parameters: @initial_template_tunnel_parameters\n }\n end", "title": "" }, { "docid": "d220f79a2f18efa1408d940d80ef22ed", "score": "0.5419296", "text": "def update!(**args)\n @prefix_size = args[:prefix_size] if args.key?(:prefix_size)\n @raw_hashes = args[:raw_hashes] if args.key?(:raw_hashes)\n end", "title": "" }, { "docid": "85df21d1c5f712e48e543558059c6743", "score": "0.53852236", "text": "def hash(*args, &block)\n append_macro(Macros::Hash) do |macro|\n macro.call(*args, &block)\n end\n end", "title": "" }, { "docid": "f6ee908f434b4837e9597b311b370cd6", "score": "0.5368568", "text": "def parsed_args(args)\n args.inject({}) do |memo, method|\n memo.merge(method.is_a?(Hash) ? method : { method => nil })\n end\n end", "title": "" }, { "docid": "2f92c7717d325564cefc2a6dae745d53", "score": "0.5367163", "text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @namespace = args[:namespace] if args.key?(:namespace)\n @value = args[:value] if args.key?(:value)\n end", "title": "" }, { "docid": "950ac1257d0e9b1d8d05df075ec061e5", "score": "0.53611666", "text": "def append_get_vars(url, args)\n if url[-1, 1] != '?' then\n url[-1, 1] << '?'\n end\n\n args.each do |k, v|\n # TODO\n # find way to recursively dive into a hash and build a url\n if not k.instance_of? Hash\n url << '&' << k.to_s << '=' << v.to_s\n end\n end\n\n url\nend", "title": "" }, { "docid": "1caec7c34bc17d22ef2e309d135dff36", "score": "0.5334471", "text": "def append_hash(prefix, hash)\n process_params(hash, prefix)\n end", "title": "" }, { "docid": "6ff57b6d1c20b4d26feb5ce764b8e554", "score": "0.53326434", "text": "def to_hash(args = {}) # :nodoc:\n args ||= {}\n\n if args[:nested]\n {'url' => self[:@url] || self[:url]}\n else\n hash = super\n hash.merge!('@version' => self['@version']) unless new_record?\n {self.class.json_name => hash}\n end\n end", "title": "" }, { "docid": "872d87227dc4db33d2b07cfa80ef9e6d", "score": "0.528645", "text": "def update!(**args)\n @collection_ids = args[:collection_ids] if args.key?(:collection_ids)\n @input_uri_prefix = args[:input_uri_prefix] if args.key?(:input_uri_prefix)\n @namespace_ids = args[:namespace_ids] if args.key?(:namespace_ids)\n end", "title": "" }, { "docid": "6c365e176a044be3abc9e1bc49a79cda", "score": "0.52694523", "text": "def prepare_args(args, endpointkey)\n raise \"unknown endpoint: #{endpointkey}\" unless endpointkey == 'event' || endpointkey == 'uniq'\n hash = { endpointkey => {} }\n\n params = self.send(\"#{endpointkey}_params\")\n args.each_pair do |key,value|\n if params.include?(key.to_s)\n hash[endpointkey][key.to_s] = value\n end\n end\n check_post_hash(hash) \n hash\n end", "title": "" }, { "docid": "087f75cc58442cceada8d4d5fb0f04e6", "score": "0.5241357", "text": "def update!(**args)\n @uri_prefix = args[:uri_prefix] if args.key?(:uri_prefix)\n end", "title": "" }, { "docid": "23ab1df1505266ecffe862cd6366c6b0", "score": "0.5225175", "text": "def a_hash_including(*args, &block); end", "title": "" }, { "docid": "339316b1a0709482fb6c61e0c9fce92a", "score": "0.5195927", "text": "def hash( name, *args, &block )\n param( name, *args, hash: true, &block )\n end", "title": "" }, { "docid": "885a21c70fad5a7d9b672ff0958d18c5", "score": "0.5187197", "text": "def build_params args, params\n (keys, params_without_keys) = params.partition{ |(p, k)| p == :key }\n params = params_without_keys.map{ |(p, k)| args[k] }.compact\n hash = keys.map(&:reverse).map{ |(k, *)| [k, args[k]] }\n hash = hash.select{ |(k, v)| !k.blank? && !v.blank?}.to_h\n\n should_have_more = params.any?{ |(p, *)| p == :rest}\n rest = args.select{ |(k, v)| !params.any?{ |(p, v)| k == v } } if should_have_more\n\n return params + [hash] if !should_have_more\n return params + [rest]\n\n end", "title": "" }, { "docid": "de2b7c0d8ed49a2b44f9a91d33d45634", "score": "0.51871663", "text": "def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "title": "" }, { "docid": "de2b7c0d8ed49a2b44f9a91d33d45634", "score": "0.51871663", "text": "def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "title": "" }, { "docid": "de2b7c0d8ed49a2b44f9a91d33d45634", "score": "0.51871663", "text": "def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "title": "" }, { "docid": "cbdb9a3a64527be47744e519730801d7", "score": "0.51642895", "text": "def update!(**args)\n @nonce = args[:nonce] if args.key?(:nonce)\n @request_hash = args[:request_hash] if args.key?(:request_hash)\n @request_package_name = args[:request_package_name] if args.key?(:request_package_name)\n @timestamp_millis = args[:timestamp_millis] if args.key?(:timestamp_millis)\n end", "title": "" }, { "docid": "8ee8587ff91d6bac266c4fa043dcb7e8", "score": "0.5161948", "text": "def update!(**args)\n @collection_ids = args[:collection_ids] if args.key?(:collection_ids)\n @namespace_ids = args[:namespace_ids] if args.key?(:namespace_ids)\n @output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)\n @snapshot_time = args[:snapshot_time] if args.key?(:snapshot_time)\n end", "title": "" }, { "docid": "ce6c36520e7a144fbbfb86d18b62909b", "score": "0.5159047", "text": "def addargs(*args)\n ## Add all additional arguments to the request sentence list:\n args.each do |arg|\n if arg.is_a?(Hash)\n ## Prepend argument keys that don't begin with the API-\n ## command-specific parameter character '.', nor the\n ## normal parameter charactre '=', nor the query character\n ## '?' with the ordinary parameter character '=':\n arg.each do |key, value|\n key = '=' + key unless /^[\\?\\=\\.]/.match(key)\n addarg(key + '=' + value)\n end\n else\n addarg(arg)\n end\n end\n end", "title": "" }, { "docid": "e522402fbf9e06da2630896b04f97cb7", "score": "0.5158299", "text": "def update!(**args)\n @algorithm = args[:algorithm] if args.key?(:algorithm)\n @digest = args[:digest] if args.key?(:digest)\n @digest_type = args[:digest_type] if args.key?(:digest_type)\n @key_tag = args[:key_tag] if args.key?(:key_tag)\n end", "title": "" }, { "docid": "a539417e795578fa0ce633f2fce41920", "score": "0.51483613", "text": "def build_keyword_arguments(args)\n @keyword_names ||= parameters.select(&:keyword?).map(&:name).map(&:to_s)\n\n keys = @keyword_names & args.keys\n values = args.fetch_values(*keys)\n\n # Note that +keys+ now only contains names of keyword arguments that actually exist.\n # This is therefore not a way to DOS this process.\n keys.map(&:to_sym).zip(values).to_h\n end", "title": "" }, { "docid": "6862868c8f2c8a56abe6afc9d8b953d2", "score": "0.5139748", "text": "def process_hash_merge! hash, args\n hash = hash.deep_clone\n hash_iterate args do |key, replacement|\n hash_insert hash, key, replacement\n match = Sexp.new(:call, hash, :[], key)\n env[match] = replacement\n end\n hash\n end", "title": "" }, { "docid": "52d4439c31f487fa6df62c845f8bbfec", "score": "0.51347727", "text": "def set(args)\n args.each {|key, value| @args[key] = value}\n self\n end", "title": "" }, { "docid": "504bf731682a54d5fa03e780f9be350e", "score": "0.5131939", "text": "def update!(**args)\n @namespaced_names = args[:namespaced_names] if args.key?(:namespaced_names)\n end", "title": "" }, { "docid": "16f6c6c5dbb368b50472a704e8b75516", "score": "0.51308143", "text": "def update!(**args)\n @histogram_buckets = args[:histogram_buckets] if args.key?(:histogram_buckets)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "16f6c6c5dbb368b50472a704e8b75516", "score": "0.51308143", "text": "def update!(**args)\n @histogram_buckets = args[:histogram_buckets] if args.key?(:histogram_buckets)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "73515b8c1dec58eea9fb0e77b3efefc9", "score": "0.51239944", "text": "def update!(**args)\n @all_namespaces = args[:all_namespaces] if args.key?(:all_namespaces)\n @encryption_key = args[:encryption_key] if args.key?(:encryption_key)\n @include_secrets = args[:include_secrets] if args.key?(:include_secrets)\n @include_volume_data = args[:include_volume_data] if args.key?(:include_volume_data)\n @selected_applications = args[:selected_applications] if args.key?(:selected_applications)\n @selected_namespaces = args[:selected_namespaces] if args.key?(:selected_namespaces)\n end", "title": "" }, { "docid": "7fc686cdd6004cb8ad0471ae042aed65", "score": "0.51183385", "text": "def args_to_hash(*args)\n # The first argument may be a hash, if it is use it as-is\n # { :controller => 'admin', :action => 'index' }\n #\n if Hash === args[0]\n return args[0]\n end\n\n # The first argument is a url or path, ie:\n # http://something.com/controller/action\n # /controller/action....\n #\n if String === args[0]\n path = args[0]\n\n # If the path has a domain name and protocol\n # strip it off.\n if (!path.index('//').nil?)\n offset = path.index('/', path.index('//')+2)\n path = path[offset, path.length]\n end\n \n # Pull the HTTP method from the arguments, use :get\n # if none is found (for RESTful routes)\n method = (args[1] && args[1][:method]) || :get\n\n # generate a hash with controller, action, any id\n # to use for looking up permissions\n return ActionController::Routing::Routes.recognize_path(path, :method => method)\n end\n\n # If all else fails return an empty hash\n return {}\n end", "title": "" }, { "docid": "56590b6b8d0e6fec3a4b90b59ea536d0", "score": "0.5087667", "text": "def +(args)\n raise \"bad arg to %\" unless args.is_a?(Hash)\n\n NodeCall.new(_e, engine, node, params.merge(args))\n end", "title": "" }, { "docid": "895e7b6f0e05322daac7f494d877eeeb", "score": "0.5081603", "text": "def get_args(namespace)\n namespace = _fix_ns(namespace)\n args = {}\n @args.each { |k,v|\n pair_ns, ns_key = k\n args[ns_key] = v if pair_ns == namespace\n }\n return args\n end", "title": "" }, { "docid": "27ac01df3ceda01d600ad19d46008757", "score": "0.5080659", "text": "def hash!( name, *args, &block )\n param!( name, *args, hash: true, &block )\n end", "title": "" }, { "docid": "0f7defd703498de0a82eed46bb341297", "score": "0.5079214", "text": "def parse_args()\n args = []\n @doc.xpath('/Response/header:Header/Args/Arg', @namespaces).each do |a|\n args << Arg.new(a['key'],\n a['value'],\n a.content)\n end\n\n @result_item.args = args\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "3109c63f9a9bd83e0698c10772686585", "score": "0.5070401", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "title": "" }, { "docid": "c71d5caeb16a34d2a413af4a1b7cd776", "score": "0.504604", "text": "def update!(**args)\n @dns_keys = args[:dns_keys] if args.key?(:dns_keys)\n @header = args[:header] if args.key?(:header)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" }, { "docid": "c71d5caeb16a34d2a413af4a1b7cd776", "score": "0.504604", "text": "def update!(**args)\n @dns_keys = args[:dns_keys] if args.key?(:dns_keys)\n @header = args[:header] if args.key?(:header)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" }, { "docid": "c71d5caeb16a34d2a413af4a1b7cd776", "score": "0.504604", "text": "def update!(**args)\n @dns_keys = args[:dns_keys] if args.key?(:dns_keys)\n @header = args[:header] if args.key?(:header)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" }, { "docid": "c905d412790aa94650bbd5bdebbf2720", "score": "0.5033737", "text": "def update!(**args)\n @digest = args[:digest] if args.key?(:digest)\n @is_executable = args[:is_executable] if args.key?(:is_executable)\n @name = args[:name] if args.key?(:name)\n @node_properties = args[:node_properties] if args.key?(:node_properties)\n end", "title": "" }, { "docid": "4ca2248ef0ad8a6c9bec3fee383e7cb9", "score": "0.5032224", "text": "def expand **args\n eh = Hash.new\n self.dup.each do |k,v|\n eh.bridge k, args.merge({value:v})\n end\n return eh\n end", "title": "" }, { "docid": "4ca2248ef0ad8a6c9bec3fee383e7cb9", "score": "0.5032224", "text": "def expand **args\n eh = Hash.new\n self.dup.each do |k,v|\n eh.bridge k, args.merge({value:v})\n end\n return eh\n end", "title": "" }, { "docid": "969810990112fce31d79e424d01d5e74", "score": "0.50298357", "text": "def update!(**args)\n @hash_md5 = args[:hash_md5] if args.key?(:hash_md5)\n @hash_sha1 = args[:hash_sha1] if args.key?(:hash_sha1)\n @hash_sha256 = args[:hash_sha256] if args.key?(:hash_sha256)\n end", "title": "" }, { "docid": "6eb2a7d9aa952eecaa6beddae9513a56", "score": "0.5025307", "text": "def build(args = {})\n @heads ||= {}\n\n args.to_h.each do |(key, value)|\n @heads[key] = value\n end\n\n self\n end", "title": "" }, { "docid": "fa36a9b889c98cebc72b7c7ef99ac1d9", "score": "0.50139076", "text": "def on_hash(assoclist_from_args)\n beging = find_scanner_event(:@lbrace)\n ending = find_scanner_event(:@rbrace)\n\n if assoclist_from_args\n # Here we're going to expand out the location information for the assocs\n # node so that it can grab up any remaining comments inside the hash.\n assoclist_from_args.merge!(sc: beging[:ec], ec: ending[:sc])\n end\n\n {\n type: :hash,\n body: [assoclist_from_args],\n sl: beging[:sl],\n sc: beging[:sc],\n el: ending[:el],\n ec: ending[:ec]\n }\n end", "title": "" }, { "docid": "42368c6534b50402c0af66c29cfd11be", "score": "0.50080454", "text": "def args_hash(*args)\n # calculate hash and take care of IO objects, hashes, ...\n md5 = Digest::MD5.new\n args.each do |arg|\n case arg\n when File\n File.open(arg, 'rb') { |io| digest_io_update(md5, io) }\n when Data, IO, Tempfile\n digest_io_update(md5, arg)\n else\n md5.update(arg.to_s)\n end\n end\n # update with the test name, so that failing tests do not influence others\n md5.update(@example_group_name)\n md5.hexdigest\n end", "title": "" }, { "docid": "370cd07368cde294059cf28fc0e89cef", "score": "0.5007383", "text": "def set_attributes(args)\n total = args[:result]['paging']['total'] ? args[:result]['paging']['total'].to_i : 0\n # \"paging\"=>{\"offset\"=>0, \"count\"=>100, \"total\"=>886}\n attributes = Hash.new\n attributes[:totalResults] = total\n attributes[:code] = '200'\n attributes[:msg] = \"OK\"\n attributes[:page] = args[:page]\n attributes[:last] = total / args[:page_size]\n attributes[:key] = args[:keywords]\n attributes[:jobs] = parse_raw_data(args[:result])\n OpenStruct.new(attributes)\n end", "title": "" }, { "docid": "71ad603aee5be1e9fdf1d4f6efd4d3a6", "score": "0.5007295", "text": "def prepare_request_headers(args = {})\n merged_args = {\n http_method: nil,\n host: nil,\n id: nil,\n path_info: '/',\n query_string: '',\n body: '',\n content_type: '',\n headers: {},\n body_hash: nil,\n version: VERSION,\n }.merge(args)\n # Replace args so that the calling method gets all the values.\n args.replace(merged_args)\n args[:timestamp] ||= Time.now.to_i.to_s\n args[:nonce] ||= SecureRandom.uuid\n\n headers = {}\n headers['X-Authorization-Timestamp'] = args[:timestamp]\n unless args[:body].nil? || (args[:body].length == 0)\n args[:body_hash] = Base64.strict_encode64(OpenSSL::Digest::SHA256.digest(args[:body]))\n headers['X-Authorization-Content-SHA256'] = args[:body_hash]\n end\n # Discourage intermediate proxies from altering the content.\n headers['Cache-Control'] = 'no-transform'\n base_string = prepare_base_string(args)\n\n authorization = []\n authorization << \"acquia-http-hmac realm=\\\"#{Addressable::URI.escape(@realm)}\\\"\"\n authorization << \"id=\\\"#{Addressable::URI.escape(args[:id])}\\\"\"\n authorization << \"nonce=\\\"#{args[:nonce]}\\\"\"\n authorization << \"version=\\\"#{VERSION}\\\"\"\n authorization << \"headers=\\\"#{args[:headers].keys.join(';')}\\\"\"\n authorization << \"signature=\\\"#{signature(base_string)}\\\"\"\n headers['Authorization'] = authorization.join(',')\n headers\n end", "title": "" }, { "docid": "a25e7d8694a36b2fd38e30e8b1eb4553", "score": "0.50035393", "text": "def update!(**args)\n @hash_algorithm = args[:hash_algorithm] unless args[:hash_algorithm].nil?\n @memory_cost = args[:memory_cost] unless args[:memory_cost].nil?\n @rounds = args[:rounds] unless args[:rounds].nil?\n @salt_separator = args[:salt_separator] unless args[:salt_separator].nil?\n @signer_key = args[:signer_key] unless args[:signer_key].nil?\n @users = args[:users] unless args[:users].nil?\n end", "title": "" }, { "docid": "17fcdcb128944e7ca236acf788edf377", "score": "0.49998242", "text": "def arg_spec_hash args\n HashArgSpec.new args\n end", "title": "" }, { "docid": "bed7c64c80fb04c2c39c70efc5a5e731", "score": "0.49892446", "text": "def get_node_attributes(args)\n args.detect { |arg| arg.is_a? Hash } || {}\n end", "title": "" }, { "docid": "e50767acf2901ac234bc7d9ba2e164da", "score": "0.49819934", "text": "def process_hash_merge hash, args\n hash = hash.deep_clone\n hash_iterate args do |key, replacement|\n hash_insert hash, key, replacement\n end\n hash\n end", "title": "" }, { "docid": "22440c75167467fbb5cc14650c4c42a2", "score": "0.49767604", "text": "def initialize(*args, &block)\n @search_scores = {}\n if args.first.is_a?(Hash)\n merge!(args.first)\n else\n self.class.members.zip(args) do |k,v|\n send(\"#{k}=\", v)\n end\n end\n block.call(@search_scores) if block\n end", "title": "" }, { "docid": "a076b922454a6957f530f61ecc7d1494", "score": "0.4975551", "text": "def append(key, *args)\n\n # If this is called but we've already fetched data, reset\n if @ran\n reset\n end\n\n @request_keys << key\n\n if args\n if args.is_a? Array\n args = args.flatten\n end\n args.each do |arg|\n if arg\n a = arg\n if a.is_a? Hash\n # Merge this hash on top of the existing options\n @options.merge!(a)\n else\n # This is an ID or search term, add it directly to the\n # list of keys\n @request_keys << a.to_s\n end\n end\n end\n end\n end", "title": "" }, { "docid": "9b9d2adb028d9d0118795fe654eb1874", "score": "0.4971699", "text": "def to_hash( *args )\n h = {}\n args = [ args ].flatten\n args = STATS if args.empty?\n args.each do |meth|\n h[meth] = self.send( meth )\n end\n return h\n end", "title": "" }, { "docid": "e6225ffc7cbbe52e59dfbd0c03662fa0", "score": "0.49683577", "text": "def hash\n\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "e6225ffc7cbbe52e59dfbd0c03662fa0", "score": "0.49683577", "text": "def hash\n\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "4453d537c778fe28b3f48b6a0136fa73", "score": "0.49662822", "text": "def argmap\n Init()\n deep_copy(@args)\n end", "title": "" }, { "docid": "b0915279b378609a57f44d966be2a7c8", "score": "0.49653986", "text": "def format_query_args(args)\n new_args = {}\n args.each do |k, v|\n k = k.to_sym\n case v\n when Hash\n new_args[k] = format_query_args(v)\n when Array\n v = v.map{|obj| format_query_type(obj)}\n new_args[k] = v.size == 1 ? v.first : v\n else\n new_args[k] = format_query_type(v)\n end\n end\n new_args.to_smash\n end", "title": "" }, { "docid": "8f04d22dd71f2480bb94de2277e45a7e", "score": "0.49560392", "text": "def update!(**args)\n @md5checksums = args[:md5checksums] if args.key?(:md5checksums)\n @accessions = args[:accessions] if args.key?(:accessions)\n @assembly_id = args[:assembly_id] if args.key?(:assembly_id)\n @page_token = args[:page_token] if args.key?(:page_token)\n @page_size = args[:page_size] if args.key?(:page_size)\n end", "title": "" }, { "docid": "aef41c28406d3b709ed53b8f21ffe4be", "score": "0.49465317", "text": "def initialize(args={}, level=0)\n\t\traise ArgumentError, \"Please pass a Hash-like object\" unless args.respond_to?(:each_pair)\n\t\traise RuntimeError, \"Maximal depth reached\" if level > MAX_DEPTH\n\n\t\t@depth = level\n\t\t@attributes = {}\n\t\targs.each_pair do |key, value|\n\t\t\tassign_value(key, value)\n\t\tend\n\tend", "title": "" }, { "docid": "f16a6e008b265a988619427a68f20233", "score": "0.49365547", "text": "def merge_args_from_body(args = params, options = { })\n normalize_incoming_hash = options.fetch(:normalize_incoming_hash, true)\n _args = normalize_incoming_hash ? normalize_arguments_hash_keys(args) : args.dup\n\n if request.media_type == 'application/json'\n request.body.rewind\n body_contents = request.body.read\n logger.debug { \"Parsing: '#{body_contents}'\" }\n if body_contents\n json_args = JSON.parse(body_contents)\n if json_args.is_a?(Hash)\n #json_params = indifferent_hash.merge(json_params)\n _args = normalize_arguments_hash_keys(json_args).merge(_args)\n else\n _args['body'] = json_args\n end\n end\n _args\n end\n\n _args\n end", "title": "" }, { "docid": "7ab568d90a6e05eb6ca88ff45b3540a4", "score": "0.4935398", "text": "def initialize(*args, &block)\n @search_results = [] \n if args.first.is_a?(Hash)\n merge!(args.first)\n else\n self.class.members.zip(args) do |k,v|\n send(\"#{k}=\", v)\n end\n end\n block.call(@search_results) if block\n end", "title": "" }, { "docid": "14cd0d0e1fdb1854f5c2c4ed114b0aa0", "score": "0.49342242", "text": "def update!(**args)\n @md5checksums = args[:md5checksums] if args.key?(:md5checksums)\n @accessions = args[:accessions] if args.key?(:accessions)\n @page_token = args[:page_token] if args.key?(:page_token)\n @page_size = args[:page_size] if args.key?(:page_size)\n @assembly_id = args[:assembly_id] if args.key?(:assembly_id)\n end", "title": "" }, { "docid": "6f21afd51fb148ca017dae68c085810b", "score": "0.4930176", "text": "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" }, { "docid": "5e2fd55b372f7191c1c8613870f767b1", "score": "0.49293706", "text": "def ohash(*args)\n if RUBY_VERSION < \"1.9\"\n ActiveSupport::OrderedHash.new.tap do |ordered_hash|\n args.each_slice(2) do |key,value|\n ordered_hash[key] = value\n end\n end\n else\n Hash[*args]\n end\nend", "title": "" }, { "docid": "71fb4f62b60ac480ceba1351a1e9bef2", "score": "0.49176925", "text": "def update!(**args)\n @sha256_checksum = args[:sha256_checksum] if args.key?(:sha256_checksum)\n @uri = args[:uri] if args.key?(:uri)\n end", "title": "" }, { "docid": "3c1fc9842fbc6d6cf1c3c8f2616fb1d1", "score": "0.49165332", "text": "def update!(**args)\n @output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)\n end", "title": "" }, { "docid": "3c1fc9842fbc6d6cf1c3c8f2616fb1d1", "score": "0.49165332", "text": "def update!(**args)\n @output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)\n end", "title": "" }, { "docid": "3c1fc9842fbc6d6cf1c3c8f2616fb1d1", "score": "0.49165332", "text": "def update!(**args)\n @output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)\n end", "title": "" }, { "docid": "f2a2dffc753bc2dbe365e503a832e422", "score": "0.49139315", "text": "def increment_namespace!(*args)\n # unset local cache of current_namespaces\n @current_namespaces = {}\n # add 1 to the value in cache\n val = (Rails.cache.read(namespace_key(args.first)) || 0) + 1\n Rails.cache.write(namespace_key(args.first),val)\n val\n end", "title": "" }, { "docid": "f629aa65d10701e17403753fffcdfe42", "score": "0.49118102", "text": "def construct_request_hash; end", "title": "" }, { "docid": "a1118f1e6c3d8a831f721db9c980d09e", "score": "0.4911634", "text": "def initialize args=[]\n @args = args\n @keys = {}\n @required = Set.new\n @docs = []\n end", "title": "" }, { "docid": "a5f1deb3318e4574b7470dc9ff505887", "score": "0.4911485", "text": "def update!(**args)\n @md5checksums = args[:md5checksums] if args.key?(:md5checksums)\n @accessions = args[:accessions] if args.key?(:accessions)\n @page_token = args[:page_token] if args.key?(:page_token)\n @reference_set_id = args[:reference_set_id] if args.key?(:reference_set_id)\n @page_size = args[:page_size] if args.key?(:page_size)\n end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.49103883", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.49103883", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.49103883", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "c9bf5d6a23c9e95108e9b4390c4581c0", "score": "0.49031577", "text": "def hash_from_cgi\n values = Hash.new(\"\")\n @cgi.keys.each {|k| values[k] = @cgi[k]}\n values\n end", "title": "" } ]
7054e3289aec3a30e19b91bdbb84e088
GET /students/new GET /students/new.json
[ { "docid": "f31ea40029e0d71047eae194d5eaf452", "score": "0.71248436", "text": "def new\n @student = Student.new(ms_year: Time.now.year, phd_year: Time.now.year, status: \"Current student\")\n @student.build_default_qualifier\n @student.committees.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" } ]
[ { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022949", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "4e668af36a24c1261d41361896c01e77", "score": "0.8022768", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "dd7013e9251d9a09c12a10d4b91b4816", "score": "0.7951791", "text": "def new\n @title = \"Create Student Account\"\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "2ceee0a5cda4aee10ada5e704f214a8b", "score": "0.79333663", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "2ceee0a5cda4aee10ada5e704f214a8b", "score": "0.79333663", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "2ceee0a5cda4aee10ada5e704f214a8b", "score": "0.79333663", "text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "2fadc3804954361feb82226d441887e8", "score": "0.78505456", "text": "def new\n @re_st = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @re_st }\n end\n end", "title": "" }, { "docid": "95095994e8424c76177f7263070ee3a5", "score": "0.76048076", "text": "def new\n @student_list = StudentList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_list }\n end\n end", "title": "" }, { "docid": "c8a6314d93e288b4d7b0d819fbc8858b", "score": "0.75818783", "text": "def new\n @student_record = StudentRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_record }\n end\n end", "title": "" }, { "docid": "45ec8c24ec588c5712b5b3504559f1cb", "score": "0.7555462", "text": "def new\n @studentrec = Studentrec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentrec }\n end\n end", "title": "" }, { "docid": "c516926cd50b6859c7e6440b1d54a27f", "score": "0.7528511", "text": "def new\n @student = Student.new\n @student.build_person\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "2befafcc6f076a73b42fca9ccbe2e9dc", "score": "0.75128704", "text": "def create\n require 'net/http'\n require 'json'\n\n student = Student.new(student_params)\n\n uri = URI('http://localhost:3000/students.json')\n\n request = Net::HTTP::Post.new uri, { 'Content-Type' => 'application/json' }\n # Appending the data to the request.\n request.body = student.to_json\n\n # Hitting the endpoint.\n response = Net::HTTP.start uri.hostname, uri.port do |http|\n http.request request\n end\n\n # If successful.\n if response.code == '200'\n redirect_to students_path, notice: 'Student was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "26a9166713847fab13421db6503d1ebe", "score": "0.7511044", "text": "def new\n @student = Student.new\n @institutes = Institute.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "c68f0f178df4d261a1d22549edb4cfb7", "score": "0.74975264", "text": "def new\n @student = Student.new\n @course = Course.find_by_id(session[:course_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "b1d02b3c10c748c09ac0b1c445b26d57", "score": "0.7473355", "text": "def new\n @student_profile = StudentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_profile }\n end\n end", "title": "" }, { "docid": "489f50fab84cb7756de68ffb89e43d51", "score": "0.74536246", "text": "def new\n @student = Student.new\n @data = params[:data]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "77378d883065e8946a90af7a8ce4a75c", "score": "0.7433035", "text": "def create_new_student\n @student = Student.new\n\n respond_to do |format|\n format.html \n end\n end", "title": "" }, { "docid": "5d69a236a9d24d1bb07c9a11725c8e6a", "score": "0.7415633", "text": "def new\n @graduate_student_info = GraduateStudentInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @graduate_student_info }\n end\n end", "title": "" }, { "docid": "068b4c394d27faafad95e8b39e7c2ce8", "score": "0.7371971", "text": "def new\n @studentorg = Studentorg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentorg }\n end\n end", "title": "" }, { "docid": "1e18e4d3553fdeebce81a5c5c0581a77", "score": "0.73025906", "text": "def new\n @student = Student.find(params[:student_id])\n @gradelevel = @student.gradelevels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gradelevel }\n end\n end", "title": "" }, { "docid": "cee795039dac4cc26e1c6abc4b4b095d", "score": "0.7298904", "text": "def new\n @sname = Sname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sname }\n end\n end", "title": "" }, { "docid": "4dc262e1fc05a2d16efa395d9de2d22d", "score": "0.7281672", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e676086c9c7fa6cba32d8205762e8705", "score": "0.7261399", "text": "def new\n @sn = Sn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sn }\n end\n end", "title": "" }, { "docid": "091e29ac045f89349636aac834a4ec17", "score": "0.7237853", "text": "def create\n @student = Student.new(params[:student])\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_path, notice: 'student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00c110650ed085ae58cc72e4aba39b1e", "score": "0.7237388", "text": "def new\n @student = Student.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "title": "" }, { "docid": "16a6086e1a8d26d4ec0348c84c331eaa", "score": "0.7229207", "text": "def new\n @studinfo = Studinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studinfo }\n end\n end", "title": "" }, { "docid": "fb23c4b0d606b0de50c52635d9cc1680", "score": "0.7224752", "text": "def new\n @session = Session.new\n @students = Student.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end", "title": "" }, { "docid": "41c28dc57369ace61c01a408ff89e84f", "score": "0.7192373", "text": "def new\n \n @student_in_course = StudentInCourse.new(:course_ID => params[:course_id], :student_ID => params[:student_ID], \n :course_name => params[:course_name])\n \n @student_in_course.save\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_in_course }\n end\n\n end", "title": "" }, { "docid": "95b24458551572e3c7b73fdd868ea5f1", "score": "0.71923006", "text": "def new\n @positive = Positive.new\n @users = Student.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @positive }\n end\n end", "title": "" }, { "docid": "31c8c5a421b4dbecf26238b1bf18fb49", "score": "0.71922827", "text": "def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end", "title": "" }, { "docid": "6407e690c080ed78688862a6f56d56b4", "score": "0.7181653", "text": "def new\n @student_group = StudentGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_group }\n end\n end", "title": "" }, { "docid": "6407e690c080ed78688862a6f56d56b4", "score": "0.7181653", "text": "def new\n @student_group = StudentGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_group }\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f17dae11e04b96eed58a94509398857", "score": "0.7174396", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08afe58c5fb16889f4468beefea7bbd5", "score": "0.71729636", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13d41e57ab264f5cb17b4a5dbcbea462", "score": "0.71698725", "text": "def create\n student = student.new(student_params)\n\n if student.save\n render json: student, status: :created\n else\n render json: student.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3d5aa9c6b5326d3571d0cf4a2ab2c1f7", "score": "0.7166328", "text": "def new\n @batch = Batch.find(params[:batch_id])\n @student = Student.new()\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "642164cade374f92387eb1bae61a84bf", "score": "0.7158955", "text": "def create\n\t\t@student = Student.create(student_params)\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tformat.html { redirect_to @student, notice: 'Student was successfully created.' }\n\t\t\t\tformat.json { @students = Student.all }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @student.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "66d8e4fb4836ed1e9cca0be7b585d328", "score": "0.7124254", "text": "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n #format.json { render :index, status: :created, location: @student }\n else\n format.html { render :new }\n #format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "669859d650be5eb8dbfbd3949a060354", "score": "0.7123697", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "669859d650be5eb8dbfbd3949a060354", "score": "0.7123697", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "a2c83b1eca253df116f12841af79d750", "score": "0.71199334", "text": "def new\n @class_student_status = ClassStudentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @class_student_status }\n end\n end", "title": "" }, { "docid": "52eb7c8cd0f500e28834ce575abeaad8", "score": "0.71195835", "text": "def new\n @student = Student.new\n @grades = Grade.all\n @languages = Language.all\n @esol_groups = EsolGroup.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "title": "" }, { "docid": "bea1ce63d94cb8e1985db10110f54afd", "score": "0.7115701", "text": "def new\n @lab_course_student = LabCourseStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_course_student }\n end\n end", "title": "" }, { "docid": "c62cbb4572330ee73687f551e18af72e", "score": "0.71131855", "text": "def new\n @school = School.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "f0d2d30f3fb94acd2f2bcac86da7caf6", "score": "0.70940775", "text": "def new\n @student = Student.new\n @siblings = {\"0\" => Hash.new , \"1\" => Hash.new , \"2\" => Hash.new}\n @status = Array.new\n setStatus\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "f0df56e7b0e8f1d682d2d6b9d41aa111", "score": "0.7086692", "text": "def new\n @student = Student.new\n respond_with @student\n end", "title": "" }, { "docid": "f42e913b59b3baae9767a7da0c43a22d", "score": "0.7084046", "text": "def new\n @study_member = StudyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study_member }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "ede0c65a76e19bbc1b9cd3f52a83c354", "score": "0.7082929", "text": "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "7f8ffa4f8eade481cfc9260c97dbc2c4", "score": "0.7080369", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "5a0731d7806de8a7bbd20dda52089bde", "score": "0.7078783", "text": "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to '/students', notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a0731d7806de8a7bbd20dda52089bde", "score": "0.7078783", "text": "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to '/students', notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "008966c8ddb33de8d5b304f2eb56fbda", "score": "0.7070255", "text": "def new\n @bethelstudent = Bethelstudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bethelstudent }\n end\n end", "title": "" }, { "docid": "fd888234d4702e7ab18007bc36f50476", "score": "0.70701236", "text": "def new \n @student = Student.new\n end", "title": "" }, { "docid": "d89d88dcb488b2acf0e3af27a9893512", "score": "0.7069064", "text": "def new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ''}\n end\n end", "title": "" }, { "docid": "c9e1f2d333b88f0d991b768ef8c95c8e", "score": "0.706596", "text": "def create\n @student = Student.new\n @student.name = params[:student][:name]\n @student.save!\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { render :json => @student }\n end\n end", "title": "" }, { "docid": "ec1d39cb9a66ff89ce0a457cb543b177", "score": "0.7062421", "text": "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dae51407b640fcedb95f3284ea07545a", "score": "0.7053898", "text": "def create\n Student.create!(student_params)\n json_response({success: true, message: Message.created_successfuly('Student record')}, :created)\n end", "title": "" }, { "docid": "6283d45aaf7afbcbc675fb251ae08de5", "score": "0.7051677", "text": "def new\n @student = Student.new\n end", "title": "" }, { "docid": "46baac8ee5560d6ee24512a7c9be298c", "score": "0.7043877", "text": "def new\n @student = Student.new\n generate_cp_map\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "title": "" }, { "docid": "b50193666a86900c4f699f2cf2434a5b", "score": "0.70277554", "text": "def new\n @student = Student.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "title": "" }, { "docid": "5044cc3031ca36835fbb953c9639d6fb", "score": "0.70274055", "text": "def new\r\n @student_topic = StudentTopic.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @student_topic }\r\n end\r\n end", "title": "" } ]
4a11a742e71ff910c9ac67f31d7c5835
Update a &39;compute.Board&39; resource.
[ { "docid": "1a4e3960c03db6ffac2ba9a09214ef19", "score": "0.0", "text": "def patch_compute_board_with_http_info(moid, compute_board, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ComputeApi.patch_compute_board ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ComputeApi.patch_compute_board\"\n end\n # verify the required parameter 'compute_board' is set\n if @api_client.config.client_side_validation && compute_board.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_board' when calling ComputeApi.patch_compute_board\"\n end\n # resource path\n local_var_path = '/api/v1/compute/Boards/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(compute_board)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ComputeBoard'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ComputeApi.patch_compute_board\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ComputeApi#patch_compute_board\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "90e1b3bb3e62e360c1a6b63234b85464", "score": "0.6860338", "text": "def update_compute_board(moid, compute_board, opts = {})\n data, _status_code, _headers = update_compute_board_with_http_info(moid, compute_board, opts)\n data\n end", "title": "" }, { "docid": "c271b1a336ab8798fcd735afc126b5a2", "score": "0.66416544", "text": "def update_board(board)\n @game_board = board\n end", "title": "" }, { "docid": "2b0ca9dd051519a66315115e5e658d92", "score": "0.66363853", "text": "def update\n authorize @board\n @board.update!(board_params)\n json_response(@board)\n end", "title": "" }, { "docid": "3b42d3c57a745de9092d7391c538400f", "score": "0.6514322", "text": "def update\n @board = Board.find(params[:id])\n update = {}\n update[:name] = params[:board][:name]\n update[:run_rate_cost] = params[:board][:run_rate_cost]\n\n respond_to do |format|\n if @board.update_attributes(update)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render json: @board }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2233a85c206c4fa8d71376215819b793", "score": "0.64900523", "text": "def update\n if @board.update(board_params)\n render :show, status: :ok\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e05871eb2adb7ac04193b7ba5690ee37", "score": "0.6474011", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcaa53cd1623f941a39d7526a0655707", "score": "0.64652675", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbb6b31b275d375ed5eeffd5d25e125b", "score": "0.6458618", "text": "def update_board\n @board = Board.new game\n end", "title": "" }, { "docid": "38d73a66808e1bbb0edd1900c94a18a3", "score": "0.64572835", "text": "def update\n return\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(@board, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7da9feae20ef25b3e4c8537e53f1283", "score": "0.64437383", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7da9feae20ef25b3e4c8537e53f1283", "score": "0.64437383", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fed7087622b676b664f32c30ed82796d", "score": "0.639339", "text": "def update\r\n\r\n @board = Board.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @board.update_attributes(params[:board])\r\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @board.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "ffddfb54dcb09cdcc4af0af63c1d6d67", "score": "0.6353502", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(@board, :notice => 'Your WhiteBoard was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f150f8f93d88fc4714a550feef87a5b6", "score": "0.62911314", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(root_url, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7031f1fe1f1076e3715a3efe704bbfe5", "score": "0.6287418", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(@board, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7031f1fe1f1076e3715a3efe704bbfe5", "score": "0.6287418", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(@board, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7031f1fe1f1076e3715a3efe704bbfe5", "score": "0.6287418", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(@board, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "108cb8f1733a98f845a26db87cba9c67", "score": "0.62815434", "text": "def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n flash[:notice] = 'Board was successfully updated.'\n format.html { redirect_to board_url(@board) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "00bbeeb0c421ef3dce82955cdf036c4d", "score": "0.6279209", "text": "def update\n @free_board = FreeBoard.find(params[:id])\n\n respond_to do |format|\n if @free_board.update_attributes(params[:free_board])\n format.html { redirect_to @free_board, notice: 'Free board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @free_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af8bf7facb6658bbc57a47afb7ab2efc", "score": "0.627173", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c1d081e65cb0da7c9eaacc796783f6b", "score": "0.624132", "text": "def update\n render json: CommunityBoards.update(params[\"id\"], params[\"community_board\"])\n end", "title": "" }, { "docid": "aa6362d29dcc3d9c1ec185351f741ba0", "score": "0.62302077", "text": "def update_boards\n boards_list = get_filled_boards\n $r.multi do\n boards_list.each do |board|\n $r.sadd(\"board:#{board}\", self.id)\n end\n end\n end", "title": "" }, { "docid": "d83c838334b40daac24f7ce0f670ddc4", "score": "0.6228", "text": "def update\n if @board.update(board_params)\n redirect_to @board\n flash[:success] = 'Board successfully updated!'\n else\n render 'edit', status: 422\n end\n end", "title": "" }, { "docid": "41458b42a29954fc4865ad65bb9dff91", "score": "0.61777806", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41458b42a29954fc4865ad65bb9dff91", "score": "0.61777806", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41458b42a29954fc4865ad65bb9dff91", "score": "0.61777806", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f859f9f0eefee4894cd05ac71592a7ce", "score": "0.6141832", "text": "def patch_compute_board(moid, compute_board, opts = {})\n data, _status_code, _headers = patch_compute_board_with_http_info(moid, compute_board, opts)\n data\n end", "title": "" }, { "docid": "57da5918b693b11e3c23c2dbe8022282", "score": "0.6131982", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'GameBoard was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6120c9842d73e2643e3252d35c2edf88", "score": "0.6114057", "text": "def update\n @board = Board.find(params[:id])\n @board.updateTime = Time.now\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc78525e2a26ea5217d757978c15c2b3", "score": "0.6071065", "text": "def remote_update_board(board)\n # set board and update observers\n @board = board\n\n changed\n notify_observers @board\n\n verify_invariants\n end", "title": "" }, { "docid": "2496d27adcf493ab1600177ec52905b3", "score": "0.60488933", "text": "def update\n\t\tuid = current_user().id\n\t\tif uid === @board.user_id\n\t\t\[email protected](board_params)\n\t\t\trender :json => { status: :successfully}\n\t\tend\n\n # respond_to do |format|\n # if @board.update(board_params)\n # format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n # format.json { render :show, status: :ok, location: @board }\n # else\n # format.html { render :edit }\n # format.json { render json: @board.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "c2377084ec068b11539b0998adbf5599", "score": "0.60476774", "text": "def update\n \n @scrum_board = ScrumBoard.find(params[:id])\n \n respond_to do |format|\n if @scrum_board.update_attributes(params[:scrum_board])\n format.html { redirect_to :action => 'current_board', :un_id => \"#{@scrum_board.unique_id}\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrum_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e28e286c7358bc90540b2f548bd1f3b", "score": "0.6008458", "text": "def update_remote_board(board, player: @local_user)\n begin\n @client.put_game(@game_id, board, player)\n rescue InvalidTurn\n # Throws when continuing game as remoteplayer -- no need to overwrite remote board in this case\n end\n end", "title": "" }, { "docid": "b548adaefe9b7172083f77af7d42cd7c", "score": "0.6004903", "text": "def update\n @board = Board.find(params[:id])\n @board.user == current_user\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb7e686b5a34e721d1dd676324b92b6b", "score": "0.5949005", "text": "def update\n @toushikomon_board = ToushikomonBoard.find(params[:id])\n\n respond_to do |format|\n if @toushikomon_board.update_attributes(params[:toushikomon_board])\n format.html { redirect_to @toushikomon_board, notice: 'Toushikomon board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @toushikomon_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8470bd150e1089ef64bf7b29532d3771", "score": "0.5940605", "text": "def edit\n @board = Roxiware::Forum::Board.find(params[:id])\n raise ActiveRecord::RecordNotFound if @board.nil?\n authorize! :update, @board\n respond_to do |format|\n format.html { render :partial =>\"roxiware/forum/edit_board\" }\n end\n end", "title": "" }, { "docid": "6b35cded575f24ccecc4fb0570b02ec8", "score": "0.5938605", "text": "def update\n @poll_board = PollBoard.find(params[:id])\n\n respond_to do |format|\n if @poll_board.update_attributes(params[:poll_board])\n format.html { redirect_to @poll_board, notice: 'Poll board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6d626ea2d148591750c008a177fd759", "score": "0.59205645", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to :back }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "003b9f770a8a7a0adb701831ea0482f3", "score": "0.58760774", "text": "def update\n if @user_board.update(name: params[:board][:name], encrypted_password: params[:encrypted_password])\n render json: @user_board\n else\n errors = @board.errors.full_messages.concat @user_board.errors.full_messages\n render json: errors, status: 422\n end\n end", "title": "" }, { "docid": "df81db65b47f2ee417f69575f0d9f5c2", "score": "0.5873831", "text": "def update_compute_board_with_http_info(moid, compute_board, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ComputeApi.update_compute_board ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ComputeApi.update_compute_board\"\n end\n # verify the required parameter 'compute_board' is set\n if @api_client.config.client_side_validation && compute_board.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_board' when calling ComputeApi.update_compute_board\"\n end\n # resource path\n local_var_path = '/api/v1/compute/Boards/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(compute_board)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ComputeBoard'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ComputeApi.update_compute_board\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ComputeApi#update_compute_board\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "fc782feacb5c8ffc4d82dc3de98904cd", "score": "0.5846744", "text": "def update\n @board = Board.get!(params[:id])\n @board.current_user = current_user\n\n params[:board].delete(:listings)\n\n respond_to do |format|\n if @board.update(params[:board]) or not @board.dirty?\n flash[:notice] = 'Board was successfully updated.'\n format.html { redirect_to(board_url(@board.id)) }\n format.xml { render :xml => @board }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32f1ab6bc7fbc2012d81594f777234b3", "score": "0.58435863", "text": "def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c645529fa3f78d849541407cbdf71112", "score": "0.58270395", "text": "def update(column, row, new_value)\n # Duplicate the 2D board array\n new_board_array = Marshal.load(Marshal.dump(@board_array))\n\n # Assign the new value to the cell at (column, height).\n new_board_array[column][row] = new_value\n\n # Return a new BoardState with the updated array.\n BoardState.new(new_board_array)\n end", "title": "" }, { "docid": "df53efd852d1a8f723b893402c4887e9", "score": "0.5822168", "text": "def set_board(online_board)\n return if @online_board == online_board\n @online_board = online_board\n refresh\n end", "title": "" }, { "docid": "489e729a00936fdc8e1d0143bd2baddf", "score": "0.5812462", "text": "def update\n respond_to do |format|\n if @project_board.update(project_board_params)\n format.html { redirect_to @project_board, notice: 'Project board was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_board }\n else\n format.html { render :edit }\n format.json { render json: @project_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fc4bd11cb6ffd624fe08323c6555d3b", "score": "0.57508945", "text": "def set_board\n @board = Board.find(params[:id] || params[:board_id])\n end", "title": "" }, { "docid": "198d3005ac7d530231e2f214151b7c5a", "score": "0.5746074", "text": "def update\n @board2 = Board2.find(params[:id])\n\n respond_to do |format|\n if @board2.update_attributes(params[:board2])\n format.html { redirect_to @board2, notice: 'Board2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board2.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "6e603c26acbf961a33dbfc865e8912ce", "score": "0.5741665", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "c50911053fc261a742d8b1ed1d3bee5b", "score": "0.5737945", "text": "def set_board\n @board = Board.friendly.find(params[:id] || params[:board_id])\n end", "title": "" }, { "docid": "7201786f764f5303d8e6509fdc631a8a", "score": "0.57336444", "text": "def update\n @user_collaborates_on_board = UserCollaboratesOnBoard.find(params[:id])\n\n respond_to do |format|\n if @user_collaborates_on_board.update_attributes(params[:user_collaborates_on_board])\n format.html { redirect_to @user_collaborates_on_board, notice: 'User collaborates on board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_collaborates_on_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f2518a21d04ff1710e3b5f680fbce166", "score": "0.5717714", "text": "def set_board\n @board = Board.find(params[:board_id])\n end", "title": "" }, { "docid": "c1a7e95aa310357afbdae0801f08a883", "score": "0.5712232", "text": "def update\n @board_config = BoardConfig.get!(params[:id])\n @board_config.current_user = current_user\n\n respond_to do |format|\n if @board_config.update(params[:board_config]) or not @board_config.dirty?\n flash[:notice] = 'BoardConfig was successfully updated.'\n format.html { redirect_to(board_config_url(@board_config.id)) }\n format.xml { render :xml => @board_config }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea9d96c9bade203360a6c6d621eaa5fb", "score": "0.5709084", "text": "def set_board\n @board = Board.friendly.find(params[:board_id])\n end", "title": "" }, { "docid": "ae89664ce8a35bffb59f7df3a1a00b88", "score": "0.57055277", "text": "def update\n @freeboard = Freeboard.get(params[:id])\n\n @board = \"freeboard\"\n @section = \"edit\"\n \n if params[:freeboard][:title] == \"포스트 제목을 입력하세요 (100글자 이내)\" or params[:freeboard][:title].length == 0 or params[:freeboard][:content].length == 0\n flash[:notice] = '제목과 내용을 모두 입력해주세요!' \n render 'freeboard' \n elsif params[:freeboard][:title].length > 200\n flash[:notice] = '제목은 100글자 이내로 적어주세요.' \n render 'freeboard' \n else\n @freeboard.title = params[:freeboard][:title]\n @freeboard.content = params[:freeboard][:content]\n \n if @freeboard.save\n redirect_to '/freeboards'\n else\n flash[:notice] = '오류가 발생하였습니다. 다시 시도해 보시거나, 관리자에게 문의해주세요!'\n render 'freeboard' \n end\n end\n end", "title": "" }, { "docid": "94ac3ab88feb1adc699adf998446c933", "score": "0.56820744", "text": "def update\n @mainboard = Mainboard.find(params[:id])\n\n respond_to do |format|\n if @mainboard.update_attributes(params[:mainboard])\n format.html { redirect_to @mainboard, notice: 'Mainboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mainboard.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c2b3a7bb9530dcd9177584e3e6346b5", "score": "0.5681143", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "7c2b3a7bb9530dcd9177584e3e6346b5", "score": "0.5681143", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "7c2b3a7bb9530dcd9177584e3e6346b5", "score": "0.5681143", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "acd460a2023187747afbe9af1d3bd93b", "score": "0.5676971", "text": "def update\n respond_to do |format|\n if @whiteboard.update(whiteboard_params)\n format.html { redirect_to @whiteboard, notice: 'White board was successfully updated.' }\n format.json { render :show, status: :ok, location: @whiteboard }\n else\n format.html { render :edit }\n format.json { render json: @whiteboard.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa24cda195aa9ae00908dff4c6b69684", "score": "0.56765544", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "fa24cda195aa9ae00908dff4c6b69684", "score": "0.56765544", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "fa24cda195aa9ae00908dff4c6b69684", "score": "0.56765544", "text": "def set_board\n @board = Board.find(params[:id])\n end", "title": "" }, { "docid": "f940dabda7d6fb9e4d2aa3e23e0afc6d", "score": "0.56323504", "text": "def update\n converge_if_changed do |_vars|\n # TODO(nelsonjr): Determine how to print indented like upd converge\n # TODO(nelsonjr): Check w/ Chef... can we print this in red?\n puts # making a newline until we find a better way TODO: find!\n compute_changes.each { |log| puts \" - #{log.strip}\\n\" }\n update_req =\n ::Google::Container::Network::Put.new(self_link(@new_resource),\n fetch_auth(@new_resource),\n 'application/json',\n resource_to_request)\n wait_for_operation update_req.send, @new_resource\n end\n end", "title": "" }, { "docid": "04f7652a68cb2bbb44ac0614c21ba868", "score": "0.56177837", "text": "def update\n respond_to do |format|\n if @game_board.update(game_board_params)\n format.html { redirect_to @game_board, notice: 'Game board was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_board }\n else\n format.html { render :edit }\n format.json { render json: @game_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58a671f79981b682d5b97b0eeaa034af", "score": "0.56101245", "text": "def update\n respond_to do |format|\n if @task_board.update(task_board_params)\n format.html { redirect_to @task_board, notice: 'Task board was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_board }\n else\n format.html { render :edit }\n format.json { render json: @task_board.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d2399308f069e7b59d9b3ef65b15b62", "score": "0.5600795", "text": "def update\n if @boardgame.update(boardgame_params)\n render :show, status: :ok, location: @boardgame\n else\n render json: @boardgame.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8cf37214046af9fe31c2febe98cede74", "score": "0.5595844", "text": "def update_board\n\tsystem \"clear\"\n\tputs \"\"\n\tputs \" 1 2 3 4 5 6 7 8\"\n\tputs \" |-------------------------|\"\n\tprint \" A ||\"\n\tprint_row 0\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" B ||\"\n\tprint_row 1\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" C ||\"\n\tprint_row 2\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" D ||\"\n\tprint_row 3\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" E ||\"\n\tprint_row 4\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" F ||\"\n\tprint_row 5\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" G ||\"\n\tprint_row 6\n\tputs \"|\"\n\tputs \" |-------------------------|\"\n\tprint \" H ||\"\n\tprint_row 7\n\tputs \"|\"\n\tputs \" |-------------------------|\\n\\n \"\nend", "title": "" }, { "docid": "14c0fa03eae614b7bc29ffe986f40da9", "score": "0.55912185", "text": "def update\n @gameModel.board.size[:columns].times do |i|\n\[email protected][:rows].times do |j|\n\t \n player = @gameModel.board.who(i, j)\n\t imageFile = @@colourMap[:empty]\n\t imageFile = @@colourMap[@playerColourMap[player]] if !player.nil?\n @builder.get_object(\"piece#{i}#{j}\" ).set_file(imageFile) \n\n\tend\n end\n end", "title": "" }, { "docid": "754fffc14960e3ce4ee4ef41e1c3feef", "score": "0.5574208", "text": "def set_board\n @board = Board.friendly.find(params[:id])\n end", "title": "" }, { "docid": "fb9637e44f28c6595a0a0afb121ef20a", "score": "0.55536634", "text": "def update!(**args)\n @connected_projects = args[:connected_projects] if args.key?(:connected_projects)\n @ip_cidr_range = args[:ip_cidr_range] if args.key?(:ip_cidr_range)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @max_instances = args[:max_instances] if args.key?(:max_instances)\n @max_throughput = args[:max_throughput] if args.key?(:max_throughput)\n @min_instances = args[:min_instances] if args.key?(:min_instances)\n @min_throughput = args[:min_throughput] if args.key?(:min_throughput)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @state = args[:state] if args.key?(:state)\n @subnet = args[:subnet] if args.key?(:subnet)\n end", "title": "" }, { "docid": "8f012e4623b3437c2a433526d978daa2", "score": "0.55468553", "text": "def update(row, col, player)\n @board[row][col] = player\n end", "title": "" }, { "docid": "b2c4cc6317aa768ff0b8f3f76fd86aa8", "score": "0.5535602", "text": "def update\n @board_comment = BoardComment.find(params[:id])\n\n respond_to do |format|\n if @board_comment.update_attributes(params[:board_comment])\n format.html { redirect_to @board_comment, notice: 'Board comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "952635d777cd3e5a27de8717d66f66ef", "score": "0.55346256", "text": "def board_update\n matrix.each do |row|\n row.each do |cell|\n cell.board_updates\n end\n end\n end", "title": "" }, { "docid": "39214fd3302285e889742c923d973903", "score": "0.5511744", "text": "def update\n @board_content = BoardContent.find(params[:id])\n\n respond_to do |format|\n if @board_content.update_attributes(params[:board_content])\n format.html { redirect_to @board_content, notice: 'Board content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board_content.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f40414c15ad029bc1744e9136c57d92", "score": "0.5500905", "text": "def refresh\n @board = \" +----+-|\\n #{@head} \\\\|\\n #{@left_arm}#{@upper_body}#{@right_arm} |\\n #{@lower_body} |\\n #{@left_leg} #{@right_leg} |\\n |\\n-----------\"\n puts @board\n end", "title": "" }, { "docid": "3c63f8ed75cedf4adf28a329cf56ca9d", "score": "0.5487993", "text": "def setresource\n @resource = Resourceweightage.update(params[:id],:cpu => params[:cpu], :ram => params[:ram], :nic => params[:nic])\n \n end", "title": "" }, { "docid": "b7cd222d22eac35ac76ed0022cb68693", "score": "0.54751396", "text": "def update\n @board = Board.find(params[:id])\n\n params[:board].delete(:id)\n params[:board].delete(:columns)\n params[:board].delete(:types)\n params[:board].delete(:created_at)\n params[:board].delete(:updated_at)\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.xml { render :xml => @board.to_xml(:include => :columns) }\n else\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
0d623bafd924963c9d606a0953283ecb
Returns records from sandbox where values in column_names are not null and optionally filtered down by specified scope Pass Arel::Table
[ { "docid": "26b4651c59860da97b9e56ae04457258", "score": "0.6576835", "text": "def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each { |n| not_null_conds = not_null_conds.and(n) }\n result = s.project(Arel.star).where(not_null_conds)\n scope_nodes = sanitized_sandbox_scope.map do |scope_column, scope_def|\n tmp = []\n if scope_def['inclusion']\n inclusion_nodes = scope_def['inclusion'].map do |value|\n s[scope_column].eq(Arel::Nodes::Quoted.new(value))\n end\n tmp << inclusion_nodes.inject(&:or)\n end\n if scope_def['exclusion']\n exclusion_nodes = scope_def['exclusion'].map do |value|\n s[scope_column].not_eq(Arel::Nodes::Quoted.new(value))\n end\n tmp << exclusion_nodes.inject(&:or)\n end\n if scope_def['blank']\n tmp << s[scope_column].eq(nil)\n end\n tmp\n end.flatten\n scope_conds = scope_nodes.inject(&:and)\n result = result.where(scope_conds) if scope_conds\n result\n end", "title": "" } ]
[ { "docid": "6d4272d73f238bfca5b72c909007bfd4", "score": "0.7279973", "text": "def non_null_scopes!\n boolean_scopes!\n columns.select_null.names.to_syms.each {|col|\n unless respond_to? col\n scope col, lambda {where \"#{quoted_table_name}.#{col} is not null\"}\n end\n }\n rescue\n nil\n end", "title": "" }, { "docid": "55700b0ad25da20bedeed562803202fe", "score": "0.6831491", "text": "def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each{ |n| not_null_conds = not_null_conds.and(n) }\n result = s.project('*').where(not_null_conds)\n scope_nodes = sanitized_sandbox_scope.map do |scope_column, scope_def|\n tmp = []\n if scope_def['inclusion']\n inclusion_nodes = scope_def['inclusion'].map{ |value| s[scope_column].eq(value) }\n tmp << inclusion_nodes.inject(&:or)\n end\n if scope_def['exclusion']\n exclusion_nodes = scope_def['exclusion'].map{ |value| s[scope_column].not_eq(value) }\n tmp << exclusion_nodes.inject(&:or)\n end\n if scope_def['blank']\n tmp << s[scope_column].eq(nil)\n end\n tmp\n end.flatten\n scope_conds = scope_nodes.inject(&:and)\n result = result.where(scope_conds) if scope_conds\n result\n end", "title": "" }, { "docid": "9217e5443404afec19dffffba92142d1", "score": "0.68075806", "text": "def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each{ |n| not_null_conds = not_null_conds.and(n) }\n result = s.project('*').where(not_null_conds)\n scope_nodes = sanitized_scope.map do |scope_column, scope_value|\n s[scope_column].eq(scope_value)\n end\n scope_conds = scope_nodes.shift\n scope_nodes.each{ |n| scope_conds = scope_conds.and(n) }\n result = result.where(scope_conds) if scope_conds\n\n result\n end", "title": "" }, { "docid": "86ea4c34208d07881ebbd121f89ab274", "score": "0.6491734", "text": "def get_scoped_records\n\t\t\t\tscope = self.class.sequenced_options[:scope]\n\t\t\t\tcolumn = self.class.sequenced_options[:column]\n\t\t\t\tq = self.class.unscoped.where(\"#{column.to_s} IS NOT NULL\").order(\"#{column.to_s} ASC\")\n\n\t\t\t\tif scope.is_a?(Symbol)\n\t\t\t\t\tq = q.where(scope => self.send(scope))\n\t\t\t\telsif scope.is_a?(Array)\n\t\t\t\t\tscope.each { |s| q = q.where(s => self.send(s)) }\n\t\t\t\tend\n\n\t\t\t\treturn q\n\t\t\tend", "title": "" }, { "docid": "0cb89a76002c5bb852debf48db929e12", "score": "0.62662935", "text": "def to_scope\r\n\r\n model_scope = @model.scoped\r\n\r\n table_name = @model.table_name\r\n\r\n @filtering_attributes.each do |attr|\r\n\r\n filtering_value = @filtering_values[attr]\r\n\r\n next if filtering_value.nil?\r\n\r\n column_name = attr.to_s\r\n\r\n if @model.include?(PseudoColumns)\r\n filtering_column_type = @model.column_db_type(attr)\r\n column_sql = @model.sql_for_column(attr)\r\n else\r\n filtering_column_type = @model.columns_hash[column_name].type\r\n column_sql = \"\\\"#{ table_name }\\\".\\\"#{ column_name }\\\"\"\r\n end\r\n\r\n case filtering_column_type\r\n when :string\r\n case filtering_value\r\n when Set\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n else\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } LIKE ?\", filtering_value)\r\n end\r\n\r\n when :boolean\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n\r\n when :integer\r\n case filtering_value\r\n when Hash\r\n if filtering_value.key?(:min)\r\n unless filtering_value[:min] == -Float::INFINITY\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value[:min])\r\n end\r\n end\r\n if filtering_value.key?(:max)\r\n unless filtering_value[:max] == Float::INFINITY\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value[:max])\r\n end\r\n end\r\n when Set\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n when Range\r\n unless filtering_value.first == -Float::INFINITY\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value.first)\r\n end\r\n unless filtering_value.last == Float::INFINITY\r\n model_scope =\r\n if filtering_value.exclude_end?\r\n model_scope.where(\"#{ column_sql } < ?\", filtering_value.last)\r\n else\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value.last)\r\n end\r\n end\r\n else\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n end\r\n\r\n when :date\r\n case filtering_value\r\n when Hash\r\n if filtering_value.key?(:from)\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value[:from])\r\n end\r\n if filtering_value.key?(:until)\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value[:until])\r\n end\r\n when Set\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } IN (?)\", filtering_value)\r\n when Range\r\n unless filtering_value.first == -Float::INFINITY\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } >= ?\", filtering_value.first)\r\n end\r\n unless filtering_value.last == Float::INFINITY\r\n model_scope =\r\n if filtering_value.exclude_end?\r\n model_scope.where(\"#{ column_sql } < ?\", filtering_value.last)\r\n else\r\n model_scope.where(\"#{ column_sql } <= ?\", filtering_value.last)\r\n end\r\n end\r\n else\r\n model_scope =\r\n model_scope.where(\"#{ column_sql } = ?\", filtering_value)\r\n end\r\n end\r\n end\r\n\r\n model_scope\r\n end", "title": "" }, { "docid": "5bfd6d87c539af0c9284eb87d0565b1b", "score": "0.6171959", "text": "def filter_by *columns; @columns_for_filter = ensure_columns_are_filterable!(columns); end", "title": "" }, { "docid": "72f9635ea9df13fd6c2db572b334930f", "score": "0.58851004", "text": "def boolean_scopes!\n columns.select_by_type(:boolean).names.to_syms.each {|col|\n unless respond_to? col\n scope col, lambda {where \"#{quoted_table_name}.#{col} = 1\"}\n end\n }\n rescue\n nil\n end", "title": "" }, { "docid": "bc6a3bb4ede90bfed6064cff6cb8b110", "score": "0.58673257", "text": "def filtered_from(params)\n scope = self.scoped({})\n return scope unless params.include?(:filter) and params[:filter][self.table_name.to_sym]\n\n options = params[:filter][self.table_name.to_sym]\n method = filter_method_from_options(options)\n terms = filter_terms_from_options(options, method)\n fields = filter_fields_from_options(options)\n scopes = filter_scopes_from_options(options)\n\n return scope if fields.blank? or terms.compact.blank?\n\n conditions = []\n terms.each do |term|\n value = term.downcase\n fields.each { |field| conditions << [\"LOWER(#{table_name}.#{field}) LIKE ?\", \"%#{value}%\"] }\n end\n\n conditions = conditions.compact.unzip\n if conditions.length > 1 && conditions[0] = conditions[0].join((method != :all) ? ' OR ' : ' AND ')\n scope = self.scoped(:conditions => (conditions.empty? ? nil : conditions.flatten))\n end\n ret = scopes.inject(scope) { |acc, scope_and_value|\n acc.send(scope_and_value[0].to_sym, scope_and_value[1])\n }\n ret\n end", "title": "" }, { "docid": "bc5fdf3c1ddc7ce278c75332d069ab83", "score": "0.58605576", "text": "def scoped_all\n where(nil)\n end", "title": "" }, { "docid": "c1d4e3b7cc5bfe383df988a6729ca511", "score": "0.57710814", "text": "def scopes_to_filter=(_arg0); end", "title": "" }, { "docid": "49a6fbc75dcf841c636f04c7e921f384", "score": "0.57665735", "text": "def ignore_columns_in_sql\n (self.default_scopes = orig_default_scopes) && return unless ignorable_columns.present?\n unless default_scopes.include? default_scopes_cache[ignorable_columns]\n default_scopes_cache[ignorable_columns] ||= proc { select(*(all_columns.map(&:name) - ignorable_columns)) }\n self.default_scopes = (default_scopes.clone || []) << default_scopes_cache[ignorable_columns]\n end\n end", "title": "" }, { "docid": "8d40cf07fa05fd3c785e342ef8463c6f", "score": "0.5755361", "text": "def rejects(*rejected_cns)\n rejected_cns = ColumnScope.stringify_names rejected_cns\n ColumnScope.new self, column_names - rejected_cns\n end", "title": "" }, { "docid": "36fc7a80be83711c989f524ef8512ca4", "score": "0.57281005", "text": "def create_without_scope(name)\n create_scope(name, ->(values) { [\"#{attribute_column} NOT IN (?)\", values] })\n end", "title": "" }, { "docid": "1e467c12a66a17175fc263b8ccd85c40", "score": "0.56811035", "text": "def sanitized_scope\n res = {}\n scope && scope.each do |scope_column, scope_value|\n scope_column =~ /(.+?)(_blank)?$/\n scope_column = $1\n scope_value = nil unless $2.nil? #if _blank, then check for null\n if (\n Trade::SandboxTemplate.column_names +\n ['point_of_view', 'importer', 'exporter']\n ).include? scope_column\n res[scope_column] = scope_value\n end\n end\n res\n end", "title": "" }, { "docid": "ddd9d38439ff2f8509e6b22d7f8455f8", "score": "0.55968463", "text": "def filter_by_scopes(filtering_params)\n results = self.none # AdtiveRecord::Base monkey patched in ext/base.rb\n filtering_params.each do |key, value|\n results = results.public_send(key, value) if value.present?\n end\n\n results\n end", "title": "" }, { "docid": "f390b4953f38be09b5a8a8618e9521d0", "score": "0.55156076", "text": "def filtered_list(db, table, column, value)\n db.execute 'SELECT * FROM (?) WHERE (?) = (?)', [table, column, value]\n end", "title": "" }, { "docid": "013ba4e38b703ceb0776c15846c9f054", "score": "0.5509796", "text": "def where_scope(scope)\n all_in(scope_values: scope)\n end", "title": "" }, { "docid": "7dad5b767074792ce204f54b126c0879", "score": "0.54928744", "text": "def missing(*associations)\n associations.each do |association|\n reflection = scope_association_reflection(association)\n @scope.left_outer_joins!(association)\n if reflection.options[:class_name]\n @scope.where!(association => { reflection.association_primary_key => nil })\n else\n @scope.where!(reflection.table_name => { reflection.association_primary_key => nil })\n end\n end\n\n @scope\n end", "title": "" }, { "docid": "595f65200c3ad78111641398d812f31e", "score": "0.54265887", "text": "def filter_scope(scope, options={})\n unpermitted_params = []\n params = sanitary_params.with_indifferent_access\n\n params[:sort] ||= 'id'\n params[:order] ||= 'asc'\n\n params.keys.each do |key|\n next if options[:skip_params]&.include? key.to_s\n\n relation, column = key.to_s.split('.')\n value = params[key].dup\n negate = value[0] == '!'\n value.slice!(0) if negate\n value = [nil, ''] if value.blank? || value == '!'\n\n if column.nil?\n column = relation\n relation = scope.table_name\n end\n\n table = relation.pluralize\n\n if scope.connection.table_exists?(table) && scope.connection.column_exists?(table, column)\n if table != scope.table_name\n if scope.reflect_on_association(relation)\n scope = scope.joins(relation.to_sym)\n else\n unpermitted_params << key\n end\n end\n\n if negate\n scope = scope.where.not(\"#{table}.#{column}\" => value)\n else\n scope = scope.where(\"#{table}.#{column}\" => value)\n end\n end\n end\n\n if params.include?(:q) or params.include?(:sort)\n sort = params[:sort] ? \"#{params[:sort].try(:downcase)} #{params[:order].try(:downcase)}\".strip : ''\n\n if scope.respond_to?(:search_for) && params[:q]\n scope = scope.search_for(params[:q])\n else\n unpermitted_params << 'q' if params[:q]\n end\n\n scope = scope.order(sort)\n end\n\n unless params[:page] == 'all' || !scope.respond_to?(:page)\n scope = scope.page(params[:page] || 1)\n end\n\n raise ActionController::UnpermittedParameters.new(unpermitted_params) if unpermitted_params.any?\n\n scope\n rescue ScopedSearch::QueryNotSupported => e\n raise ActionController::RoutingError.new(e.message)\n end", "title": "" }, { "docid": "6fa2b90dee254bb4829c40797c536166", "score": "0.5382795", "text": "def create_with_scope(name)\n create_scope(name, ->(values) { [\"#{attribute_column} IN (?)\", values] })\n end", "title": "" }, { "docid": "fb717158d387a96d2d77b8b63e58c71a", "score": "0.5365247", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n arel_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n valid_values = s.project(s['*']).join(v).on(arel_nodes.inject(&:and))\n scoped_records_arel(s).except(valid_values)\n end", "title": "" }, { "docid": "67ba88819ce2446a82d2025b67de5abe", "score": "0.53553504", "text": "def matching_records(annual_report_upload)\n table_name = annual_report_upload.sandbox.table_name\n sandbox_klass = Trade::SandboxTemplate.ar_klass(table_name)\n s = Arel::Table.new(table_name)\n arel_nodes = column_names.map do |c|\n s[c].eq(nil)\n end\n sandbox_klass.select('*').where(arel_nodes.inject(&:and))\n end", "title": "" }, { "docid": "88449243380fff63001a27ed3da66102", "score": "0.5353841", "text": "def datagrid_query_scope(scope, params, options = {})\n search_cols = self._search_columns || []\n if params[:query].present? && search_cols.any?\n cols = search_cols.inject([]) do |memo, spec|\n if spec.is_a?(Hash)\n # {foo: [:one, :two], bar: :three}\n # => ['foo.one', 'foo.two', 'bar.three']\n subs = spec.inject([]) do |memo2, (table, tcols)|\n memo2.concat(Array.wrap(tcols).map {|tcol| \"#{table}.#{tcol}\"})\n end\n memo.concat(subs)\n else\n memo << spec\n end\n end\n where_clause = cols.map {|col| \"LOWER(#{col}) LIKE ?\"}.join(' OR ')\n query = \"%#{params[:query].downcase}%\"\n bind_params = [query] * cols.size\n scope = scope.where(where_clause, *bind_params)\n end\n scope\n end", "title": "" }, { "docid": "8d2c22a56fba5cf4eda027d5528c0db5", "score": "0.53530544", "text": "def fetch_index_records\n scope = model_scope\n scope = filtered_scope(scope, query_params[:filter]) if query_params.key?(:filter)\n scope\n end", "title": "" }, { "docid": "7ca73c8c0a29aa52cca0c52f0fa7bf4a", "score": "0.5345945", "text": "def search(scope, filters, dynamic_column:, column_types:)\n expect! filters => [nil, Hash]\n expect! dynamic_column => ID_REGEXP\n\n filters.each_key do |key|\n expect! key => [Symbol, String]\n expect! key.to_s => ID_REGEXP\n end\n\n return scope if filters.nil? || filters.empty?\n\n # some filters try to match against existing columns, some try to match\n # against the \"tags\" JSONB column - and they result in different where\n # clauses in the Simple::SQL scope (\"value = <match>\" or \"tags->>value = <match>\").\n static_filters, dynamic_filters = filters.partition { |key, _| static_filter?(column_types, key) }\n\n scope = apply_static_filters(scope, static_filters, column_types: column_types)\n scope = apply_dynamic_filters(scope, dynamic_filters, dynamic_column: dynamic_column)\n scope\n end", "title": "" }, { "docid": "19b55aa178159128ffcb1aba3805d5b7", "score": "0.53359085", "text": "def has_dynamic_columns(opts = :chain, *rest)\n\t\t\t\t\t# Map\n\t\t\t\t\tdynamic_columns_value = {\n\t\t\t\t\t\t:scope => nil,\n\t\t\t\t\t\t:where => @scope.send(:build_where, opts, rest)\n\t\t\t\t\t}\n\t\t\t\t\[email protected]_dynamic_columns_values = dynamic_columns_value\n\n\t\t\t\t\tchain = ::ActiveRecord::QueryMethods::WhereChain.new(@scope)\n\t\t\t\t\tchain.instance_eval do\n\t\t\t\t\t\t# Make outer scope variable accessible\n\t\t\t\t\t\t@dynamic_columns_value = dynamic_columns_value\n\n\t\t\t\t\t\t# Extends where to chain with a has_scope method\n\t\t\t\t\t\t# This scopes the where from above\n\t\t\t\t\t\tdef with_scope(opt)\n\t\t\t\t\t\t\t@dynamic_columns_value[:scope] = opt\n\n\t\t\t\t\t\t\t@scope\n\t\t\t\t\t\tend\n\t\t\t\t\t\tdef without_scope\n\t\t\t\t\t\t\t@scope\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tchain\n\t\t\t\tend", "title": "" }, { "docid": "bfface318ab713e8f03050424197cca8", "score": "0.53189695", "text": "def not(opts, *rest)\n where_clause = @scope.send(:build_where_clause, opts, rest)\n\n @scope.where_clause += where_clause.invert\n\n @scope\n end", "title": "" }, { "docid": "3e27aafee829048fe8339f44f9d4d95e", "score": "0.5317682", "text": "def filter_by_scope(scoped, scope = nil)\n scope ? scoped.where(labels: { scope: scope }) : scoped\n end", "title": "" }, { "docid": "52c7fbf32c102a583497f6a3f11d3a29", "score": "0.53053427", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n join_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n valid_values = s.project(s[Arel.star]).join(v).on(join_nodes.inject(&:and))\n scoped_records_arel(s).except(valid_values)\n end", "title": "" }, { "docid": "75b77b3fcec973ee1572cc14df1060e4", "score": "0.530314", "text": "def filter_cql_from_params\n filter_cql_class.new(filter_keys_with_values, blocked_id_cql).to_cql\n end", "title": "" }, { "docid": "084a858ec79ffe11a97f3d570b2a30a7", "score": "0.5302668", "text": "def records_within_scope(record_class)\n query = record_class\n .joins(:student => :school)\n .where(:schools => {:local_id => @school_local_ids})\n .where('occurred_at >= ?', @inclusive_date_range.begin)\n .where('occurred_at <= ?', @inclusive_date_range.end)\n\n # Allow filtering by student_local_id as as well\n if @student_local_ids.present?\n student_ids = @student_local_ids.map do |student_local_id|\n @student_ids_map.lookup_student_id(student_local_id)\n end\n if student_ids != student_ids.compact\n log(\"not all @student_local_ids could be found, compacting #{@student_local_ids} to #{@student_local_ids.compact}...\")\n end\n query.where(student_id: student_ids.compact)\n else\n query\n end\n end", "title": "" }, { "docid": "dc92e067172d449c4e642ef41e58bb97", "score": "0.5287342", "text": "def query(rows)\n return if rows.empty?\n ids = rows.map { |row|\n begin\n row.send @ref.active_record_primary_key\n rescue NoMethodError => e\n raise MissingColumnError.new(row, e.name)\n end\n }.compact.uniq\n q = base_scope.where(@ref.foreign_key => ids)\n q.where!(@ref.type => rows[0].class&.model_name) if @ref.options[:as]\n yield ids.any? ? q : nil\n end", "title": "" }, { "docid": "1a24daceb5f1b57b18051fe2b50b8513", "score": "0.52461565", "text": "def where_table(*args, &b)\n set_parameters(args, true, &b)\n end", "title": "" }, { "docid": "1a24daceb5f1b57b18051fe2b50b8513", "score": "0.52461565", "text": "def where_table(*args, &b)\n set_parameters(args, true, &b)\n end", "title": "" }, { "docid": "a04b2fa8a98686eaa5c60d1f52926950", "score": "0.5229166", "text": "def get_records(params)\n params[:scope] = config[:scope] # note, params[:scope] becomes ActiveSupport::HashWithIndifferentAccess\n data_adapter.get_records(params, columns)\n end", "title": "" }, { "docid": "dd4cbfcc9e81674addccaba59b2d10bd", "score": "0.5225789", "text": "def query(rows)\n ids = rows.map { |row|\n begin\n row.send @ref.foreign_key\n rescue NoMethodError => e\n raise MissingColumnError.new(row, e.name)\n end\n }.compact.uniq\n yield base_scope.where(@ref.active_record_primary_key => ids) if ids.any?\n end", "title": "" }, { "docid": "e301ba26cd73ab4bda23cf574eeb53fe", "score": "0.5220281", "text": "def select(scope)\n select_statement = \"SELECT * FROM #{scope.klass.table_name} #{scope.predicate}\"\n @db.execute(select_statement, scope.predicate_values)\n end", "title": "" }, { "docid": "7c09c8e8563c656cf444ee4f11bd59d9", "score": "0.52146316", "text": "def where!( opts, *rest )\n case opts\n when Hash\n opts = sanitize_forbidden_attributes(opts)\n references!(ActiveRecord::PredicateBuilder.references(opts))\n when String\n pgc_table = PGCrypto[table_name]\n if pgc_table && ( columns = pgc_table.keys ).present?\n opts = opts.dup.tap do |output|\n columns.each do |col_name|\n next unless key = PGCrypto.keys.private_key( pgc_table[col_name] )\n pattern = Regexp.new \"(?<![a-zA-Z0-9_\\\\.])(#{table_name}\\\\.)?#{col_name}(?![a-zA-Z0-9_])\"\n output.gsub!( pattern, PGCrypto::Crypt.decrypt_column( table_name, col_name, key ).to_sql )\n end\n end\n end\n end\n self.where_values += build_where(opts, rest)\n self\n end", "title": "" }, { "docid": "5d7560ff984be6d171e085f6bff8fd91", "score": "0.52104217", "text": "def filter_conditions(conditions)\n return conditions.select { |k,v| @columnNames.include?(k) }\n end", "title": "" }, { "docid": "da2ebf70f91283d948b820d8399d40bd", "score": "0.52084196", "text": "def filter(names)\n set(table: table.select{|key, _| names.include?(key)})\n end", "title": "" }, { "docid": "62361b1596c24a1fc08e257795afc724", "score": "0.5205618", "text": "def filter_cql\n {}\n end", "title": "" }, { "docid": "8917bc0b6ed475b90941e7577358e598", "score": "0.5198348", "text": "def filter_results\n return all unless primary_key == 'id'\n\n sall = all\n return unless sall\n\n ex_ids = []\n sall.each do |r|\n ex_ids << r.id unless r.can_access?\n end\n\n if ex_ids.empty?\n sall\n else\n where(\"#{table_name}.id not in (?)\", ex_ids)\n end\n end", "title": "" }, { "docid": "6861673923c3cf76adb75b923c69553a", "score": "0.51969", "text": "def scope(records)\n records.all.includes(self.class.associated_tables)\n end", "title": "" }, { "docid": "a318f4608e821d088f5b8bc43bea3d42", "score": "0.5190906", "text": "def by_active_sql_condition_scope(options= {}, &block)\n conditions = generate_conditions_for_records(options) do |active_sql_condition|\n yield active_sql_condition\n end\n where_or_scoped conditions\n end", "title": "" }, { "docid": "eb07e9b29373b6932dee09780f4048d5", "score": "0.5187259", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n arel_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n join_conditions = arel_nodes.shift\n arel_nodes.each{ |n| join_conditions = join_conditions.and(n) }\n valid_values = s.project(s['*']).join(v).on(join_conditions)\n scoped_records_arel(s).except(valid_values)\n end", "title": "" }, { "docid": "b82c30d63602c3c7996df268cad99394", "score": "0.51769483", "text": "def scope_with_deleted\n if @owner.paranoid? and @owner.destroyed? and klass.paranoid?\n col = klass.arel_table[klass.kakurenbo_column]\n owner_deleted_at = @owner.send(@owner.class.kakurenbo_column)\n condition = col.eq(nil).or(col.gteq(owner_deleted_at))\n\n scope_without_deleted.with_deleted.where(condition)\n else\n scope_without_deleted\n end\n end", "title": "" }, { "docid": "4991e62182da286ca80eae9c02902afe", "score": "0.5153133", "text": "def query_db_for_columns\n ds = unfiltered.unordered.clone(:distinct => nil, :limit => 1)\n ds.each{break}\n @columns = ds.instance_variable_get(:@columns)\n @columns || []\n end", "title": "" }, { "docid": "ec60d3ae32ad973cffd39a1372d90929", "score": "0.5151126", "text": "def nested_set_scope\n conditions = scope_column_names.inject({}) do |cnd, attr|\n cnd.merge attr => self[attr]\n end\n\n self.class.base_class.order(q_left).where(conditions)\n end", "title": "" }, { "docid": "b9b9d3293648cf738c03d97f414ccd2f", "score": "0.51332515", "text": "def scope\n res = criteria.target.fetch_records(ids)\n\n res = res.includes(*criteria.includes_values) if criteria.includes_values\n res = res.eager_load(*criteria.eager_load_values) if criteria.eager_load_values\n res = res.preload(*criteria.preload_values) if criteria.preload_values\n\n res\n end", "title": "" }, { "docid": "e3360efab56db9709c028746bc3fb862", "score": "0.5127523", "text": "def filter_tables tables\n tables.select {|t| !::Fixtural::Adapter::SKIP_TABLES.include? t }\n end", "title": "" }, { "docid": "d84eba028dfdb9a74253fc44367e86b7", "score": "0.5126998", "text": "def not(opts, *rest)\n where_clause = @scope.send(:where_clause_factory).build(opts, rest)\n\n @scope.references!(PredicateBuilder.references(opts)) if Hash === opts\n @scope.where_clause += where_clause.invert\n @scope\n end", "title": "" }, { "docid": "f6373b685fddb4c7f8c4a049f6083ae2", "score": "0.51204926", "text": "def where!(attributes)\n sanitized = sanitize_attributes(attributes)\n all.select do |record|\n sanitized.all? { |key, value| record.send(key) == value }\n end\n end", "title": "" }, { "docid": "3b0c9a9990eccc05362751256973218d", "score": "0.512001", "text": "def timed_scopeable_columns\n columns.select{ |c| SCOPEABLE_COLUMN_TYPES.include?(c.type) }\n end", "title": "" }, { "docid": "634c17e0ea3c5dad16debfa2bcee2ebb", "score": "0.5107209", "text": "def queried_record_scope\n unless @queried_record_scope\n scope = record_scope(unnamespace(params[:controller]).to_sym)\n\n if scope.any? && query_params[:filter] && !query_params[:filter].empty?\n if (valid_filters = query_params[:filter].select { |k, _| scope.column_names.include? actual_field(k).to_s }).present?\n valid_filters.each do |k, v|\n scope = scope.where(actual_field(k) => v)\n end\n end\n end\n\n @queried_record_scope = scope\n end\n\n @queried_record_scope\n end", "title": "" }, { "docid": "69e6deb462c327ad7cdf3b87936ea9e8", "score": "0.51056874", "text": "def key_scope_records\n @records = @records.accessible_by(current_ability).unscope(:order)\n end", "title": "" }, { "docid": "90f73b0fc954502b957240b35fa134af", "score": "0.5081992", "text": "def matching_records(annual_report_upload)\n sandbox_klass = annual_report_upload.sandbox.ar_klass\n s = sandbox_klass.arel_table\n arel_nodes = column_names.map do |c|\n s[c].eq(nil)\n end\n sandbox_klass.select('*').where(arel_nodes.inject(&:and))\n end", "title": "" }, { "docid": "71dc0becbfbf96d8a6028c6a8d6e72fa", "score": "0.50788647", "text": "def complex_condition_nor_ar\n Actor.where.not(first_name: 'Nick')\nend", "title": "" }, { "docid": "a81260cbc701e38b419e67ae2b4bbd6d", "score": "0.5065414", "text": "def filter_attributes(attributes)\n return attributes.select { |k| @columnNames.include?(k)}\n end", "title": "" }, { "docid": "f3b5ff9e7256d7ef52bb59a3e0daf2d1", "score": "0.50543094", "text": "def filter(dataset)\n dataset.filter(conditions(filterable_tables(dataset)))\n end", "title": "" }, { "docid": "65d014e4f9926bbd63b55cd93eb48628", "score": "0.50505584", "text": "def all_with_filter(table, filter)\n return @conn.exec(\"SELECT * FROM #{table} WHERE #{filter}\").to_a\n end", "title": "" }, { "docid": "f0659bc9c8d8b91895c6eb8a63bf0bd9", "score": "0.50418353", "text": "def records_within_scope\n return StudentSectionAssignment.all if @school_local_ids.nil?\n\n StudentSectionAssignment\n .joins(:section => {:course => :school})\n .where(:schools => {:local_id => @school_local_ids})\n end", "title": "" }, { "docid": "3c687f50a1f42c506015938e52d3be98", "score": "0.5040299", "text": "def records_within_scope\n ReadingBenchmarkDataPoint.all\n .where('created_at > ?', DateTime.new(@school_year, 9, 15))\n .where('created_at < ?', DateTime.new(@school_year+1, 8, 15))\n end", "title": "" }, { "docid": "ca85b54d52c47a64445f16e90d1636b2", "score": "0.5030295", "text": "def records_within_scope\n return EducatorSectionAssignment.all if @school_local_ids.nil?\n\n EducatorSectionAssignment\n .joins(:section => {:course => :school})\n .where(:schools => {:local_id => @school_local_ids})\n end", "title": "" }, { "docid": "dfe8b100db96758c8dea982a237ef168", "score": "0.50289315", "text": "def create_scope(name, scope)\n lambda { |model, values| model.where(scope.call(values)) }\n end", "title": "" }, { "docid": "47d180fcb430a6de3f3f9488bfbbb7e4", "score": "0.50200355", "text": "def where(params)\n results = DBConnection.execute(<<-SQL, params.values)\n SELECT\n *\n FROM\n #{table_name}\n WHERE\n #{sql_criteria(params.keys)}\n SQL\n\n parse_all(results)\n end", "title": "" }, { "docid": "a2062b1b34524935f66ed2810fcf8f1b", "score": "0.501426", "text": "def where_clause\n return [] if filter_params.empty?\n\n filters = filter_params.map { |filter_string| QueueFilterParameter.from_string(filter_string) }\n\n where_string = filters.map { |filter| \"#{table_column_from_name(filter.column)} IN (?)\" }.join(\" AND \")\n where_arguments = filters.map(&:values)\n\n if filter_params.any? { |filter_string| filter_string[/typeColumn&val=.*is_aod/] }\n where_string << \" AND cached_appeal_attributes.is_aod = true\"\n end\n\n [where_string] + where_arguments\n end", "title": "" }, { "docid": "03d2e696e408421999168733b55a806a", "score": "0.50095", "text": "def not(opts = :chain, *rest)\n if opts == :chain\n @invert = true\n return self\n end\n\n opts = sanitize_forbidden_attributes(opts)\n\n where_clause = where_clause_factory_build(opts, rest)\n\n @scope.references!(PredicateBuilder.references(opts.stringify_keys)) if opts.is_a?(Hash)\n @scope.where_clause += where_clause.invert\n @scope\n end", "title": "" }, { "docid": "b7ce6d37eb8e49d3a24538189965f27d", "score": "0.49868643", "text": "def call(params)\n scoped = filter_by_date(initial_scope, params[:range], params[:from], params[:to])\n scoped = filter_by_key(scoped, params[:key])\n scoped = filter_by_value(scoped, params[:value])\n scoped = filter_by_scope(scoped, params[:scope])\n\n scoped\n end", "title": "" }, { "docid": "3e208a71f6098dd6af05e8ec5ec9218a", "score": "0.49846712", "text": "def build_where(filters)\n conditions = []\n space_arel = Space.arel_table\n space_type = Space.space_types[filters[:type]]\n\n conditions << space_arel[:space_type].eq(space_type) if space_type\n conditions << space_arel[:name].matches(wildcard(filters[:name])) if filters[:name]\n conditions << space_arel[:created_at].matches(wildcard(filters[:created_at])) if filters[:created_at]\n conditions << space_arel[:updated_at].matches(wildcard(filters[:updated_at])) if filters[:updated_at]\n conditions << space_arel[:description].matches(wildcard(filters[:description])) if filters[:description]\n conditions.reduce(nil) do |where, condition|\n where ? where.and(condition) : condition\n end\n end", "title": "" }, { "docid": "8e13e909cc201cb0b432fa007a5582bc", "score": "0.4967957", "text": "def searchable_columns(unwanted_columns)\r\n column_names.reject{ |column| unwanted_columns.include?(column) }\r\n end", "title": "" }, { "docid": "4d169fc7481c7a93fb266e128650a190", "score": "0.49601308", "text": "def scope_should_be_filtered?(scope); end", "title": "" }, { "docid": "cbeb79c7fe0afe0d08434aec19433a01", "score": "0.49560213", "text": "def sdata_scope\n options = {}\n\n if where_clause?\n predicate = SData::Predicate.parse(sdata_resource.payload_map.baze_fields, where_clause)\n options[:conditions] = predicate.to_conditions\n end\n\n if sdata_options[:scoping]\n options[:conditions] ||= []\n sdata_options[:scoping].each do |scope|\n options[:conditions][0] = [options[:conditions].to_a[0], scope].compact.join(' and ')\n 1.upto(sdata_options[:scope_param_size] || 1) do\n options[:conditions] << target_user.id.to_s\n end\n end\n end\n\n if params.key? :condition\n options[:conditions] ||= []\n if params[:condition] == \"$linked\"\n virtual_class = sdata_resource.name.demodulize\n baze_class = sdata_resource.baze_class.name.demodulize\n condition = \"id IN (SELECT bb_model_id FROM sd_uuids WHERE bb_model_type = '#{baze_class}' and sd_class = '#{virtual_class}')\"\n options[:conditions][0] = [options[:conditions].to_a[0], condition].compact.join(' and ')\n end\n end\n #FIXME: this is an unoptimized solution that may be a bottleneck for large number of matches\n #if user has hundreds of records but requests first 10, we shouldnt load them all into memory\n #but use sql query to count how many exist in total, and then load the first 10 only\n results = (params[:condition] == \"$linked\") ? sdata_resource.all_with_deleted(options) : sdata_resource.all(options)\n @total_results = results.count\n paginated_results = results[zero_based_start_index, records_to_return]\n paginated_results.to_a\n end", "title": "" }, { "docid": "98b5b61576953ef046e10f7480c698d9", "score": "0.4952722", "text": "def filter(opts = {})\n build(db.filter(opts))\n end", "title": "" }, { "docid": "baaaf78e8c84236aceeb8237079a2a97", "score": "0.49344435", "text": "def whitelist\n @columns = []\n end", "title": "" }, { "docid": "c78d0aaa0a1f12dcffa2f14fa5b262f1", "score": "0.49287036", "text": "def scope_options(condition, column, sql, options = {})\n equals = !(condition.to_s =~ /^equals/).nil?\n does_not_equal = !(condition.to_s =~ /^does_not_equal/).nil?\n\n case condition.to_s\n when /_(any|all)$/\n any = $1 == \"any\"\n join_word = any ? \" OR \" : \" AND \"\n searchlogic_lambda(column.type, :skip_conversion => options[:skip_conversion]) { |*values|\n unless values.empty?\n if equals && any\n has_nil = values.include?(nil)\n values = values.flatten.compact\n sql = attribute_condition(\"#{table_name}.#{column.name}\", values)\n subs = [values]\n\n if has_nil\n sql += \" OR \" + attribute_condition(\"#{table_name}.#{column.name}\", nil)\n subs << nil\n end\n\n {:conditions => [sql, *subs]}\n else\n values.flatten!\n values.collect! { |value| value_with_modifier(value, options[:value_modifier]) }\n\n scope_sql = values.collect { |value| sql }.join(join_word)\n\n {:conditions => [scope_sql, *values]}\n end\n else\n {}\n end\n }\n else\n searchlogic_lambda(column.type, :skip_conversion => options[:skip_conversion]) { |*values|\n values.collect! { |value| value_with_modifier(value, options[:value_modifier]) }\n\n new_sql = if does_not_equal && values == [nil]\n sql.gsub('!=', 'IS NOT')\n elsif equals && values == [nil]\n sql.gsub('=', 'IS')\n else\n sql\n end\n\n {:conditions => [new_sql, *values]}\n }\n end\n end", "title": "" }, { "docid": "a4af13f9ad363ea37a925c9b2b72f42e", "score": "0.49275926", "text": "def get_generated_filters\n filters = []\n @columns.each do |column|\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_eql\",\n \"{{#{@table_name}.#{column.name}}} = #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_like\",\n \"{{#{@table_name}.#{column.name}}} LIKE #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_lt\",\n \"{{#{@table_name}.#{column.name}}} < #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_gt\",\n \"{{#{@table_name}.#{column.name}}} > #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n end\n \n @relations.each do |relation|\n filters << ::Schema::Mapping::Filter.new(\"#{relation.name}_exists\",\n \"{{#{relation.to_table}.#{relation.to_model.get_primary_column.name}}} IS NOT NULL\")\n end\n \n return filters\n end", "title": "" }, { "docid": "b4b3d496f1f9fe5f3662407241826bcd", "score": "0.49256077", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n arel_columns = column_names.map { |c| Arel::Attribute.new(s, c) }\n Trade::SandboxTemplate.select('*').from(\"#{table_name}_view\").where(\n arel_columns.shift.eq(arel_columns.shift)\n )\n end", "title": "" }, { "docid": "d39449ea3c5e7c08938dfb1f589d64f3", "score": "0.49189636", "text": "def destroy_scope\n return targets if source_keys.empty?\n case Harmonize::Models::Orm.to_s\n when 'ActiveRecord'\n targets.where(\"#{harmonizer.key} NOT IN (?)\", source_keys)\n when 'Mongoid'\n targets.not_in(harmonizer.key => source_keys)\n end\n end", "title": "" }, { "docid": "ddc175075c9d91f71e42ce39a1b6c84d", "score": "0.49155408", "text": "def list\n list_scope_columns.inject(self.class.list) do |relation, column|\n relation.send(:bound_equality, column.to_s, read_attribute(column))\n end\n end", "title": "" }, { "docid": "9060623ee89cd2aabbb19f1d7144d40f", "score": "0.4895742", "text": "def with_scope(opt)\n\t\t\t\t\t\t\t@dynamic_columns_value[:scope] = opt\n\n\t\t\t\t\t\t\t@scope\n\t\t\t\t\t\tend", "title": "" }, { "docid": "9060623ee89cd2aabbb19f1d7144d40f", "score": "0.4895742", "text": "def with_scope(opt)\n\t\t\t\t\t\t\t@dynamic_columns_value[:scope] = opt\n\n\t\t\t\t\t\t\t@scope\n\t\t\t\t\t\tend", "title": "" }, { "docid": "9060623ee89cd2aabbb19f1d7144d40f", "score": "0.4895742", "text": "def with_scope(opt)\n\t\t\t\t\t\t\t@dynamic_columns_value[:scope] = opt\n\n\t\t\t\t\t\t\t@scope\n\t\t\t\t\t\tend", "title": "" }, { "docid": "6ba7a899277baba33dd5d3fa2728cff1", "score": "0.4893875", "text": "def records_for_table(table_name, ignore_columns = [])\n strip_columns_from_records(@records_in_tables[table_name], table_name, ignore_columns)\n end", "title": "" }, { "docid": "9c92753853c3939259823c3bdee4100b", "score": "0.4888165", "text": "def search_by_columns(column_hash:, select: '', limit: 50_000, populate_null_columns: false)\n where_string = column_hash.map do |k, v|\n column_name = \"#{k}_alias\"\n \"#{@column_name_hash[column_name]} = '#{v}'\"\n end.join(' AND ')\n\n data = @soda_client.get(\n Figaro.env.issuer_dataset,\n '$limit' => limit,\n '$select' => select,\n '$where' => where_string\n )\n return create_missing_columns(data) if populate_null_columns\n\n data\n end", "title": "" }, { "docid": "711c16922c27d7999b201977ba612eac", "score": "0.48839113", "text": "def filter(table_name, column_name, proc)\n\n # Raise an error if the filter is not being performed on the main table or one of the tables that have been joined\n unless (@table.name == table_name && @table.columns.include?(column_name)) ||\n (@joins.include?(table_name) && @joins[table_name].columns.include?(column_name))\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError.new('A join was performed on a dataset without a matching table or column.')\n end\n\n # Raise an error if the proc is not a valid proc\n unless proc.class == Proc && proc.arity == 1\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError.new('The proc used to filter a dataset was not a valid Proc.')\n end\n\n # Save the filter\n @filters << {table_name: table_name, column_name: column_name, proc: proc}\n\n # Rebuild the dataset\n fetch\n end", "title": "" }, { "docid": "c7e3361e090d624d899a5f38f60166c2", "score": "0.48825812", "text": "def where(args)\n # Try and find a primary key\n if has_primary_key? and args.keys.include? @primary_key\n idx = @pk_map[args[@primary_key]]\n return [@table[idx]]\n end\n indexed_cols = find_valid_indices(args.keys)\n\n results = @table.to_set\n\n # First restrict the query as far as we can with indices\n unless indexed_cols.empty?\n indexed_cols.each do |col|\n results = restrict_with_index(col, args[col], results)\n end\n end\n\n # Then, perform table scans for the rest of the restrictions\n # Removed the indexed columns\n args = args.reject { |col, val| indexed_cols.include? col }\n #slow O(N) find\n args.each_pair do |col, val|\n results = restrict_with_table_scan(col, val, results)\n end\n results.to_a\n end", "title": "" }, { "docid": "83a626fdbab84f3ef2a0fa662e4ad437", "score": "0.48755202", "text": "def create_hstore_key_availability_scopes(column)\n named_scope \"#{column}_has_key\".to_sym, Proc.new{ |key|\n { :conditions => [\"#{column} ? :key\", {:key => key}] }\n }\n named_scope \"#{column}_has_all_keys\".to_sym, Proc.new{ |keys|\n { :conditions => [\"#{column} ?& ARRAY[:keys]\", {:keys => Array(keys)}] }\n }\n named_scope \"#{column}_has_any_key\".to_sym, Proc.new{ |keys|\n { :conditions => [\"#{column} ?| ARRAY[:keys]\", {:keys => Array(keys)}] }\n }\n end", "title": "" }, { "docid": "83a626fdbab84f3ef2a0fa662e4ad437", "score": "0.48755202", "text": "def create_hstore_key_availability_scopes(column)\n named_scope \"#{column}_has_key\".to_sym, Proc.new{ |key|\n { :conditions => [\"#{column} ? :key\", {:key => key}] }\n }\n named_scope \"#{column}_has_all_keys\".to_sym, Proc.new{ |keys|\n { :conditions => [\"#{column} ?& ARRAY[:keys]\", {:keys => Array(keys)}] }\n }\n named_scope \"#{column}_has_any_key\".to_sym, Proc.new{ |keys|\n { :conditions => [\"#{column} ?| ARRAY[:keys]\", {:keys => Array(keys)}] }\n }\n end", "title": "" }, { "docid": "f3644d5835341f95064dc8d3bd5eabb7", "score": "0.48732665", "text": "def with_param_filters(params = {}, whitelist = nil)\n return where(nil) unless params.any?\n \n # Populate whitelist\n params = params.stringify_keys.except('action', 'controller')\n tbl = self.klass.table_name\n cols = self.klass.column_names\n whitelist = self.klass.column_names unless whitelist\n \n # Go through each param and get the real\n # operator. Keep if an actual column and part\n # of the whitelist\n sql_chain = []\n sql_values = []\n params.each do |param,value|\n # Skip param if hash\n next if value.kind_of?(Hash)\n \n real_param = param.dup\n real_str_op = \"=\"\n \n # Sort to get longest string first\n WITH_PARAMS_MAPPING.keys.sort { |a,b| b.length <=> a.length }.each do |str_op|\n if real_param.gsub!(str_op,'')\n real_str_op = WITH_PARAMS_MAPPING[str_op]\n break\n end\n end\n \n if whitelist.include?(real_param) && cols.include?(real_param)\n sql_chain.push(\"#{tbl}.#{real_param} #{real_str_op} ?\")\n \n real_value = value\n # Automatically parse iso8601 dates\n if real_value =~ /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/\n real_value = Time.iso8601(value).utc\n end\n \n sql_values.push(real_value)\n else\n return where(\"1 = 2\")\n end\n end\n \n if sql_chain.any?\n return where(sql_chain.join(\" AND \"), *sql_values)\n else\n return where(nil)\n end\n end", "title": "" }, { "docid": "15ab3c453e46460e7eaba609d8787c6f", "score": "0.48725766", "text": "def selection_sql(final_scope_options={})\n # TODO: BROKEN!!! Use table aliases when associations reference the same table\n from_tables = association_chain.flat_map do |association|\n [\n quote(association.associated_table),\n (quote(association.join_table) if is_join?(association))\n ].compact\n end\n from_sql = \"FROM #{from_tables.join(', ')}\"\n\n # use only where for intermediate scopes\n *intermediate_sqs, last_subquery = subquery_chain\n intermediate_where_clauses = intermediate_sqs.flat_map do |subquery|\n [\n join_cond_sql(subquery.association), # consider using FROM t1 INNER JOIN t2 ON t1.x = t2.y\n subquery.association.scope.stringify_keys[WHERE_KEY]\n ]\n end.compact\n\n # final_scope_options always override any client-supplied scope options, which override association scope options\n ass_scope = last_subquery.association.scope.stringify_keys\n client_scope = last_subquery.scope_options.stringify_keys.slice(*allowed_client_scope_options)\n final_scope = final_scope_options.stringify_keys\n\n where_sql = \"WHERE (#{join_cond_sql(last_subquery.association)})\"\n intermediate_where_clauses.each { |where_clause| where_sql << \" AND (#{where_clause})\" }\n\n # Combine all WHEREs\n client_scope[WHERE_KEY] and where_sql << \" AND (#{client_scope[WHERE_KEY]})\"\n ass_scope[WHERE_KEY] and where_sql << \" AND (#{ass_scope[WHERE_KEY]})\"\n final_scope[WHERE_KEY] and where_sql << \" AND (#{final_scope[WHERE_KEY]})\"\n\n # Cascade ORDER, LIMIT and OFFSET\n if the_order = final_scope[ORDER_KEY] || client_scope[ORDER_KEY] || ass_scope[ORDER_KEY]\n where_sql << \" ORDER BY (#{the_order})\"\n end\n\n if the_limit = final_scope[LIMIT_KEY] || client_scope[LIMIT_KEY] || ass_scope[LIMIT_KEY]\n where_sql << \" LIMIT #{the_limit.to_i}\"\n end\n\n if the_offset = final_scope[OFFSET_KEY] || client_scope[OFFSET_KEY] || ass_scope[OFFSET_KEY]\n where_sql << \" OFFSET #{the_offset.to_i}\"\n end\n\n \"#{from_sql}\\n #{where_sql}\"\n end", "title": "" }, { "docid": "50a390c8a6c37d611dfbb2c7f5c6a8e0", "score": "0.48607665", "text": "def filter_by_conditions (filter_columns)\n\t\tquery = filter_columns.keys.map {|c| c =~ /id$/ ? \"#{c} = ?\" : \"#{c} LIKE ?\"}.join(' AND ')\n\t\tdata = filter_columns.keys.map {|c| c =~ /id$/ ? \"#{filter_columns[c]}\" : \"%#{filter_columns[c]}%\"}\n\t\t[query] + data\n\tend", "title": "" }, { "docid": "4d8fef8b109514d7627325ecd95723d1", "score": "0.48518467", "text": "def where(args={})\n scope = spawn(\"AND\")\n scope.where!(args) if args\n end", "title": "" }, { "docid": "5e71819e015a00090a80c7ce5d3eb393", "score": "0.4841517", "text": "def not(opts = :chain, *rest)\n where_value = @scope.send(:build_where, opts, rest).map do |rel|\n case rel\n when :chain\n @invert = true\n return self\n when NilClass\n raise ArgumentError, 'Invalid argument for .where.not(), got nil.'\n when Arel::Nodes::In\n Arel::Nodes::NotIn.new(rel.left, rel.right)\n when Arel::Nodes::Equality\n Arel::Nodes::NotEqual.new(rel.left, rel.right)\n when String\n Arel::Nodes::Not.new(Arel::Nodes::SqlLiteral.new(rel))\n else\n Arel::Nodes::Not.new(rel)\n end\n end\n\n @scope.references!(PredicateBuilder.references(opts)) if opts.is_a?(Hash)\n @scope.where_values += where_value\n @scope\n end", "title": "" }, { "docid": "59c8633ecdd9e294507e98ffbce8ff04", "score": "0.48402935", "text": "def selected_assets_scope(limit:)\n Asset.\n left_outer_joins(:fixity_checks).\n group(:id).\n order(Arel.sql \"max(fixity_checks.created_at) nulls first\").\n limit(limit)\n end", "title": "" }, { "docid": "4ae2da404f8785d61c85ef2a641a4ce2", "score": "0.4837847", "text": "def parse_filter\n @conditions ||= []\n %w( name ).each do |column|\n param_key = ( column + \"_filter\" ).to_sym\n if params[ param_key ] && params[ param_key ].length > 0 \n field = field_of_interest( column )\n @conditions << ActiveRecord::Base.send( :sanitize_sql_array, [ \"LOWER(#{ column.pluralize }.#{ field }) LIKE ?\", '%' + params[ param_key ].clean_query_string + '%' ] ) if ( !field.nil? && params[ param_key ].clean_query_string.length > 0 )\n end\n end\n end", "title": "" }, { "docid": "070ad122028e5eef2408924473ccf66f", "score": "0.48208082", "text": "def belongs_to_record_scopes\n @belongs_to_record_scopes ||= to_a.each_with_object({}) do |record, results|\n scope_that_belongs_to_will_want = where(table[primary_key].eq(record.id))\n scope_that_belongs_to_will_want.instance_variable_set(\"@loaded\", true)\n scope_that_belongs_to_will_want.instance_variable_set(\"@records\", [record])\n results[scope_that_belongs_to_will_want.to_sql] = scope_that_belongs_to_will_want\n end.freeze\n end", "title": "" }, { "docid": "55816d2245e721566fa80e0f14f78846", "score": "0.4820574", "text": "def ensure_columns_are_filterable! columns\n columns.each do |col|\n raise \"Unable to filter #{self} on column '#{col}'\" unless filter_type( col )\n end\n end", "title": "" }, { "docid": "147e183e8c028fb06a73d607507f9576", "score": "0.48181897", "text": "def with_exclusive_scope(method_scoping = {}, &block)\n if method_scoping.values.any? { |e| e.is_a?(DatastaxRails::Relation) }\n raise ArgumentError, <<-MSG\nNew finder API can not be used with_exclusive_scope. You can either call unscoped to get an anonymous scope not bound to the default_scope:\n\nUser.unscoped.where(:active => true)\n\nOr call unscoped with a block:\n\nUser.unscoped do\nUser.where(:active => true).all\nend\n\nMSG\n end\n with_scope(method_scoping, :overwrite, &block)\n end", "title": "" }, { "docid": "d1bc47c35f0d408cec65285c75d8b276", "score": "0.48118025", "text": "def filter_params(view_column) #:nodoc:\n column_name = view_column.attribute_name_fully_qualified_for_all_but_main_table_columns\n if @status[:f] and @status[:f][column_name]\n @status[:f][column_name]\n else\n {}\n end\n end", "title": "" }, { "docid": "bab71d37cf32686bc98c1e19de6238fa", "score": "0.48080817", "text": "def filter_params(view_column) #:nodoc:\n column_name = view_column.attribute_name_fully_qualified_for_all_but_main_table_columns\n if @status[:f] && @status[:f][column_name]\n @status[:f][column_name]\n else\n {}\n end\n end", "title": "" } ]
545a8c16110edb5704948cdda3cace50
Replace Management Report Notification
[ { "docid": "7319aaef641128c68985766dc0571cab", "score": "0.0", "text": "def company_management_id_management_report_notifications_management_report_notification_id_put_with_http_info(id, management_report_notification_id, management_report_notification, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ManagementReportNotificationsApi.company_management_id_management_report_notifications_management_report_notification_id_put ...\"\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 ManagementReportNotificationsApi.company_management_id_management_report_notifications_management_report_notification_id_put\"\n end\n # verify the required parameter 'management_report_notification_id' is set\n if @api_client.config.client_side_validation && management_report_notification_id.nil?\n fail ArgumentError, \"Missing the required parameter 'management_report_notification_id' when calling ManagementReportNotificationsApi.company_management_id_management_report_notifications_management_report_notification_id_put\"\n end\n # verify the required parameter 'management_report_notification' is set\n if @api_client.config.client_side_validation && management_report_notification.nil?\n fail ArgumentError, \"Missing the required parameter 'management_report_notification' when calling ManagementReportNotificationsApi.company_management_id_management_report_notifications_management_report_notification_id_put\"\n end\n # resource path\n local_var_path = \"/company/management/{id}/managementReportNotifications/{managementReportNotificationId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'managementReportNotificationId' + '}', management_report_notification_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(management_report_notification)\n auth_names = ['BasicAuth']\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 => 'ManagementReportNotification')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementReportNotificationsApi#company_management_id_management_report_notifications_management_report_notification_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "b6c9a5cfd10761f893c5744f210ad7ba", "score": "0.6042317", "text": "def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end", "title": "" }, { "docid": "890a00cb74dd4ff61aa7abf89b6f2b23", "score": "0.59540063", "text": "def notification_document_name\n \"notification-report_#{external_id}_#{Time.now.utc.strftime('%Y%m%d%k%M%S')}\"\n end", "title": "" }, { "docid": "761b7176fcdf6c84035852956f06d5bd", "score": "0.58311015", "text": "def set_report\n end", "title": "" }, { "docid": "cd5a40ef8ccac638a302192afa39d3ba", "score": "0.5818371", "text": "def send_notification\n AdminMailer.delay.new_report(self)\n end", "title": "" }, { "docid": "37b2a4cae5e1e75ba77133678dc8c16a", "score": "0.5794858", "text": "def show_report\n Notifications::Registry.show_missed_notifications\n end", "title": "" }, { "docid": "13f9c962c6b0dc87f96633ddacd34c9e", "score": "0.57419115", "text": "def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end", "title": "" }, { "docid": "86d66f1c742a9cc500350653886d8dd4", "score": "0.57409453", "text": "def upload_notification_report!\n upload_document\n\n nil\n end", "title": "" }, { "docid": "31eec8fba3f93d7a6ad7ee4957dff749", "score": "0.57251036", "text": "def notification_report\n begin\n file = PdfExportService.create_and_save_pdf(\"notification_report_pdf_template\", self)\n Base64.encode64(file)\n rescue StandardError\n raise PDFGenerationError\n end\n end", "title": "" }, { "docid": "8851aacde65ef70c30d4b5b1ebcf76a0", "score": "0.5718704", "text": "def send_email_changed_notification; end", "title": "" }, { "docid": "f47b568a481974e2033740561a160c05", "score": "0.565659", "text": "def following_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "title": "" }, { "docid": "1b8ef57800ab11fe75a366b96efea964", "score": "0.56496227", "text": "def update\n respond_to do |format|\n if @action_report.update(action_report_params)\n format.html { redirect_to @action_report, notice: 'Action report was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_report }\n if @action_report.status == 'Closed'\n PilotNotifierMailer.ActionReportClosed(@action_report).deliver_later\n end\n else\n format.html { render :edit }\n format.json { render json: @action_report.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f271acd7c70f8cf5446fb446ec21967", "score": "0.56478906", "text": "def report_update(text)\n body = \"#{I18n.t(:via)} #{@sender.shorter_name}: #{text}\" # Will accept messages longer than 150, though I don't think gateways will do this\n sms_only = insert_sender_name(text, @sender)\n message = Message.new(:user_id => @sender.id, :send_sms=>false, :news_update => true, \n :sms_only => sms_only, :body => body, :expiration => 240) \n message.deliver # Don't forget to deliver!\n moderator_group = Group.find_by_group_name('Moderators')\n if moderator_group\n message = Message.new(:user_id => @sender.id, :send_sms=>true, :send_email => true, :to_groups => moderator_group.id,\n :news_update => false, :sms_only => \"#{@sender.shorter_name} rprts: #{text}\", \n :body => \"#{@sender.shorter_name} reports: #{text}\") \n message.deliver\n end\n expiration_time_string = I18n.t(:hour, :count => Message.default_news_expiration)\n return I18n.t('sms.update_saved', :text => text[0..15], :exp_time => expiration_time_string) \n end", "title": "" }, { "docid": "f7bb8689ca127d938138f1dca36cd5da", "score": "0.56258667", "text": "def send_cleared_notification(server, metric)\n subject = \"[WATCHCAT] Issue CLEARED on #{server}\"\n body = \"#{server} #{metric} problem has cleared.\"\n \n #send email\n send_mail(subject,body)\nend", "title": "" }, { "docid": "a2c3bbece23f1b06b5b63df6cc9a4f43", "score": "0.55949736", "text": "def send_email_changed_notification?; end", "title": "" }, { "docid": "b5fec731185ebee22e02a4f64329ff59", "score": "0.55889046", "text": "def create_new_report!; end", "title": "" }, { "docid": "b5fec731185ebee22e02a4f64329ff59", "score": "0.55889046", "text": "def create_new_report!; end", "title": "" }, { "docid": "e7eebb201838c8fc4b8ed7f62aede50f", "score": "0.55731535", "text": "def update_report(site)\n @logs = Site.find(site).logs\n @site = site\n\n mail to: \"[email protected]\", subject: site.name + ' ' + Time.now.to_formatted_s(:short)\n end", "title": "" }, { "docid": "b676d5d82b81d782c1848bd013907b3b", "score": "0.55435187", "text": "def new_notification\n mail(to: \"[email protected]\", subject: 'New Notification', sent_on: Time.now)\n end", "title": "" }, { "docid": "0ad03d3a4da0d4ece651f700e91a49b5", "score": "0.553471", "text": "def deliver_process_notification\n deliver_contributor_notification(:processing_payment)\n end", "title": "" }, { "docid": "0132012dcdab12feb3fbbaf3486fa32c", "score": "0.5527463", "text": "def report_status_icon(report)\n render 'reports/report_status_icon', :report => report\n end", "title": "" }, { "docid": "da698228a53e1e35a305d3de5cd09128", "score": "0.5488452", "text": "def report_title; end", "title": "" }, { "docid": "da698228a53e1e35a305d3de5cd09128", "score": "0.5488452", "text": "def report_title; end", "title": "" }, { "docid": "bd0ab229145a85b6d6b22466bf14a688", "score": "0.5459919", "text": "def send_report\n @user_attentions = current_user.attention.where(:report => 'open')\n respond_to do |format|\n @user_attentions.update_all(report: \"send\")\n format.html { redirect_to swatenttions_url, notice: 'El Reporte ha sido enviado con éxito.' }\n format.json { head :no_content }\n end \n end", "title": "" }, { "docid": "2d00adf0092e7ec1d03f6363d4dfc5fc", "score": "0.5443963", "text": "def reporting\n # STUB\n end", "title": "" }, { "docid": "8b0d69ad4c9cae0ef508b04fc58ce740", "score": "0.54403204", "text": "def employeer_notification\n NotificationMailer.employeer_notification\n end", "title": "" }, { "docid": "47afc611dad014dbea4e028bba2bc969", "score": "0.54339516", "text": "def check_notification\n referral = self\n admin = referral.job.admin\n\n if referral.is_interested == true && referral.is_admin_notified == false\n # binding.pry\n if referral.update_attribute(:is_admin_notified, true)\n ReferralMailer.deliver_admin_notification(referral, admin)\n referral.save\n else\n render 'edit', error: \"We had an issue with your referral request. Please try again.\"\n end\n end\n end", "title": "" }, { "docid": "7838f680e06aea7c4a08b836acda00d5", "score": "0.54326916", "text": "def update_reports\n\n\t\tremove_reports\n\n\t\texisting_report_ids = self.reports.map{|c|\n\t\t\tc.id.to_s\n\t\t}\n\n\t\t## after this the quantity issue\n\t\t## and then the test verification toggles, textual inference, and report generation ->\n\t\t## so only if the order is finalized, then \n\t\t## now the worth processing.\n\t\t## local item group\n\t\t## organization from \n\n\t\tself.template_report_ids.each do |r_id|\n\t\t\t#puts \"doing template report id: #{r_id}\"\n\t\t\tunless existing_report_ids.include? r_id\n\t\t\t\ttx = Time.now\n\t\t\t\tself.finalize_order = NO\n\t\t\t\t## unfinalize the order\n\t\t\t\t## \n\t\t\t\t## get teh report raw hash.\n\t\t\t\t## get rid of the non-applicable ranges\n\t\t\t\t## and only then initialize the object.\n\t\t\t\t## that will make it much faster.\n\t\t\t\treport = Diagnostics::Report.find(r_id)\n\t\t\t\t\n\t\t\t\tty = Time.now\n\t\t\t\tputs \"time to get report: #{(ty - tx).in_milliseconds}\"\n\t\t\t\treport.created_by_user = User.find(report.created_by_user_id)\n\t\t\t\treport.current_user = self.current_user\n\t\t\t\ttz = Time.now\n\t\t\t\tputs \"time to get created by user: #{(tz - ty).in_milliseconds}\"\n\t\t\t\treport.run_callbacks(:find)\n\t\t\t\tt1 = Time.now\n\t\t\t\tputs \"time to run callbacks: #{(t1 - tz).in_milliseconds}\"\n\t\t\t\treport.prune_test_ranges(self.patient)\n\t\t\t\tt2 = Time.now\n\t\t\t\tputs \"prune ranges took: #{(t2-t1).in_milliseconds}\"\n\t\t\t\tself.reports << report\n\t\t\t\tself.order_completed = NO\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "23a6951c05eb5ece8cfa5bfbc9603b2e", "score": "0.5416149", "text": "def send_notification\n ::Refinery::Inquiries::InquiryMailer.published_notification(self).deliver if (self.page_status_id_changed? and self.page_status_id == 2)\n end", "title": "" }, { "docid": "8302487dfb3dc53b6391ebb0ae6fdaad", "score": "0.5415766", "text": "def create_notification; end", "title": "" }, { "docid": "0abded13b53562b53fb3e31a0b0201cf", "score": "0.54110223", "text": "def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(link: \"/reports/#{@report.id}\")\n subject = \"[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "title": "" }, { "docid": "c6d96fe1677102880b06f6d65605106d", "score": "0.54070044", "text": "def admin_behavior_warning(email, company_phone, notification)\n @company_phone = company_phone\n @company = @company_phone.company\n @notification = notification\n mail(\n to: email,\n subject: 'GurúComm | Una línea esta cerca del límite de uso'\n )\n end", "title": "" }, { "docid": "9b8926ab4292ab1af330c12290e38b62", "score": "0.5406466", "text": "def notify_modification\n if @ok\n msg = params[:details_placeholder].blank? ? '' : params[:details]\n @lesson.notify_changes msg\n end\n end", "title": "" }, { "docid": "9b78e9c4b6dedd07fa02a948313d77eb", "score": "0.5397375", "text": "def cop_reports=(_); end", "title": "" }, { "docid": "d231168c4fd936fa208bdf640e50f8ed", "score": "0.53743726", "text": "def new_record_notification(record)\n @record = record\n @phase = Phase.find(record.phase_id)\n @goal = Goal.find(@phase.goal_id)\n @user = User.find(@goal.user_id)\n\n mail to: @user.email, subject: \"Don't Break The Streak!\"\n end", "title": "" }, { "docid": "13d4697d40190560a44c931a0e8b53e1", "score": "0.53682506", "text": "def create_global_report\n super\n end", "title": "" }, { "docid": "cd3bca9bbb0e4e2979e07e6677e80957", "score": "0.53598714", "text": "def first_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n mail to: @user.email,\n subject: \"[bootcamp] #{@report.user.login_name}さんがはじめての日報を書きました!\"\n end", "title": "" }, { "docid": "b52f0c7f28f35e362b23bac828a12376", "score": "0.53526133", "text": "def due_next_week_warning_mail\n PetitionMailer.due_next_week_warning_mail(Petition.live.first)\n end", "title": "" }, { "docid": "8322d3058a2ce4e8037f3c06d89d4762", "score": "0.5332493", "text": "def notify_final_delivery\n @reports = Reports.find( :all )\n @delivery = Packages.find( :all )\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.new\n @notification.users_id = s.senders_id\n @notification.description = \"You should confirm the delivery of the package\"\n @notification.save\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "5e97290480315fb9f9974ca1c5b76cfe", "score": "0.532155", "text": "def update!(**args)\n @report_requests = args[:report_requests] if args.key?(:report_requests)\n end", "title": "" }, { "docid": "5e97290480315fb9f9974ca1c5b76cfe", "score": "0.532155", "text": "def update!(**args)\n @report_requests = args[:report_requests] if args.key?(:report_requests)\n end", "title": "" }, { "docid": "10445fe506a8fee33e79b770ff2da6b5", "score": "0.5319225", "text": "def reassigned_findings_notification\n new_users = User.last(2)\n old_users = User.joins(:findings).first(1)\n findings = old_users.first.findings\n\n NotifierMailer.reassigned_findings_notification new_users, old_users, findings, false\n end", "title": "" }, { "docid": "dc710e921699a73d8eb54080e16ebf2a", "score": "0.53181505", "text": "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", "title": "" }, { "docid": "99f7faccaccd59075c979ce527e25b48", "score": "0.53143567", "text": "def report_pending\n organization = Organization.pending.find(params[:id]) \n organization.report \n \n flash[:notice] = \"This user has been reported.\"\n # Show the same page, or redirect to surveys path, if the user clicked an email link\n redirect_to request.env['HTTP_REFERER'] || surveys_path\n end", "title": "" }, { "docid": "5c147b538a3de09582142e1709373e02", "score": "0.53127635", "text": "def update_nc_log\n type = Parameter.as_hash[self.notice_type].parameter_id\n \n params = {\n :operation_id => Transactions::MODIFY_NOTICE,\n :job_id => self.job_id,\n :drawing_id => '',\n :part_id => '',\n :quantity => '',\n :reason => '',\n :description => 'Modify Job Notice',\n :user => self.updated_by,\n :revision => '',\n :key => type + \" \" + self.notice_id\n }\n Transaction.record_transaction(params)\n end", "title": "" }, { "docid": "e2de3513aa79d1ca637d62ea72401d7d", "score": "0.5309045", "text": "def maintenance_update(statuspage_id, maintenance_id, maintenance_details, notifications = 0, message_subject = \"Maintenance Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n data['maintenance_details'] = maintenance_details\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/update',\n :payload => data\n end", "title": "" }, { "docid": "dee768e1011979d6dfc9b443b243e4c9", "score": "0.53085804", "text": "def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end", "title": "" }, { "docid": "b2dcb67ecd14256807d8c7696c3665f7", "score": "0.529997", "text": "def after_generate_pdf\n\t\tsend_notifications\n\tend", "title": "" }, { "docid": "b2dcb67ecd14256807d8c7696c3665f7", "score": "0.529997", "text": "def after_generate_pdf\n\t\tsend_notifications\n\tend", "title": "" }, { "docid": "c1f32c9c350cc517d6c090105b6c34a5", "score": "0.5297852", "text": "def update\r\n\t\tif @notification.update(notification_params)\r\n\t\t\tAction.create(info: current_user.username + ' has seen this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "dde568d6308839cbb417a2c9e53a5ff5", "score": "0.52945334", "text": "def send_notification(mailFrom, mailTo, mailDomain, mailServer, noticeContent, debug)\n\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\nmessage = <<MESSAGE_END\nFrom: #{mailFrom} \nTo: #{mailTo}\nMIME-Version: 1.0\nContent-type: text/html\nSubject:#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})\n\n<h3>#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})</h3>\nLink to IDS or other system showing the vulnerability or compromise<br/>\nhttps://#{noticeContent[:console]}:#{noticeContent[:conPort]}/vulnerability/vuln-summary.jsp?vulnid=#{noticeContent[:vulnId]}&devid=#{noticeContent[:devId]}<br/>\n\n<p>\n<h3>Issue Summary:</h3>\nA recent scan of #{noticeContent[:ipAddress]} indicates a vulnerability on the system.<br/>\nThe following issue was detected: #{noticeContent[:vulnTitle]}\n<h3>Description of the issue:</h3>\n#{noticeContent[:description]}\n</p>\n\n<p>\n<h3>Event Type:</h3>\nVulnerable\n</p>\n<p>\n<h3>Host(s) Affected:</h3>\n#{noticeContent[:ipAddress]}:#{noticeContent[:port]} / #{noticeContent[:proto]}<br/>\nHostname: #{noticeContent[:hostName]}<br/>\n Detected Aliases: #{noticeContent[:otherNames]}<br/>\nMachine Address: #{noticeContent[:macAddress]}<br/>\n\n</p>\n<p>\nTime of Detection: #{noticeContent[:date]} <br/>\nLevel of Confidence: #{noticeContent[:confirmation]}<br/>\n</p>\n<h3>Evidence/Testing Results</h3>\n#{noticeContent[:proof]}\n#{noticeContent[:solText]}\n\n<br/>\n<i>#{noticeContent[:nexposeId]}</i>\n\n\nMESSAGE_END\n\n begin\n Net::SMTP.start(mailServer) do |smtp|\n smtp.send_message message, mailFrom, mailTo\n end\n\n rescue => err\n $stderr.puts(\"Fail: #{err}\")\n exit(1)\n end\nend", "title": "" }, { "docid": "1a5eb83e2c8b3025a400ab2e044e43d5", "score": "0.52935576", "text": "def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "title": "" }, { "docid": "e8ed99be50f569bb9c592f286f0982cf", "score": "0.529006", "text": "def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend", "title": "" }, { "docid": "8e8b674bbc686c7c3dae6e02cf2d7dc7", "score": "0.52860963", "text": "def changes_notification\n NotifierMailer.changes_notification(User.limit(2), {\n title: 'Email test title',\n content: 'Email test content',\n body: 'Email test body'\n })\n end", "title": "" }, { "docid": "217c354bb30d8d4f338a63b689d74b45", "score": "0.52807486", "text": "def notification(inquiry)\n @inquiry = inquiry\n\n mail :to => @inquiry.email, :subject => \"New Inquiry\"\n end", "title": "" }, { "docid": "e366a8b6e39e7dcdf098f0274ff2600c", "score": "0.5275127", "text": "def notification\n BookingMailer.notification\n end", "title": "" }, { "docid": "754a48123ef31946def0ed2721ef046b", "score": "0.52740633", "text": "def notify_all\n if @size > 0\n @report << \"#{@size} abonnement(s) à notifier\"\n do_notify_all\n @report << Registry.report_missed_notifications\n else\n @report << 'Pas de notification à faire'\n end\n @report\n end", "title": "" }, { "docid": "a744aa318ea43871668d26fd4d36a178", "score": "0.5271695", "text": "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", "title": "" }, { "docid": "b02c1870ef94b6387337422f60dab2a2", "score": "0.5264584", "text": "def update_email_notification\n service_response = ClientManagement::UpdateEmailNotificationSetting.new(params).perform\n render_api_response(service_response)\n end", "title": "" }, { "docid": "812a1954457ebf56749ba5b7d2a7c873", "score": "0.52598083", "text": "def close_report\n\n response_str = \"NG\"\n\n news_id = Integer(params[:news_id])\n news = News.find(news_id)\n\n if(news != nil)\n news.special_flag= true\n\n news.tags = []\n tag = Tag.find_by_name(\"Closed_spam_report\") ;\n news.tags << tag\n news.save\n\n response_str = \"OK\"\n end\n\n respond_to do |format|\n format.html { render :inline => response_str }\n end\n\n\n end", "title": "" }, { "docid": "7bd77e995a545150a59ac202ac108b29", "score": "0.5259671", "text": "def write_report\n\n end", "title": "" }, { "docid": "2cdfb3d05a41e5382f1fd2ddd0ad37f5", "score": "0.52561", "text": "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end", "title": "" }, { "docid": "9af4abe1963e30baafd6e6e3bbb8e3c2", "score": "0.52557224", "text": "def show\n # notification_email\n end", "title": "" }, { "docid": "4215ddc4131f9a551a682082caa43f7a", "score": "0.5248072", "text": "def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end", "title": "" }, { "docid": "e92d155229c931e261af043d1a5a8311", "score": "0.5247228", "text": "def report=(value)\n @report = value\n end", "title": "" }, { "docid": "d3e69ec9c10daeeca4458c8505c5ba24", "score": "0.5243084", "text": "def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end", "title": "" }, { "docid": "57379dd81a19b08d532a7464ffa16d40", "score": "0.52310663", "text": "def report_data\n ReportMailer.report_data\n end", "title": "" }, { "docid": "0a6befef99c6612fb6c89deae540ecfe", "score": "0.52290845", "text": "def send_notification\n\n\n end", "title": "" }, { "docid": "82cd1b80edba3228395d404461f518ad", "score": "0.5226952", "text": "def notification_mail(reports, staff)\n @reports = reports\n @reports_keys = reports.keys\n \n @first_name = staff.first_name\n @last_name = staff.last_name\t\n\t\n\t# This is an AF kludge...need to revisit\n\tsubject = reports.size > 1 ? \"Radar Digest\" : \"Radar #{reports.first[1][0].display_name} #{reports.first[1][0].tag} (#{reports.first[1][0].staff.name})\"\n \n mail(:to => staff.email, :subject => \"#{subject}: \" + Time.now.to_s(:my_time)) \n end", "title": "" }, { "docid": "c96dc260b75be41e434bb157798e51ff", "score": "0.5218515", "text": "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", "title": "" }, { "docid": "ea584d8db070ebc2bfd469bf6cb9aaaf", "score": "0.52171654", "text": "def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "2632dc2650f3fd71a705aed09bcd5a4e", "score": "0.52124715", "text": "def replace_parameters(report)\n puts \"replacing parameters...\"\n puts\n\n report = report.gsub(\"$RESULT_A\", @result_a)\n report = report.gsub(\"$RELEASE_A_NAME\", @release_a_name)\n report = report.gsub(\"$RELEASE_A_NUMBER\", @release_a_number)\n\n report = report.gsub(\"$RESULT_B\", @result_b)\n report = report.gsub(\"$RELEASE_B_NAME\", @release_b_name)\n report = report.gsub(\"$RELEASE_B_NUMBER\", @release_b_number)\n\n report\nend", "title": "" }, { "docid": "3f76878c691673d25c16c4cd262aa826", "score": "0.5207844", "text": "def report_notifier(supplier)\n\t @supplier = supplier\n\t mail(:to => supplier.email,\n\t :subject => \"#{supplier.first_name} you just recieved a report on your local market-place\")\n end", "title": "" }, { "docid": "7953b50bd198906057d3a16030eee123", "score": "0.5207795", "text": "def report_body; end", "title": "" }, { "docid": "7953b50bd198906057d3a16030eee123", "score": "0.5207795", "text": "def report_body; end", "title": "" }, { "docid": "c35bcf0909922c3555bd54f6cbd407f5", "score": "0.5202213", "text": "def report(text)\n @status.pop(0)\n @status.push(0, text)\n end", "title": "" }, { "docid": "c35bcf0909922c3555bd54f6cbd407f5", "score": "0.5202213", "text": "def report(text)\n @status.pop(0)\n @status.push(0, text)\n end", "title": "" }, { "docid": "2eb2e50972f4debf21e130448eba0069", "score": "0.5202013", "text": "def dispute_notification(id, amount, currency)\n @id, @amount, @currency = id, amount, currency\n \n mail to: \"[email protected]\",\n subject: \"Hikarigo dispute created. Attention may be needed\"\n end", "title": "" }, { "docid": "b2878d7a1284387ee956983b20f670e4", "score": "0.5197828", "text": "def notification(grant_application, request)\n @grant_application = grant_application\n mail :subject => Refinery::GrantApplications::Setting.notification_subject,\n :to => Refinery::GrantApplications::Setting.notification_recipients,\n :from => \"[email protected]\"\n end", "title": "" }, { "docid": "aec0cecff19bfef3b06b9b55fb988125", "score": "0.51963544", "text": "def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end", "title": "" }, { "docid": "fb2cc66bea355089072deb1f9c37fa62", "score": "0.5188077", "text": "def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end", "title": "" }, { "docid": "b6ab4acbfada29c83ac1e76e264e535c", "score": "0.5181767", "text": "def update_report_stats\n reports = self.set_pupil.reports\n reports.each do |report|\n report.update_report(self) if report.report_cycle == self.task.report_cycle\n end\n end", "title": "" }, { "docid": "94b3f8df6e2c821e13edd851b5425d47", "score": "0.51742274", "text": "def set_new_relic_report\n @new_relic_report = NewRelicReport.find(params[:id])\n end", "title": "" }, { "docid": "b15de11500420b4f1b5ba090a6c9b3d0", "score": "0.51717466", "text": "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", "title": "" }, { "docid": "01cec4ed7fc56c14f35a4961f632a614", "score": "0.51701283", "text": "def report\n @report || @schedule\n end", "title": "" }, { "docid": "c1b9c8009eeaaae0de4725de392f47a0", "score": "0.51660603", "text": "def update\n @individual_report = @medical_record.individual_reports.find(params[:id])\n\n respond_to do |format|\n if @individual_report.update_attributes(params[:individual_report])\n format.html { \n flash[:notice] = _('Las modificaciones se han guardado correctamente')\n redirect_to(\n medical_record_individual_report_path(\n :medical_record_id => @medical_record.id,\n :id => @individual_report.id)) \n }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @individual_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ecd4f2747e0de857886244127275ef2", "score": "0.51645243", "text": "def update\n @weekly_report.published = true if @weekly_report.reported_time < Time.now\n respond_to do |format|\n if @weekly_report.update(weekly_report_params)\n format.html { redirect_to @weekly_report, notice: 'Weekly report was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_report }\n else\n format.html { render :edit }\n format.json { render json: @weekly_report.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc51b1d95f9749b217a306378544ba14", "score": "0.5161555", "text": "def notifications\n end", "title": "" }, { "docid": "d224e3f9d73c55c9163eb7ee852bf4b1", "score": "0.5153976", "text": "def create\n @action = 'create'\n params[:admin_journal_issue][:from] = current_admin.id\n @admin_journal_issue = Admin::JournalIssue.new(admin_journal_issue_params)\n respond_to do |format|\n if @admin_journal_issue.save\n #this method for sending message to admin about Journal issue who assign\n AdminMailer.delay(:queue => 'notification_create_journal_issue', :priority => 1).mail_journal_issue(@admin_journal_issue.id,@admin_journal_issue.asignee,\"main\")\n Admin::JournalIssue.save_attributes(@admin_journal_issue.id,params)\n format.html { redirect_to @admin_journal_issue, notice: 'Journal issue was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_journal_issue }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_journal_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84f5bcf827fd6c159b3e7d8d299f998f", "score": "0.51531976", "text": "def send_new_notifcation(server, metric, metric_details)\n servername = server.upcase\n #puts metric_details.class\n subject = \"[WATCHCAT] Issue on #{server}\"\n body = \"#{servername} has a problem with #{metric[server]}. \\n #{metric[server]} is \\n\"\n if (metric_details.class == Array)\n metric_details.each do |detail|\n detail.each do |k,v|\n body << \"#{k} - #{v} \\n\" \n end\n body << \"---------- \\n\"\n end\n else\n body << metric_details.to_s\n end\n \n #send email\n send_mail(subject, body)\n \nend", "title": "" }, { "docid": "f306514be01243fee45a35a0e7bbc89e", "score": "0.51438236", "text": "def report\n entity_class = params[:entity].camelize.constantize\n entity = entity_class.find(params[:id])\n message = params[:reason]\n user = current_filmmaker.blank? ? current_client.blank? ? nil : current_client : current_filmmaker\n UserMailer.delay.report_entity_mail(user, entity, message)\n render :text => true\n end", "title": "" }, { "docid": "0aea15afb422d874259b0a04d5cb8447", "score": "0.5143789", "text": "def comments_notify(report_id, report_comemnts, task_comments)\n @report = Report.find(report_id)\n @report_comments = report_comemnts\n @task_comments = task_comments\n\n mail(to: ADMIN_EMAILS, subject: t('.subject'))\n end", "title": "" }, { "docid": "f3ac50583b7e07025cf17ccd105391fd", "score": "0.5143115", "text": "def resend\n new_notification = self.class.new\n attrs_to_copy = ['auth_key_id', 'device_id', 'alert_body', 'action_loc_key', 'loc_key', 'loc_args', 'launch_image', 'badge', 'sound', 'content_available', 'custom_data']\n attrs_to_copy.each do |attr|\n new_notification.send(\"#{attr}=\", self.send(attr))\n end\n new_notification.save!\n new_notification\n end", "title": "" }, { "docid": "23c2a3fc9884488e8ced2dc18be4e9a4", "score": "0.51394475", "text": "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", "title": "" }, { "docid": "02f47224ecafe9f503f1fdb5bb54772b", "score": "0.512689", "text": "def new_data_request_notification(project_id)\n\t\tbegin\n @project = Project.find(project_id)\n lead_ids = UserProjectRole.find(:all, :conditions=>[\"project_id=? and role=?\", project_id, \"lead\"], :select=>['user_id'])\n lead_ids = lead_ids.empty? ? [] : lead_ids.collect{|x| x.user_id}\n lead_emails = User.find(:all, :conditions=>[\"id IN (?)\",lead_ids], :select=>[\"email\"])\n \n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - New Download Request Received\"\n recipients lead_emails.collect{|x| x.email}.join(\",\")\n sent_on Time.now\n\n\t\trescue Exception=>e \n puts \"ERROR SENDING REQUEST NOTIFACTION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n\tend", "title": "" }, { "docid": "2046933923fa74c49160fba4e97c3945", "score": "0.5125838", "text": "def skip_email_changed_notification!; end", "title": "" }, { "docid": "260cb5a404ad5649587c200747e648a8", "score": "0.511545", "text": "def release_notification\n @has_data = Settings.has_user_data\n @data = Settings.getSavedData\n \n #reset date. otherwise it's being shown all the time, once it's been set \n $choosed['1'] = nil\n end", "title": "" }, { "docid": "591c93ca1bfc4a198845f22abeddaca9", "score": "0.51131374", "text": "def status_changed(expense)\n @expense = expense\n mail to: @expense.user.email, subject: 'Expense Report Notification: The status of your expense has been changed'\n end", "title": "" }, { "docid": "796d478d9273e32ec1114ced6f66cad2", "score": "0.51127476", "text": "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", "title": "" }, { "docid": "948eb155dfa8e2dcc180cce3da996771", "score": "0.5111138", "text": "def notify\n key = KEY_FORMAT % @visualization.id\n $tables_metadata.multi do\n $tables_metadata.hset(key, @user.username, current_timestamp + @notification_ttl)\n $tables_metadata.expire(key, @notification_ttl)\n end\n end", "title": "" }, { "docid": "bd32341d95399a62d0c5d2b90900a7bd", "score": "0.5108877", "text": "def notify_new_finding_answer\n finding_answer = FindingAnswer.take\n users = finding_answer.finding.users\n\n NotifierMailer.notify_new_finding_answer users, finding_answer\n end", "title": "" }, { "docid": "2369efe7dd40b0408110c9e71263aa79", "score": "0.51087046", "text": "def update\n respond_to do |format|\n attrs = admin_report_params\n\n if [email protected]_confirmed && attrs[:reunion_confirmed]\n @report.reunion_confirmed_at = Time.now\n end\n\n if @report.update(attrs)\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", "title": "" } ]
c99b3b4909a78f12adc98c0d17a884ba
read 4 bytes if block is true; otherwise, read 2 bytes
[ { "docid": "70324862aab38c68fcbadb1e61ac0bf0", "score": "0.0", "text": "def read_index(f)\n if yield then\n f.read_dword\n else\n f.read_word\n end\n end", "title": "" } ]
[ { "docid": "717d0baf50affcf0a1166e064435b40f", "score": "0.65974385", "text": "def read\n\t\t\t\t\[email protected](BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend", "title": "" }, { "docid": "bb8fb366b3c63a86404b9e0104f36c72", "score": "0.6538941", "text": "def read_nonblock(maxlen=99, buf=\"buffer\") end", "title": "" }, { "docid": "a9414e758963da42540023869f0440cf", "score": "0.6490961", "text": "def blockinate(bytes)\n tmp = bytes.each_slice(4).to_a\n if tmp.last.size < 4\n n = 4 - tmp.last.size\n n.times { |n| tmp.last << 0 }\n end\n @blocks = tmp.each_slice(2).to_a\n if @blocks.last.size == 1\n @blocks.last << [0] * 4\n end\n end", "title": "" }, { "docid": "36bd12ec97f0a9d520ee81c91970477a", "score": "0.6286227", "text": "def read(block_num = nil)\n \tblock_num ||= @auth_block\n \traise Mifare::Error, \"Not authenticated\" unless block_num\n\n\t\t\t\tdata_ptr = FFI::MemoryPointer.new(:uchar, 16)\n res = Mifare.mifare_classic_read(@pointer, block_num, data_ptr)\n\n raise Mifare::Error, \"Can't read block 0x%02x\" % block_num if 0 != res\n\n data_ptr.get_bytes(0, 16).force_encoding(\"ASCII-8BIT\")\n end", "title": "" }, { "docid": "f729e6f81ada859b479b3c89ad9971f4", "score": "0.6183939", "text": "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "title": "" }, { "docid": "a9cb947dfeb55d33a28ac484dd577f7f", "score": "0.6168438", "text": "def read_bytes_full\n @_io.read\n end", "title": "" }, { "docid": "9766c3d15d09cee3f007fb39701af643", "score": "0.6147413", "text": "def read_next_block_header\n skip(@payload_size) if @payload_size != 0\n\n return unless (header = read_block_header_raw)\n\n block = BlockHeader.parse(header)\n @payload_size = block.payload_size\n block\n end", "title": "" }, { "docid": "0767a02b3adce52e166a0794a39487df", "score": "0.61446214", "text": "def read_byte; end", "title": "" }, { "docid": "92ae4a849ca1c8fd53a0269263af22f8", "score": "0.61330223", "text": "def read_bytes(count)\n result = @content.byteslice(@cursor, count)\n @cursor += count\n result\n end", "title": "" }, { "docid": "4ab37092733f154a4d989142bd6d024a", "score": "0.60851246", "text": "def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end", "title": "" }, { "docid": "8a2c0f1632ac1ac2f0bca9f81fc252ef", "score": "0.60783464", "text": "def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end", "title": "" }, { "docid": "6e77172849614651992ae588bef14174", "score": "0.6048641", "text": "def readpartial(size, buffer = T.unsafe(nil)); end", "title": "" }, { "docid": "6e77172849614651992ae588bef14174", "score": "0.6048641", "text": "def readpartial(size, buffer = T.unsafe(nil)); end", "title": "" }, { "docid": "6e77172849614651992ae588bef14174", "score": "0.6048641", "text": "def readpartial(size, buffer = T.unsafe(nil)); end", "title": "" }, { "docid": "bfe69dba83258d8abedb1fb1a753423d", "score": "0.6046664", "text": "def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end", "title": "" }, { "docid": "e96452b75e625f3032a8eb9359777458", "score": "0.60352373", "text": "def read_data_block(uncompress: true)\n raw_header = read_payload(Format::Current::DATA_BLOCK_HEADER_SIZE)\n raw_data = read_payload\n compressed = raw_header[-1, 1].unpack('C').first\n if uncompress && (compressed != 0)\n # Payload is compressed\n raw_data = Zlib::Inflate.inflate(raw_data)\n end\n [raw_header, raw_data]\n end", "title": "" }, { "docid": "00530837a13f13974a2bf257141eab56", "score": "0.6031583", "text": "def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end", "title": "" }, { "docid": "e84035ead27ab63f97735acec2d92d36", "score": "0.60243887", "text": "def read_file(block=0)\n Rula.log(Logger::DEBUG,\"Reading file #{filename} block #{block}\",self)\n return nil if(block >= @file_size)\n return nil if(block < 0)\n file_handle = File.open(@filename,'rb')\n file_handle.pos = block\n @previous_block_read = file_handle.pos\n data = file_handle.read(@@BLOCK_SIZE)\n @last_block_read = file_handle.pos\n Rula.log(Logger::DEBUG,\"Read #{data.length} bytes\",self)\n @file_eof = file_handle.eof\n return data\n ensure \n file_handle.close() unless file_handle.nil?\n end", "title": "" }, { "docid": "a3d95fc4e9e6996268f24d42947f7936", "score": "0.599626", "text": "def read_data\n return if @is_last_block\n\n data = @input_stream.read(BLOCK_SIZE)\n @is_last_block = true if data.nil?\n\n # add prev tail if exists\n if @prev_tail\n data = \"#{@prev_tail}#{data}\"\n @prev_tail = nil\n end\n\n data\n end", "title": "" }, { "docid": "ac67bea2e792d88c1c41a3718957f190", "score": "0.5970913", "text": "def read_one_block(pos = nil, rio = nil)\n if pos\n seek(pos, rio)\n end\n each_block(false) do |block_info|\n handle_block(block_info)\n return block_info\n end\n nil\n end", "title": "" }, { "docid": "01a2a7652053c237dbc4752fd3e58c7d", "score": "0.5970385", "text": "def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end", "title": "" }, { "docid": "13f98093a7566285af02d76e5ec40146", "score": "0.59620434", "text": "def readBlock(pieceIndex, offset, length)\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :read_block, pieceIndex, offset, length]\n @requestsSemaphore.signal\n id\n end", "title": "" }, { "docid": "48f870b5f07d222ac83fbce0c0b7f705", "score": "0.59609395", "text": "def readbyte\n end", "title": "" }, { "docid": "04672c13546386efa2f70a207b49f633", "score": "0.59435755", "text": "def read_data_block_payload\n skip(Format::Current::DATA_BLOCK_HEADER_SIZE - 1)\n compressed = read_payload(1).unpack('C').first\n data = read_payload\n if compressed != 0\n # Payload is compressed\n data = Zlib::Inflate.inflate(data)\n end\n data\n end", "title": "" }, { "docid": "1c00344b769b84d9eae62b6a47c9e2c8", "score": "0.59234643", "text": "def read_partial(length = nil)\n if @buffer\n buffer = @buffer\n @buffer = nil\n else\n buffer = read_next\n end\n\n if buffer and length\n if buffer.bytesize > length\n # This ensures the subsequent `slice!` works correctly.\n buffer.force_encoding(Encoding::BINARY)\n\n @buffer = buffer.byteslice(length, buffer.bytesize)\n buffer.slice!(length, buffer.bytesize)\n end\n end\n\n return buffer\n end", "title": "" }, { "docid": "24daeebf7ac654accebcab72529cf634", "score": "0.59217453", "text": "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", "title": "" }, { "docid": "20535f982a2c52f7b5783da8d07d9471", "score": "0.5909272", "text": "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "title": "" }, { "docid": "ada372cc8aad0a0ac49d6c2fe9b92521", "score": "0.5903591", "text": "def read(length)\n return nil if (@offset + length) > @buffer.bytesize\n\n chunk = @buffer.byteslice(@offset, length)\n @offset += chunk.bytesize\n\n prune if @offset > MINIMUM_AUTOMATIC_PRUNE_OFFSET\n\n return chunk\n end", "title": "" }, { "docid": "5e741b1ffa8f4fa4580f782a87c482f0", "score": "0.58816785", "text": "def read(&block)\n @read_block = block\n end", "title": "" }, { "docid": "74697d8dc448eb5f460e564375dae680", "score": "0.5857276", "text": "def reverse_read(length, block_aligned=false)\n raise \"length must be a multiple of 512\" if block_aligned and length % 512 != 0\n\n end_pos = pos\n return nil if end_pos == 0\n\n if block_aligned\n misalignment = end_pos % length\n length += misalignment\n end\n\n if length >= end_pos # this read will take us to the beginning of the file\n seek(0)\n else\n seek(-length, IO::SEEK_CUR)\n end\n\n start_pos = pos\n data = read(end_pos - start_pos)\n seek(start_pos)\n\n data\n end", "title": "" }, { "docid": "36dd4b445536a9ebb92e5c044fcc8980", "score": "0.5829893", "text": "def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end", "title": "" }, { "docid": "f30c8cfaf3c5f3f998d39d70a2e1cece", "score": "0.5827984", "text": "def read(position)\n @file.seek(position)\n size = @file.readbytes(4).unpack('N').first\n @file.readbytes(size)\n end", "title": "" }, { "docid": "fa4b6661943c8dde163fad19e986fdb9", "score": "0.58135796", "text": "def readbyte\n map_exceptions do\n @socket.readbyte\n end\n end", "title": "" }, { "docid": "65e85c14e7ff415479325e580d9b453e", "score": "0.5810668", "text": "def read_one_nonblock\n read_one if has_any?\n end", "title": "" }, { "docid": "6d57e99872bb74fe8805c9d51d85bb97", "score": "0.58086014", "text": "def read() end", "title": "" }, { "docid": "c292a284659d596f070ef585952c63f3", "score": "0.5805812", "text": "def readbyte\n getbyte || raise(EOFError)\n end", "title": "" }, { "docid": "c91de53054b5aff979674a2d7601490e", "score": "0.5803279", "text": "def read_bytes(amount, mut)\n amount.times.each_with_object([]) { |_idx, arr| arr << read_byte(false, mut) }\n end", "title": "" }, { "docid": "f332aa6c333db72ffc3538bfd3597968", "score": "0.58006406", "text": "def data(&block)\n if not @data.nil?\n return @data\n end\n \n self.prepare! # seeks to block position\n \n if not block.nil?\n loop do\n size = @io.getbyte\n break if size <= 0\n block.call(@io.read(size))\n end\n else\n data = \"\"\n self.data do |chunk|\n data << chunk\n end\n @data = data\n \n return @data\n end\n end", "title": "" }, { "docid": "cf2ab7bf513a1273fa4626a3ae20b074", "score": "0.5789414", "text": "def read_bytes(sd, n)\n\n out = []\n\n while (n > out.size) \n data = sd.read_bytes(n - out.size)\n break unless data\n out = out + data\n end\n\n return out\nend", "title": "" }, { "docid": "e22a9dc9ab6595e91ddc6044eb8e7590", "score": "0.5742085", "text": "def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end", "title": "" }, { "docid": "d2875a7fe5cfb602757909e40966f411", "score": "0.5741898", "text": "def read_chunk\n # the first line contains the length of the next chunk\n length = @socket.gets\n chunk = @socket.read(length.to_i(16))\n # append to the local copy of the content\n @content += chunk\n # all content is followed by a newline\n @socket.gets\n # the length (as received, in hex) and the content chunk\n [length, chunk]\n end", "title": "" }, { "docid": "a0b6f42152a4a27f246201d3b47ef286", "score": "0.57399446", "text": "def block_length\n 1\n end", "title": "" }, { "docid": "635af5b69a94ace23802d270186a3e43", "score": "0.5716026", "text": "def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end", "title": "" }, { "docid": "fc24d7b1f8ef4afd0f30c8c5764db048", "score": "0.568627", "text": "def read(maxbytes=1024)\n \"\"\"Buffered read from node, non-blocking.\n maxbytes: maximum number of bytes to return\"\"\"\n count = @readbuf.length\n if count < maxbytes\n data = File.new(@stdout.fileno(), \"r\").sysread(maxbytes - count)\n puts data\n @readbuf += data\n end \n\n if maxbytes >= @readbuf.length\n result = @readbuf\n @readbuf = ''\n else\n puts 'entered'\n result = @readbuf[0..maxbytes]\n @readbuf = @readbuf[[email protected]]\n end\n\n return result\n end", "title": "" }, { "docid": "1bd629a7ec3c667776ac4d83b1f031e8", "score": "0.5683837", "text": "def receive_n_bytes(sizemax,looping=false,&b)\n s=sizemax\n if self.data_readed.size>=sizemax\n buff,self.data_readed=self.data_readed[0..sizemax-1],self.data_readed[sizemax..-1]\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n s=sizemax-self.data_readed.size\n loop do\n #p [\"waiting \",s,data_readed]\n sd=s>1024 ? 1024 : s\n data=(self.recv(sd) rescue (p $!;nil))\n #p \"nrec: w#{sizemax}/ rec:#{(data||'').size} / #{sd} old=#{data_readed.size} /// #{(data||'').size<70 ? data : \".\"}\"\n if data && data.size>0\n self.data_readed=self.data_readed+data\n s=sizemax-self.data_readed.size\n if s<=0\n buff,self.data_readed=self.data_readed,\"\"\n s=sizemax\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n else\n close rescue nil\n break # socket close\n end\n end #loop\n end", "title": "" }, { "docid": "b64d9bb023733f50e2299f2712b741c6", "score": "0.5680517", "text": "def read_block_header # :nodoc:\n unless header = rio.read(BLOCK_HEADER_SIZE)\n return\n end\n\n type, index, payload_size = header.unpack('CxvV')\n if !type || !index || !payload_size\n return\n end\n\n next_block_pos = rio.tell + payload_size\n if file_size < next_block_pos\n return\n end\n\n if !BLOCK_TYPES.include?(type)\n file = if rio.respond_to?(:path) then \" in file #{rio.path}\"\n end\n Pocolog.warn \"invalid block type '#{type}' found#{file} at position #{rio.tell}, expected one of #{BLOCK_TYPES.join(\", \")}. The file is probably corrupted. The rest of the file will be ignored.\"\n return\n end\n\n @block_info.io = @rio\n @block_info.pos = @next_block_pos\n @block_info.type = type\n @block_info.index = index\n @block_info.payload_size = payload_size\n @next_block_pos = next_block_pos\n true\n end", "title": "" }, { "docid": "3b0694ca023b59622aa979f4ad8fd10c", "score": "0.5672566", "text": "def read_and_unpack(length, format)\n if @io.pos + length - 1 < @io.length\n return @io.read(length).unpack(format)\n end\n\n nil\n end", "title": "" }, { "docid": "2b8f087f7a21a5ffd68543a99bf2decd", "score": "0.5671628", "text": "def read_one_nonblock\n synchronize {\n read_many_nonblock.slice!(0)\n }\n end", "title": "" }, { "docid": "4109f78ce726c5300ba27252aaeabe84", "score": "0.5669003", "text": "def block_size; end", "title": "" }, { "docid": "44b5db791941d0355d7651f7b3083ebf", "score": "0.56669754", "text": "def check_read(file, bytes); end", "title": "" }, { "docid": "44b5db791941d0355d7651f7b3083ebf", "score": "0.56669754", "text": "def check_read(file, bytes); end", "title": "" }, { "docid": "ce18bc08db188e43179d57dbb5a9d7b5", "score": "0.56544566", "text": "def readpartial(maxlen=99, buf=\"buffer\") end", "title": "" }, { "docid": "cd2832697c2a01fa185c478ddd3d98a6", "score": "0.5637775", "text": "def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end", "title": "" }, { "docid": "6191f884fca36fb6376f6cad37530b7b", "score": "0.56330395", "text": "def read_block_raw\n header_raw = read_block_header_raw\n header = BlockHeader.parse(header_raw)\n payload = read(header.payload_size)\n if !payload || payload.size != header.payload_size\n raise NotEnoughData,\n \"expected to read #{header.payload_size} payload bytes but got \"\\\n \"#{payload ? payload.size : 'EOF'}\"\n end\n\n [header, header_raw, payload]\n end", "title": "" }, { "docid": "84f0b477b26863b46a04d5f673dbd7e9", "score": "0.56077594", "text": "def read_bytes(count)\n result = new_buffer\n result << read_outstanding(0, count)\n @outstanding = read_outstanding(count..-1)\n result << read_bytes!(count - result.size) until result.size == count\n result\n ensure\n @recent << result\n end", "title": "" }, { "docid": "f294d582b07eba9a0302646196d842ab", "score": "0.56077546", "text": "def fill_read_buffer\n\t\t\t\tif buffer = @io.read(@block_size)\n\t\t\t\t\t@read_buffer << buffer\n\t\t\t\telse\n\t\t\t\t\t@eof = true\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "a655fae9d50936c74352a0dbde25fc31", "score": "0.560698", "text": "def read(length=99, buf=\"buffer\") end", "title": "" }, { "docid": "4f774331807061f9e56fd19fecfb2fde", "score": "0.56035405", "text": "def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end", "title": "" }, { "docid": "56716845c3c89a61bb5bd220604bfa8a", "score": "0.55985403", "text": "def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end", "title": "" }, { "docid": "1d84e6fa521003b7968d1415db50a43a", "score": "0.5584825", "text": "def read_blocked\n end", "title": "" }, { "docid": "2a2d1919583e224efd71aac94dbeac87", "score": "0.55799556", "text": "def read\n return if @read_flag\n\n process_reading\n end", "title": "" }, { "docid": "6fc1f242b86626b358b3aba4e13c9aa7", "score": "0.5579695", "text": "def read_packet_2 tag=nil\n len = self.read_two_bytes_big\n read_len len, tag\n end", "title": "" }, { "docid": "5450edf45a59000a6788c1e721f27892", "score": "0.5565805", "text": "def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end", "title": "" }, { "docid": "91771be9273767c368b0214b688d2f0d", "score": "0.5559371", "text": "def handle_block(block_info) # :nodoc:\n if block_info.type == CONTROL_BLOCK\n read_control_block\n elsif block_info.type == DATA_BLOCK\n if !declared_stream?(block_info.index)\n Pocolog.warn \"found data block for stream #{block_info.index} but this stream has never been declared, seems Logfile is Corrupted. Skipping...\"\n end\n elsif block_info.type == STREAM_BLOCK\n read_stream_declaration\n end\n block_info.type\n end", "title": "" }, { "docid": "0fe29f5a5992b8623dd85503f341def5", "score": "0.5535665", "text": "def read_mifare_block(blk, _auth = auth_mifare_block(blk))\n buffer = PN532::DataBuffer.new\n\n resp = PN532.mifare_read_block(\n pn_struct,\n buffer,\n blk\n )\n\n check_error(resp)\n buffer[0...PN532::MIFARE_BLOCK_LENGTH]\n end", "title": "" }, { "docid": "73d86ef1ebec902a47dec26f5eada37c", "score": "0.5533992", "text": "def read(offset, how_much)\n @stream.read(how_much)\n end", "title": "" }, { "docid": "3044282668827bb65734cdc646253bed", "score": "0.55310804", "text": "def discover_first_block_controlled_byte_count(&block)\n byte_count = 1\n found = false\n\n blocks = discover_first_controlled_block(&block)\n block_size = discover_block_size(&block)\n last_block = ByteArray.from_string(block.call('A'*0)).each_slice(block_size)[blocks]\n\n while not found\n check_block = ByteArray.from_string(block.call('A'*byte_count)).each_slice(block_size)[blocks]\n check_block != last_block ? byte_count += 1 : found = true\n last_block = check_block\n end\n\n byte_count - 1\nend", "title": "" }, { "docid": "4d67f37616cbce3719c224a45951ad81", "score": "0.55308867", "text": "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "title": "" }, { "docid": "8ada524424a44192c02f9585e91366c6", "score": "0.552177", "text": "def decrypt_block_size\n (size/8)-1\n end", "title": "" }, { "docid": "4645c5cc68d03fd158452ffebaaf2bf0", "score": "0.55092084", "text": "def read_available(length = nil)\n input.read(length || available)\n end", "title": "" }, { "docid": "36fad534e43ce217d06db968000171f0", "score": "0.55090815", "text": "def getbyte\n read(1)\n end", "title": "" }, { "docid": "2f0e322ec5bb01605d2e477554c5234c", "score": "0.5497939", "text": "def read(n)\n end", "title": "" }, { "docid": "b0ab5929279adb883ee5c524445213de", "score": "0.5495268", "text": "def getc\n @bytes_to_be_read -= 1\n @io.readbyte()\n end", "title": "" }, { "docid": "4f5489455b3f9911491a2385d95b2bcc", "score": "0.5495008", "text": "def read_stream_block\n StreamBlock.parse(read_payload)\n end", "title": "" }, { "docid": "4b95fa7dd6c91da0809cbb6acc2d2ff7", "score": "0.5488032", "text": "def read_buffer; end", "title": "" }, { "docid": "592ae580c32ebf659f667e7ab8e4e50d", "score": "0.54847765", "text": "def read(block_name, dest_buffer = nil)\n dest_buffer ||= alloc_buffer\n if block_name >= @mem_file.size\n raise ArgumentError,\"No such block name #{block_name} exists (size=#{@mem_file.size})\"\n end\n\n src = @mem_file[block_name]\n ByteArray.copy(src,0,@block_size,dest_buffer,0)\n dest_buffer\n end", "title": "" }, { "docid": "bd8d852413a18c1027c469ac248b3e50", "score": "0.5484297", "text": "def read(offset, how_much)\n @stream.read(how_much)\n end", "title": "" }, { "docid": "334986f840d53ac973b9d985a59b2648", "score": "0.5480773", "text": "def read(block)\n @filemgr.read(block, @contents)\n end", "title": "" }, { "docid": "969c4b08d1ff6f305577b61024f02123", "score": "0.5477653", "text": "def read_data_block_request(length, connection)\n data_block = ''\n while (line = connection.gets)\n data_block += line\n break if data_block.length >= (length.to_i + CMD_ENDING.length)\n end\n\n validate_and_remove_ending! data_block\n end", "title": "" }, { "docid": "38d06dcbbbac719df7a295bacd9a060d", "score": "0.54700065", "text": "def read_available(length = T.unsafe(nil)); end", "title": "" }, { "docid": "04bb450f26995b4d7b4c9750b5e01413", "score": "0.546958", "text": "def read(count = T.unsafe(nil), _buffer = T.unsafe(nil)); end", "title": "" }, { "docid": "07b6adbd750ec30bbf9b78a0afb4760c", "score": "0.54650563", "text": "def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end", "title": "" }, { "docid": "2a7e221d57e7088a409b443b1dd0ced7", "score": "0.54597986", "text": "def read_nonblock(rd_io)\n data = ''\n begin\n # Loop until EOF or blocking\n loop do\n # do an 8k non-blocking read and append the result\n data << rd_io.read_nonblock(8192)\n end\n rescue EOFError, Errno::EAGAIN, Errno::EWOULDBLOCK\n end\n data\n end", "title": "" }, { "docid": "79cc20a2a240e83fab08b6befea7418c", "score": "0.5459245", "text": "def read_packet; end", "title": "" }, { "docid": "6f61c8aa91baaaa028d7933a1e4357ef", "score": "0.5438812", "text": "def read(size)\n data = @data.byteslice(@pos, size)\n @pos += size\n data\n end", "title": "" }, { "docid": "c129811837f5ee764625f4365851de12", "score": "0.5433547", "text": "def next\n\t\t@ibuf = (@ibuf+1).modulo(@nbuf)\n\t\t@buffers[@ibuf]\n\tend", "title": "" }, { "docid": "7a577182aab6691e8123be0c819db39c", "score": "0.5430352", "text": "def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "96e4e0bcffcfc479ee7cf5c45c0808f6", "score": "0.54277676", "text": "def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end", "title": "" }, { "docid": "cdd3bac767fc1e9aaf86eb1cf6e2cea9", "score": "0.54256165", "text": "def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end", "title": "" }, { "docid": "62dc0f78adfbac28b9950a4db46ef486", "score": "0.5417504", "text": "def get_data\n buffer = 4096\n\n return tmp if read(@filehandle, tmp, buffer)\n\n # No data to return\n return nil\n end", "title": "" }, { "docid": "8433af95116cb13f687f6b5b9080cc46", "score": "0.5416893", "text": "def read(len = nil)\n return nil if @read >= @size\n len ||= @size - @read\n max_read = [len, @size - @read].min\n ret = @io.read(max_read)\n @read += bytesize(ret)\n ret\n end", "title": "" }, { "docid": "eab419968acd702ef9031c2719478198", "score": "0.54161566", "text": "def read_available(length = nil)\n @input.read(length || available)\n end", "title": "" }, { "docid": "60e92ec3723ad71b90211c795986975f", "score": "0.5412906", "text": "def read_binary length\n if @split\n if @split.first.size >= length\n result = @split.shift[0...length]\n unshift_split if @split.size == 1\n return result\n end\n unshift_split\n end\n unless @pending\n size = reduce(0){|x,y|x+y.size}\n return nil unless size >= length\n @pending = dup\n clear\n remainder = size - length\n if remainder > 0\n last_string = @pending[-1]\n @pending[-1] = last_string[0...-remainder]\n push last_string[-remainder..-1]\n end\n end\n # eat newline\n return nil unless read_line\n result = @pending.join\n @pending = nil\n result\n end", "title": "" }, { "docid": "eac8c47e9d15a8401be9fe470b9c604c", "score": "0.5411885", "text": "def get\n @mutex.synchronize do\n # get the first block of data\n if @log.debug?\n @log.debug \"reading #{@cipher.block_size} bytes from socket...\"\n end\n\n data = read( @cipher.block_size )\n\n # decipher it\n reader = @buffers.reader( @cipher.update( data ) )\n\n # determine the packet length and how many bytes remain to be read\n packet_length = reader.read_long\n remaining_to_read = packet_length + 4 - @cipher.block_size\n if @log.debug?\n @log.debug \"packet length(#{packet_length}) \" +\n \"remaining(#{remaining_to_read})\"\n end\n\n # read the remainder of the packet and decrypt it.\n data = read( remaining_to_read )\n\n # get the hmac from the tail of the packet (if one exists), and\n # then validate it.\n hmac = @hmac.mac_length > 0 ? read( @hmac.mac_length ) : \"\"\n\n reader.append @cipher.update( data ) unless data.empty?\n reader.append @cipher.final\n\n padding_length = reader.read_byte\n\n payload = reader.read( packet_length - padding_length - 1 )\n padding = reader.read( padding_length ) if padding_length > 0\n\n my_computed_hmac = compute_hmac( reader.content )\n raise Net::SSH::Exception, \"corrupted mac detected\" if hmac != my_computed_hmac\n\n # decompress the payload\n payload = @decompressor.decompress( payload )\n\n increment_sequence_number\n\n buffer = @buffers.reader( payload )\n @log.debug \"received: #{buffer.content.inspect}\" if @log.debug?\n\n return buffer\n end\n end", "title": "" }, { "docid": "e5eaebaba2f7c216ee4d82586690a147", "score": "0.53999346", "text": "def read(offset, len)\n _isource.read(offset, len)\n end", "title": "" }, { "docid": "a4acdfe931bd5eaf0168f8899d467b57", "score": "0.5398177", "text": "def read(pos)\n end", "title": "" }, { "docid": "c207e5e3dd8b014a9d3399bf551d6fb5", "score": "0.5392826", "text": "def fill_rbuff\n begin\n @rbuffer << sysread(BLOCK_SIZE)\n rescue Errno::EAGAIN\n retry\n rescue EOFError\n @eof = true\n end\n end", "title": "" }, { "docid": "f769c4f19ca28b6d8732f570c53373a1", "score": "0.5390062", "text": "def msg_read(n_bytes)\n\t@msg_buf += get_bytes(n_bytes)\n\t@msg_buf.flatten!\n\treturn @msg_buf[-1]\n end", "title": "" }, { "docid": "11da274cc9c0f7b709969fb9cb628e38", "score": "0.5381507", "text": "def read_block(session_id, block_id, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n data = @storage.read_block block_id\n hmac = @hash_tree_controller.sign_read_block block_id, session_cache_entry, nonce \n return data, hmac\n end", "title": "" }, { "docid": "de05e8df53994e2b6c3e240cb9f58281", "score": "0.5374137", "text": "def read &block\n prep_read\n data = block_given? ?\n file_handle.each {|line| yield line } :\n file_handle.read\n @read_position = file_handle.pos\n data\n end", "title": "" }, { "docid": "8638a3f82cd4951c6d9780f72c090d76", "score": "0.5371891", "text": "def read_until(bytes)\n out = \"\"\n size = bytes.size\n\n if @buffer && [email protected]?\n if @buffer.include?(bytes)\n offset = @buffer.index(bytes) + size\n return head(offset)\n else\n out << head(@buffer.size)\n end\n end\n\n loop do\n out << @io.read(1)\n if out[-1 * size,size].eql?(bytes)\n out = out[0, out.size - size]\n seek(pos - size)\n break\n end\n end\n out\n end", "title": "" } ]
dc4c84c54215366fafd6a86012a0c60f
Fetches the included resourcs as an Array containing only nonwildcard resource specifiers.
[ { "docid": "12963e26e2beda4893ccce68b44c48f5", "score": "0.78260404", "text": "def included_resources\n without_wildcard = []\n\n if has_included_resources?\n include_param_array = @include_param.split(',')\n include_param_array.each do |x|\n if x.include? \"*\"\n # do nothing :)\n else\n without_wildcard << x\n end\n end\n end\n return without_wildcard\n end", "title": "" } ]
[ { "docid": "9424297156d4106b3c830e1386784ba1", "score": "0.72675717", "text": "def included_resources\r\n # TODO: implement me\r\n if @include_param == nil then return [] end\r\n valid_resources = []\r\n for resource in @include_param.split(',') do\r\n if (!resource.include? '*') && (!resource.include? '?')\r\n valid_resources += [resource]\r\n end\r\n end\r\n return valid_resources\r\n end", "title": "" }, { "docid": "cd67f7adcaa8598b080db8fd5c5be1d8", "score": "0.6546596", "text": "def resources\n elements.select { |e| e.resource?}\n end", "title": "" }, { "docid": "4c54b476c2aff2cb12a0cf199ccb9b21", "score": "0.65163094", "text": "def default_resource_includes\n []\n end", "title": "" }, { "docid": "fc3efb93a2172afe5309c156441bae08", "score": "0.64313126", "text": "def resources\n @resources.map { |resource_class, named_resources|\n named_resources.values\n }.flatten\n end", "title": "" }, { "docid": "baae3eaf90e180072327df7aec667b47", "score": "0.6413915", "text": "def get_resources_list(filter=[])\n filter\n end", "title": "" }, { "docid": "baae3eaf90e180072327df7aec667b47", "score": "0.6413915", "text": "def get_resources_list(filter=[])\n filter\n end", "title": "" }, { "docid": "baae3eaf90e180072327df7aec667b47", "score": "0.6413915", "text": "def get_resources_list(filter=[])\n filter\n end", "title": "" }, { "docid": "316359b470cb6eb43460ad8b4196cb40", "score": "0.63293004", "text": "def expanded_resources\n files = []\n resources.each do |pattern|\n pattern = pod_destroot + pattern\n pattern.glob.each do |file|\n files << file.relative_path_from(config.project_pods_root)\n end\n end\n files\n end", "title": "" }, { "docid": "316359b470cb6eb43460ad8b4196cb40", "score": "0.63293004", "text": "def expanded_resources\n files = []\n resources.each do |pattern|\n pattern = pod_destroot + pattern\n pattern.glob.each do |file|\n files << file.relative_path_from(config.project_pods_root)\n end\n end\n files\n end", "title": "" }, { "docid": "020c4dc974ce865883d57ed0283a14f7", "score": "0.62839335", "text": "def resources \n return @elements.collect{|s,p,o| s}.compact.uniq \n end", "title": "" }, { "docid": "df15b9449435302fa6bda9fd5f08ce83", "score": "0.61866933", "text": "def ar_default_includes\n ret = []\n\n self.class.output.params.each do |p|\n if p.is_a?(HaveAPI::Parameters::Resource) && self.class.model.reflections[p.name.to_sym]\n ret << p.name.to_sym\n end\n end\n\n ret\n end", "title": "" }, { "docid": "7d7ae1c91727e9b08d2cceb319753d8d", "score": "0.61859226", "text": "def resources\n @resources ||= []\n end", "title": "" }, { "docid": "7d7ae1c91727e9b08d2cceb319753d8d", "score": "0.61859226", "text": "def resources\n @resources ||= []\n end", "title": "" }, { "docid": "b2bf37d5b61b79605e018f016842305d", "score": "0.6144182", "text": "def resources\n resource_list = []\n @wadl.css('resources').each do |resources|\n base = resources.attr('base')\n resources.css('resource').each do |resource|\n resource_list << Resource.new( resource, base )\n end\n end\n # TODO : This is a hack for Jason's bug\n resource_list.uniq\n end", "title": "" }, { "docid": "686408a5e6e15f3f2bedc0bc8f095a5e", "score": "0.6143713", "text": "def resources\n resources_property.map {|prop| prop ? prop.ruby_value : prop}\n end", "title": "" }, { "docid": "c3a03f997cc6698a138b4d2a3fd98bca", "score": "0.61382884", "text": "def resources\n return @config.fetch(\"resources\", [])\n end", "title": "" }, { "docid": "f3ee3968aea8aa126679774c30a91b78", "score": "0.61257195", "text": "def included\n return [] if workspace.nil?\n @included ||= process_globs(@raw_data['include'])\n end", "title": "" }, { "docid": "46d8e950f7b619def97b10dac731490c", "score": "0.61088276", "text": "def getresources(name, type=Types.A, klass=Classes.IN)\n ret = []\n each_resource(name, type, klass) {|resource| ret << resource}\n return ret\n end", "title": "" }, { "docid": "d114c5e7f444f247f5a7df32892d7804", "score": "0.6087004", "text": "def extract_resources(selection, include_blank, sparql)\n\n case selection\n when nil # Config parameter not present\n object_resources = extract_resources(\"objects\", include_blank, sparql)\n subject_resources = extract_resources(\"subjects\", include_blank, sparql)\n predicate_resources = extract_resources(\"predicates\", include_blank, sparql)\n return object_resources.concat(subject_resources).concat(predicate_resources).uniq\n when \"objects\"\n query = \"SELECT ?resourceUri WHERE{?s ?p ?resourceUri}\"\n when \"subjects\"\n query = \"SELECT ?resourceUri WHERE{?resourceUri ?p ?o}\"\n when \"predicates\"\n query = \"SELECT ?resourceUri WHERE{?s ?resourceUri ?o}\"\n else\n # Custom query\n query = selection\n end\n sparql.query(query).map{ |sol| sol[:resourceUri] }.reject do |s| # Reject literals\n s.class <= RDF::Literal\n end.select do |s| # Select URIs and blank nodes in case of include_blank\n include_blank || s.class == RDF::URI\n end.uniq\n end", "title": "" }, { "docid": "e3802a6e6b3f11c732e32093fc334f7a", "score": "0.60693896", "text": "def find_resources_to_use(resources, resource_ids_to_use)\n result_array = []\n resources.each do |resource|\n if resource_ids_to_use.include? resource.id\n result_array.push(resource)\n end\n end\n result_array\nend", "title": "" }, { "docid": "84b8045d6d5b230f4eecdaa8e59c2448", "score": "0.6064831", "text": "def extract_resources(selection, include_blank, sparql)\n\n case selection\n when nil # Config parameter not present\n object_resources = extract_resources(\"objects\", include_blank, sparql)\n subject_resources = extract_resources(\"subjects\", include_blank, sparql)\n predicate_resources = extract_resources(\"predicates\", include_blank, sparql)\n return object_resources.concat(subject_resources).concat(predicate_resources).uniq\n when \"objects\"\n query = \"SELECT ?resourceUri WHERE{?s ?p ?resourceUri}\"\n when \"subjects\"\n query = \"SELECT ?resourceUri WHERE{?resourceUri ?p ?o}\"\n when \"predicates\"\n query = \"SELECT ?resourceUri WHERE{?s ?resourceUri ?o}\"\n else\n # Custom query\n query = selection\n end\n sparql.query(query).map{ |sol| sol[:resourceUri] }.reject do |s| # Reject literals\n s.class <= RDF::Literal\n end.select do |s| # Select URIs and blank nodes in case of include_blank\n include_blank || s.class == RDF::URI\n end.uniq\n end", "title": "" }, { "docid": "4389acef43c04476d09a9131d85213b6", "score": "0.60437477", "text": "def sitemapResources(resourceType)\n sitemap.resources.select{|r| r.content_type === resourceType}\n end", "title": "" }, { "docid": "9bc7b9363f97dd454f35348d70a66dae", "score": "0.60197616", "text": "def resources\n xml = @resources_res.get.body\n xml_doc = Nokogiri::XML xml\n nodes = xml_doc.xpath '/prestashop/api/*'\n resources_list = []\n nodes.each{|n| resources_list << n.name.to_sym}\n return resources_list\n end", "title": "" }, { "docid": "a05a83ccb6390374dd405fe039bae2a5", "score": "0.60173106", "text": "def resources\n []\n end", "title": "" }, { "docid": "a05a83ccb6390374dd405fe039bae2a5", "score": "0.60173106", "text": "def resources\n []\n end", "title": "" }, { "docid": "5237f0cd095755396f95da10b5c01d06", "score": "0.6000288", "text": "def resources\n '.Resources|with_entries(.value.LogicalResourceId = .key)[]'\n end", "title": "" }, { "docid": "5237f0cd095755396f95da10b5c01d06", "score": "0.6000288", "text": "def resources\n '.Resources|with_entries(.value.LogicalResourceId = .key)[]'\n end", "title": "" }, { "docid": "298df157a04e8ea471007662d33c8ded", "score": "0.5970943", "text": "def rq_sp_resources_all\n rq_sp_resources = Array.new\n item_sp_resource_invs.each do |item_sp_resource_inv|\n rq_sp_resources << item_sp_resource_inv.sp_resource\n end\n return rq_sp_resources\n end", "title": "" }, { "docid": "d217fe752801505b85fb111790f987bd", "score": "0.5956917", "text": "def collect\n resolved = []\n result = @resources.reduce([]) do |memo, ref|\n res = @scope.findresource(ref.to_s)\n if res\n res.virtual = false\n memo << res\n resolved << ref\n end\n memo\n end\n\n @resources = @resources - resolved\n\n @scope.compiler.delete_collection(self) if @resources.empty?\n\n result\n end", "title": "" }, { "docid": "63ac9c867584e66ca9d8a42e0ca1f88c", "score": "0.5946529", "text": "def all(options = {})\n sanitized_options = sanitize_options(options)\n\n json_items = api_conn.get(self.resources_path, :query => options[:conditions]).parsed_response\n\n resources = process_response(json_items, options)\n\n return [resources].flatten.compact\n end", "title": "" }, { "docid": "55916af39ebe82dd6e027296911cf266", "score": "0.59415156", "text": "def resources_reports\n\t\tarray = []\n\t\treports.each do |r|\n\t\t\tif r.resources != 0\n\t\t\t\tarray << r\n\t\t\tend\n\t\tend\n\n\t\tarray\n\tend", "title": "" }, { "docid": "55916af39ebe82dd6e027296911cf266", "score": "0.59415156", "text": "def resources_reports\n\t\tarray = []\n\t\treports.each do |r|\n\t\t\tif r.resources != 0\n\t\t\t\tarray << r\n\t\t\tend\n\t\tend\n\n\t\tarray\n\tend", "title": "" }, { "docid": "7ccfe18ebd4058d6df7523360fed6957", "score": "0.5937076", "text": "def resources\n deep_copy_of_authoritative_value_or_fallback 'resources'\n end", "title": "" }, { "docid": "08d7b2c710d45f034a22853a8fce4d6a", "score": "0.59291166", "text": "def resources\n collections.each_with_object(Set.new) do |(_, collection), set|\n set.merge(collection.resources)\n end.to_a\n end", "title": "" }, { "docid": "e52407452328d438d5a2bd93a2b7bd52", "score": "0.5912445", "text": "def resources\n @resources.values\n end", "title": "" }, { "docid": "777f82e8635d509c83c19dcb0a38dfb4", "score": "0.59056485", "text": "def resources\n [resource, \"s\"].join\n end", "title": "" }, { "docid": "7ac352b9b22d379f7378cefd0c61aa5b", "score": "0.5902972", "text": "def all\n each_resource.to_a\n end", "title": "" }, { "docid": "153dacc500e9e75708ff8bdb661be86d", "score": "0.5895857", "text": "def resource_array\n\t\tresource = current_employee.company.resources.collect {|x| [x.name.to_s,x.id] }\n\tend", "title": "" }, { "docid": "c1c36afda99bdd1fc67db2e4c1589d16", "score": "0.58958024", "text": "def resources\n @resources ||= cards.select{|card|card.is_a?(Resource)}\n end", "title": "" }, { "docid": "33d0459aa44280e2d18d400292ecfac9", "score": "0.58890027", "text": "def resources\n return @resources if defined?(@resources)\n\n @resources = self.fetch_value(self.request(:get, self.href), :link).inject({}) do |h, resource|\n h[resource[:rel].underscore.to_sym] = resource[:href]; h \n end\n end", "title": "" }, { "docid": "b8792d2fd5638b1709e7639c724839a1", "score": "0.58835787", "text": "def resources\n @resources ||= Nokogiri::XML(@resources_res.get.body).xpath('/prestashop/api/*').collect { |resource| resource.name.to_sym }\n end", "title": "" }, { "docid": "74ce78d7709e01c7489521fdf91c3a8f", "score": "0.5883342", "text": "def available_includes\n []\n end", "title": "" }, { "docid": "74ce78d7709e01c7489521fdf91c3a8f", "score": "0.5883342", "text": "def available_includes\n []\n end", "title": "" }, { "docid": "9b8f809b9371fe9920acd2094ff13353", "score": "0.58774483", "text": "def member\n ary = []\n path_spec.each_with_index {|spec, i| ary << (spec.singleton? ? spec.segment.to_sym : resources[i])}\n ary\n end", "title": "" }, { "docid": "4a26345864a831dcb39e3bbb7df97ca2", "score": "0.58573323", "text": "def resources\n raise OctocatalogDiff::Errors::CatalogError, 'Catalog does not appear to have been built' if !valid? && error_message.nil?\n raise OctocatalogDiff::Errors::CatalogError, error_message unless valid?\n return @catalog['data']['resources'] if @catalog['data'].is_a?(Hash) && @catalog['data']['resources'].is_a?(Array)\n return @catalog['resources'] if @catalog['resources'].is_a?(Array)\n # This is a bug condition\n # :nocov:\n raise \"BUG: catalog has no data::resources or ::resources array. Please report this. #{@catalog.inspect}\"\n # :nocov:\n end", "title": "" }, { "docid": "8e2d24539a57ff34adf5c082f496a8cd", "score": "0.58443254", "text": "def resources_by_relative_url\n resources.group_by(&:relative_url).transform_values(&:first)\n end", "title": "" }, { "docid": "b5dc094bb468bd165c344eebc9e73c3a", "score": "0.58366674", "text": "def applied_resources\n report.resource_statuses.values.collect { |status| catalog.resource(status.resource) }\n end", "title": "" }, { "docid": "acfb923c3dbb1abcea083586cf833679", "score": "0.5832029", "text": "def required_with_list\n return [] unless @__resource\n\n @required_with\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.58284134", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.58284134", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.58284134", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.58284134", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "2f7e49e2af5806bc7e7235f653ccf201", "score": "0.5823071", "text": "def resources_awarded\n distinction_instances.map{|di|di.resources_awarded}.flatten.uniq\n end", "title": "" }, { "docid": "1d63a64ccf2a22ee278456cf756d8298", "score": "0.5817748", "text": "def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return [] unless replies.present?\n\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n\n resources.compact!\n resources.flatten(1)\n\tend", "title": "" }, { "docid": "1aa0f9dd07ce95c55a7e964c238605c0", "score": "0.5816197", "text": "def list_resource\n resource_class.all_but_other\n end", "title": "" }, { "docid": "1aa0f9dd07ce95c55a7e964c238605c0", "score": "0.5816197", "text": "def list_resource\n resource_class.all_but_other\n end", "title": "" }, { "docid": "621f36e8dde20fdbcf1ed70a029b64c2", "score": "0.5801906", "text": "def resources_for(capability:)\n resources.select { |r| r.capability == capability }\n end", "title": "" }, { "docid": "0590fd4f5cfbec84ea5271a9a0b3f376", "score": "0.5800821", "text": "def resources\n @raw.resources\n end", "title": "" }, { "docid": "5ec7389a52c7d8729ba7313fb29a0fbc", "score": "0.5797733", "text": "def resource_objects\n @body['provision']['resource']\n end", "title": "" }, { "docid": "fba3bb8b49b00cb611c66983fd01fc83", "score": "0.57841516", "text": "def resource_files\n Pathname.glob(@resource_path.join('*.{yml,yml.erb}')).sort_by(&:to_s)\n end", "title": "" }, { "docid": "fba3bb8b49b00cb611c66983fd01fc83", "score": "0.57841516", "text": "def resource_files\n Pathname.glob(@resource_path.join('*.{yml,yml.erb}')).sort_by(&:to_s)\n end", "title": "" }, { "docid": "4ded2f57dc121887d58bc95b22c4fa67", "score": "0.57667804", "text": "def resources_nested_by_id\n [\n { asset_ids: [] },\n { document_ids: [] },\n { representation_ids: [] },\n { preferred_representation_ids: [] },\n { aictag_ids: [] },\n { tagcat_ids: [] },\n { status_ids: [] },\n { view_ids: [] },\n { document_type_ids: [] },\n { tag_ids: [] }\n ]\n end", "title": "" }, { "docid": "760b65ce06d985c9734307d1ec933cf5", "score": "0.5763181", "text": "def resource_ids\n @tmp_resource_ids != nil or @tmp_resource_ids = []\n @tmp_resource_ids = @tmp_resource_ids | resource_uses.collect {|resource_use| resource_use.resource_id.to_s}\n logger.debug \"tmp_ids is\" + @tmp_resource_ids.inspect\n @tmp_resource_ids.collect {|id| id.to_i}\n end", "title": "" }, { "docid": "458bf3816d22b4f1cbd9905d273137a0", "score": "0.5741858", "text": "def unresolved_resources\n EMPTY_RESOURCES\n end", "title": "" }, { "docid": "141cec7968f074a7d835320e6734ecb6", "score": "0.57394356", "text": "def resources\n @resources ||= Set.new\n end", "title": "" }, { "docid": "efee05ba94b109bb6f9c4eef3bcb4445", "score": "0.5726654", "text": "def model_includes\r\n # TODO: implement me\r\n if @include_param == nil then return [] end\r\n array_of_symbols = []\r\n array_of_params = @include_param.split(',').map { |x| x.split('.') }\r\n for resource in array_of_params do\r\n parse_it(resource, array_of_symbols)\r\n end\r\n return array_of_symbols\r\n end", "title": "" }, { "docid": "ab6517485a035feae32cdbba4763e79d", "score": "0.57213885", "text": "def resources\n resource_class.all\n end", "title": "" }, { "docid": "ab6517485a035feae32cdbba4763e79d", "score": "0.57213885", "text": "def resources\n resource_class.all\n end", "title": "" }, { "docid": "ed38db44565d6dc303e0ac29257f42cf", "score": "0.57188326", "text": "def resources\n resource_class.all\n end", "title": "" }, { "docid": "c2bf032f7f79b8a5564f54a972c02e0a", "score": "0.5696785", "text": "def resources_include\n nil\n end", "title": "" }, { "docid": "28bd3bb3599bba8ea85391b5d5ed4289", "score": "0.56958336", "text": "def managed_resources\n # need to add some caching here based on mtime of the resources file\n return [] unless File.exist?(Puppet[:resourcefile])\n File.readlines(Puppet[:resourcefile]).map do |resource|\n resource.chomp\n end\n end", "title": "" }, { "docid": "24c1a3aa2e9dbed341923bc2f4e9e119", "score": "0.5689954", "text": "def assigned_resources( resource_class, page_layout )\n template_resources.select{|template_resource|\n template_resource.source_class == resource_class && template_resource.page_layout_id==page_layout.id \n }.collect(&:source)\n end", "title": "" }, { "docid": "a425351210b87f15c2278a0f1b2ca948", "score": "0.5688781", "text": "def resources(path)\n res_path = File.join(fs_path(path), ResourceNode::PATHNAME)\n return [] if (! File.exist? res_path) or (! File.directory? res_path)\n Find.find(res_path).reject { |f| File.directory? f \n }.map { |f| f.split(res_path + '/', 2)[1] }\n end", "title": "" }, { "docid": "d22b6ec96205d53472bce99ce8a3aabc", "score": "0.56808525", "text": "def collect\n if resource\n resource.collect { |resource_value| yield(resource_value) }\n else\n []\n end\n end", "title": "" }, { "docid": "0da9d8f2250c826e75108cb576bb5c50", "score": "0.5677934", "text": "def whitelist_files\n project.library.components.inject([]) do |array, component|\n array += component.whitelist_files\n array\n end\n end", "title": "" }, { "docid": "19930b3759f2b711cc5a29cdeac28447", "score": "0.5673825", "text": "def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end", "title": "" }, { "docid": "da53c227ebdee1f676aa94b06ef9b242", "score": "0.56725883", "text": "def resources_by_type(type)\n @resources_by_type[type] || []\n end", "title": "" }, { "docid": "66e76d896d25a7ea2bfb47bd74ebb827", "score": "0.5662349", "text": "def known_resources(match: \"\")\n @cached_resources.keys.select { |key| key[match] }\n end", "title": "" }, { "docid": "6e197828c1c7ddfb15863de1153914a0", "score": "0.56515306", "text": "def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.type_identifier.end_with? 'resource_tpl' }.any? }\n end", "title": "" }, { "docid": "96749e0a9d323187e7480e6ec97ca3ed", "score": "0.56472266", "text": "def related_resources(master_identifier)\n b = get_related_objects(master_identifier);\n related_resources = Array.new\n b.each do |b_obj|\n pid=b_obj.id\n object = locate_by_model(pid)\n if(object)\n finding_aid = [object.finding_aid_link.first,object.finding_aid_title.first,t('tul_ohist.related_resources.label.finding_aid')]\n online_exhibit = [object.online_exhibit_link.first,object.online_exhibit_title.first, t('tul_ohist.related_resources.label.online_exhibit')]\n catalog_record = [object.catalog_record_link.first,object.catalog_record_title.first, t('tul_ohist.related_resources.label.catalog_record')]\n (related_resources ||= []) << finding_aid << online_exhibit << catalog_record\n end\n end\n return related_resources\n end", "title": "" }, { "docid": "afa4c823093915026c923422e258bdc4", "score": "0.5637187", "text": "def resources\n @resources ||= resource_scope.order(order_by)\n end", "title": "" }, { "docid": "425828d63746ccab4c3d3ca58f325788", "score": "0.5635292", "text": "def included_sources\n return @included_sources\n end", "title": "" }, { "docid": "b1da7ac7c6a5392eb7df925b2c3c2f5f", "score": "0.5632912", "text": "def get_resources\n begin\n #slice_url = \"http://bleeding.mytestbed.net:8006/slices/\"\n raise \"No slice service URL, use '--slice-service' option\" if OmfEc.experiment.ss_url.nil?\n raise \"No slice name, use '--slice' option\" if OmfEc.experiment.sliceID.nil?\n u = URI.parse(OmfEc.experiment.ss_url+'/slices/'+OmfEc.experiment.sliceID+'/resources')\n res = Net::HTTP.get(u)\n raise \"Could not retrieve a valid list of resources from '#{u}'\" if res.nil? || res.empty? || !(res.kind_of? String)\n Hashie::Mash.new(JSON.parse(res)).values\n rescue Exception => ex\n error \"get_resources - #{ex} (#{ex.class}) - URI: '#{u}'\"\n #error \"get_resources - #{ex.backtrace.join(\"\\n\\t\")}\"\n return []\n end\n end", "title": "" }, { "docid": "06b3df372146fd7ffc98ef28d90a114c", "score": "0.5612383", "text": "def collect_all\n # TODO refactor using Find\n glob_rule = \"#{@images_dir}/{#{@content_types.join(',')}}/**/[0-9]*.{#{options.filetypes.join(',')}}\"\n\n # Store the paths in an Array[]\n Dir[glob_rule]\n end", "title": "" }, { "docid": "21107455516ced3f33f61ccd8591908f", "score": "0.5612102", "text": "def constituent_of_uris\n []\n end", "title": "" }, { "docid": "071773aa642ef20e73788730d4a57095", "score": "0.5606297", "text": "def related_resources(master_identifier)\n # Array accomodates future enhancements such as displaying of all related collections\n b = [get_related_objects(master_identifier).first];\n related_resources = Array.new\n b.each do |b_obj|\n pid=b_obj.id\n object = locate_by_model(pid)\n if(object)\n finding_aid = [object.finding_aid_link.first,object.finding_aid_title.first,t('tul_ohist.related_resources.label.finding_aid')]\n online_exhibit = [object.online_exhibit_link.first,object.online_exhibit_title.first, t('tul_ohist.related_resources.label.online_exhibit')]\n catalog_record = [object.catalog_record_link.first,object.catalog_record_title.first, t('tul_ohist.related_resources.label.catalog_record')]\n (related_resources ||= []) << finding_aid << online_exhibit << catalog_record\n end\n end\n return related_resources\n end", "title": "" }, { "docid": "9950ce0f43893aa02646a82ed99dc28c", "score": "0.56018674", "text": "def resource_index\n if self.class.included_modules.include? APPI::FiltersResources\n apply_filter_params resource_class.all\n else\n resource_class.all\n end\n end", "title": "" }, { "docid": "cc88f42488bb46ed32ca32e10814aa7d", "score": "0.5591767", "text": "def available_resources\n @available_resources ||= begin\n resources = release_version_cpi.spec[\"resources\"]\n if resources && resources.is_a?(Array) && resources.first.is_a?(String)\n resources\n else\n err \"template spec needs 'resources' key with list of resource pool names available; found #{release_version_cpi.spec.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "3bd9b69aff4bac132612057a452c0ebd", "score": "0.5589028", "text": "def all_resources\n raise NotImplementedError, \"Including class must override this method\"\n end", "title": "" }, { "docid": "61ebf0b11221c12b71095fe5f2f577ac", "score": "0.558493", "text": "def included_files\n @included_files ||= select_applicable(all_files)\n end", "title": "" }, { "docid": "7278752d4c3f486643e9e2c99360b0ef", "score": "0.55819666", "text": "def collect_resources_for res, arr\n arr.collect do |member|\n member == :self ? res : res.__send__(member)\n end\n end", "title": "" }, { "docid": "14379fa50c8f6fa1d4af0183b5da7262", "score": "0.55728644", "text": "def conflicting\n return [] unless @__resource\n\n @conflicts\n end", "title": "" }, { "docid": "7dbe49cf17b1eb6122761939026b0e16", "score": "0.5572292", "text": "def jsonapi_include\n return [] unless self.class.respond_to?(:allowed_includes)\n\n allowed = self.class.public_send(:allowed_includes)\n super & allowed.map(&:to_s)\n end", "title": "" }, { "docid": "0bd547612450f1703824b7dc905e77f7", "score": "0.5568358", "text": "def resources_list(session, is_sync)\n # Get resource type to list\n resource_type = session.gets.chomp.to_sym\n\n # Cache dir name to avoid repeated calls\n dir = Cfg.dir(resource_type)\n\n # Resource dir is scanned and resource directory removed from file name using sub\n # cause we want to keep resources sub directories if any\n result = []\n Find.find(dir).map do |file|\n result << [file.sub(dir, ''), File.mtime(file).to_i] unless File.directory?(file)\n end\n session.puts(result.to_json)\n session.puts(Cfg::MSG_DONE) if is_sync\n end", "title": "" }, { "docid": "2861c7a200cfb563e39b580ece8276aa", "score": "0.55682117", "text": "def find_all(req)\n result = super\n if system_plugins.include?(req.name)\n result.delete_if do |spec|\n spec.is_a?(Gem::Resolver::InstalledSpecification)\n end\n end\n subset = result.find_all do |idx_spec|\n preferred = false\n if prefer_sources[req.name]\n if idx_spec.source.respond_to?(:path)\n preferred = prefer_sources[req.name].include?(idx_spec.source.path.to_s)\n end\n if !preferred\n preferred = prefer_sources[req.name].include?(idx_spec.source.uri.to_s)\n end\n end\n preferred\n end\n subset.empty? ? result : subset\n end", "title": "" }, { "docid": "dad1b1d9ae7797247573b5ab320c551e", "score": "0.55543196", "text": "def resources_as(roles)\n as(roles).collect(&:resource).uniq\n end", "title": "" }, { "docid": "4dc803c1be4ffc9d86cddb11403eb22d", "score": "0.5554022", "text": "def resources_property\n @resources_property ||= []\n end", "title": "" }, { "docid": "e0a91a9a210e85c134a15a42e389b0b2", "score": "0.55498296", "text": "def resources\n @resources ||= Nokogiri::XML(client.get.body).xpath('/prestashop/api/*').collect { |resource| resource.name.to_sym }\n end", "title": "" }, { "docid": "9897fac0e5f92087a915820af0266553", "score": "0.55493784", "text": "def matching_resources(env)\n @resources.find_all { |resource| resource.match!(env) }\n end", "title": "" }, { "docid": "5a7f76fae299dc1791c7a59bf2f8dc63", "score": "0.5548325", "text": "def assets(extra_suffix = nil)\n return nil unless config\n\n ret = []\n config[:files].each do |requested_file|\n ret.concat(assets_for_pattern(requested_file, extra_suffix))\n end\n ret.uniq!\n ret\n end", "title": "" } ]
27ec33e1ea51de8b4fba9cb269c3af67
Check if file already exists and ask for user input on collision
[ { "docid": "0a15ac0050dc49c71884c752b652748f", "score": "0.56310654", "text": "def detect_collision\n if exist?\n if identical?\n notify(:identical, :cyan)\n elsif options[:force]\n notify(:force, :yellow)\n yield unless options[:noop]\n elsif options[:skip]\n notify(:skip, :yellow)\n else\n notify(:collision, :red)\n yield if file_collision(relative_path, content)\n end\n else\n notify(:create, :green)\n yield unless options[:noop]\n end\n end", "title": "" } ]
[ { "docid": "78b8c203ab9575cbe81908ea99df203b", "score": "0.6953877", "text": "def check_if_exists!(file)\n if File.exists?(file)\n if !@opthash[:overwrite]\n puts \"File '#{file}' exists. exiting\"\n puts \"Please use the flag -o if you want to overwrite files\"\n exit 1\n end\n end\n end", "title": "" }, { "docid": "75ae5890a19b09d8feb72636c9f483e7", "score": "0.6805999", "text": "def file_Create(fileName)\n\n #First it encryptes the userInput to our mapped words\n encrypted = naming_Of_File(fileName)\n\n #Checking if file is already created or not\n file_Is_there = File.exists? encrypted\n\n #This Will Check What the value of file_Created if it is then,\n #if it is not then,\n\n #===========================================================================\n\n begin\n #if file is not created\n if !file_Is_there\n\n #If it is not created we will created it for the user..\n File.open(encrypted, 'w')\n return \"File Created Successfully\".yellow\n\n\n #else if file in there\n else\n return \"File is already there\".red\n\n end\n\n #If the file already created then this error will be poped up\n rescue initialize\n return \"File Is Already Created\".red\n end\n\n #=============================================================================\n\n end", "title": "" }, { "docid": "02e7b0099d721b5dcdb3d0e4d66f14d9", "score": "0.6761439", "text": "def ask_for_file\n puts \"Please enter a filename\"\n filename = gets.chomp\n if File.exist?(filename)\n return filename\n else\n puts \"This file could not be found\"\n create_file\n ask_for_file\n end\nend", "title": "" }, { "docid": "d629a47f74e75f424b64c1f4fe252a89", "score": "0.6693785", "text": "def check_file_path_exist(file_path)\n while (File.exist?(file_path)!=true)\n puts Paint[\"File path or file name does not exist or has not been provided correctly. \\nPlease re-enter your path and file name (notice extension name must be provided).\", :red, :bright]\n file_path = gets().chomp()\n end\n real_file_path = file_path\n end", "title": "" }, { "docid": "6333be23f57093f416fa90d2adbc17a5", "score": "0.66295755", "text": "def warning new_name\n if File.exists? new_name\n puts \"Are you sure you want to overwrite the file. Y or N?\"\n answer = (gets.chomp).downcase\n if answer == y\n exit\n end\n end\nend", "title": "" }, { "docid": "bd6b741f1d59652281b40635265f4dc4", "score": "0.6538996", "text": "def file_collision(destination); end", "title": "" }, { "docid": "bfe68df581e49a6923a1a42477009de2", "score": "0.65320194", "text": "def ask_to_overwrite_local(path_to_file)\n create_file = true\n if File.exist?(path_to_file)\n Log.warning \"#{GitPusshuTen.y(path_to_file)} already exists, do you want to overwrite it?\"\n create_file = GitPusshuTen.yes?\n end\n create_file\n end", "title": "" }, { "docid": "cd624f44113540ee2699bd0c25c176ce", "score": "0.6520492", "text": "def check_file_existence(file, create_option, file_error_name)\n if file && !file.exist?\n puts \"Error: #{file_error_name} #{file} does not exist. Create it with #{create_option}.\"\n exit(false)\n end\n end", "title": "" }, { "docid": "b6a61c17db1715365594cabf67e79c6b", "score": "0.6505348", "text": "def force_on_collision?\n generator.ask_file_collision(target)\n end", "title": "" }, { "docid": "d0bc4c40423d7f1212a33c71a332f00b", "score": "0.6497503", "text": "def check_filename(fname)\n\tif File.exist?(fname)\n\t\tputs \"File #{fname} already exists, overwrite? y / n\"\n\t\tuntil input == \"y\" or input == \"n\"\n\t\t\tinput = gets.chomp.downcase\n\t\t\tif input == \"y\"\n\t\t\t\treturn true\n\t\t\telsif input == \"n\"\n\t\t\t\tsave\n\t\t\tend\n\t\tend\n\telse\n\t\treturn true\n\tend\nend", "title": "" }, { "docid": "c45dae59b5cfd2b673ea66853fc653cf", "score": "0.64041924", "text": "def check_file_exist(fits_index, switch, i)\n if (switch!=\"true\")&&(switch!=\"false\") then\n puts \"Please input true or false\"\n exit 1\n end\n peak_file=\"#{fits_index}_work/peakList_ch#{i.to_s}.dat\"\n if (switch==\"true\")&&(File.exists?(peak_file)==false) then\n puts \"peak file does not exist\"\n exit 1\n end\nend", "title": "" }, { "docid": "02545cbc9da92d8dc0a1f18528a75867", "score": "0.636221", "text": "def ask_and_create(file)\n puts \"#{file.basename} doesn't exist yet. Would you like to generate a sample file?\"\n confirm_generate = yes? \"Create #{file.path}? [y/N]\"\n\n if confirm_generate\n file.generate!\n else\n puts ''\n exit\n end\n end", "title": "" }, { "docid": "34a35b5c1e8a2ec9d49701ec223def54", "score": "0.6321249", "text": "def force_file_collision?(target)\r\n return false if skip\r\n return true if force\r\n \r\n prompt_out.print \"overwrite #{target}? [Ynaiq] \"\r\n prompt_out.flush\r\n case prompt_in.gets.strip\r\n when /^y(es)?$/i, ''\r\n true\r\n when /^n(o)?$/i\r\n false\r\n when /^a(ll)?$/i\r\n self.force = true\r\n true\r\n when /^i(gnore)?$/i\r\n self.skip = true\r\n false\r\n when /^q(uit)?$/i\r\n prompt_out.puts \"aborting\"\r\n raise SystemExit\r\n else force_file_collision?(target)\r\n end\r\n end", "title": "" }, { "docid": "7ced0ffc613f0b3425ccbb6881deabfb", "score": "0.62830305", "text": "def file_collision(destination)\n return true if @always_force\n options = block_given? ? \"[Ynaqdh]\" : \"[Ynaqh]\"\n\n loop do\n answer = ask(\n %[Overwrite #{destination}? (enter \"h\" for help) #{options}],\n :add_to_history => false\n )\n\n case answer\n when is?(:yes), is?(:force), \"\"\n return true\n when is?(:no), is?(:skip)\n return false\n when is?(:always)\n return @always_force = true\n when is?(:quit)\n say \"Aborting...\"\n raise SystemExit\n when is?(:diff)\n show_diff(destination, yield) if block_given?\n say \"Retrying...\"\n else\n say file_collision_help\n end\n end\n end", "title": "" }, { "docid": "e3b7f5b54a3dcb6448714b8ecc13faf2", "score": "0.6276431", "text": "def ensure_file_exists(filename)\n raise \"#{filename} not found\" unless File.exist?(filename)\n end", "title": "" }, { "docid": "d606cb5758f1375d38954455ac3bb4d2", "score": "0.6267663", "text": "def check_for_file\n raise \"input file #{path} does not exist or is a directory\" unless file_exists?\n end", "title": "" }, { "docid": "66e32796326cd27b016a484bb342dedc", "score": "0.6264353", "text": "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "title": "" }, { "docid": "66e32796326cd27b016a484bb342dedc", "score": "0.6264353", "text": "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "title": "" }, { "docid": "594891d50a1a73c5d62f9bb8ac67612d", "score": "0.62616944", "text": "def ask_to_overwrite_remote(path_to_file)\n create_file = true\n if exist?(path_to_file)\n GitPusshuTen::Log.warning \"#{GitPusshuTen.y(path_to_file)} already exists, do you want to overwrite it?\"\n create_file = GitPusshuTen.yes?\n end\n create_file\n\n end", "title": "" }, { "docid": "c5b4058047deed7490cdda6cccfcfdc2", "score": "0.62571895", "text": "def check_destination\n if File.exists?(@dest)\n overwrite = nil\n while overwrite.nil?\n print \"WARNING: File #{@dest} already exists! Overwrite it? [YES|no]: \"\n answer = gets.downcase.strip\n if /^(|y|yes)$/ =~ answer\n overwrite = true\n elsif /^(n|no)$/ =~ answer\n overwrite = false\n end\n end\n if !overwrite\n puts \"Aborted!\"\n exit\n end\n end\n end", "title": "" }, { "docid": "656ed851d62239955cd64a2874f89e46", "score": "0.6238693", "text": "def file_exists\n end", "title": "" }, { "docid": "7b76382dfe8355b30a14425bafa66ef5", "score": "0.6228539", "text": "def verify_file \n file_name = DEFAULT_FILE_NAME\n while !File.exist?(file_name) do \n file_name = get_new_file\n end\n return file_name\n end", "title": "" }, { "docid": "7ca1e712c2e824e2461a4153c08e2d56", "score": "0.61716616", "text": "def file_collision(relative_path, content)\n choices = [\n { key: 'y', name: 'yes, overwrite', value: :yes },\n { key: 'n', name: 'no, do not overwrite', value: :no },\n { key: 'q', name: 'quit, abort', value: :quit }\n ]\n answer = prompt.expand(\"Overwrite #{relative_path}?\", choices)\n interpret_answer(answer)\n end", "title": "" }, { "docid": "6527e6e6c2bfb94ef85038c544885d64", "score": "0.616247", "text": "def createOrTossFile(someFilename)\n if !File.exist?(someFilename)\n system(\"touch #{someFilename}\")\n elsif\n system(\"rm #{someFilename}\")\n system(\"touch #{someFilename}\")\n end\nend", "title": "" }, { "docid": "cd0ddec6de0caf79710eab2b4c8fdb45", "score": "0.61616874", "text": "def ensure_file(name)\n path = File.join(root,name)\n new_contents = get_template(name)\n if File.exist?(path)\n if File.file?(path)\n old_contents = File.read(path)\n if (old_contents != new_contents) && (options[:overwrite] || confirm(\"overwrite file #{path}\"))\n FileOperation.new(path, new_contents )\n else\n NullOperation.new(\"have file #{path}\")\n end\n else\n raise Error, \"cannot create file:#{path}\"\n end\n else\n FileOperation.new(path, new_contents )\n end\n end", "title": "" }, { "docid": "10a99687038bf44b2bd20cf0af200f5d", "score": "0.61500025", "text": "def check_for_file(file)\n fail \"#{file} already exists. Frozen in fear!\" if File.exist?(file)\n end", "title": "" }, { "docid": "ec6749c9eb7896659ca01ef76a373528", "score": "0.61472195", "text": "def file_Find(fileName)\n\n #First it will encrypte the user Input\n encrypted = naming_Of_File(fileName)\n\n #Then it will checks if there is a file or not\n exitsts = File.exist? encrypted\n\n #===========================================================================\n\n #If there is!! a file then, this code will run\n if exitsts\n return \"\\\"#{fileName}\\\" file is there\".yellow\n\n #If not!! then, this code will run\n else\n return \"There is no file named \\\"#{fileName}\\\"\".red\n end\n end", "title": "" }, { "docid": "45ada9bf94cdb78155cd6392b2929840", "score": "0.6145653", "text": "def force_file_collision?(destination, src, dst, file_options = {}, &block)\r\n $stdout.print \"overwrite #{destination}? (enter \\\"h\\\" for help) [Ynaqdh] \"\r\n case $stdin.gets.chomp\r\n when /\\Ad\\z/i\r\n Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|\r\n temp.write render_file(src, file_options, &block)\r\n temp.rewind\r\n $stdout.puts `#{diff_cmd} \"#{dst}\" \"#{temp.path}\"`\r\n end\r\n puts \"retrying\"\r\n raise 'retry diff'\r\n when /\\Aa\\z/i\r\n $stdout.puts \"forcing #{spec.name}\"\r\n options[:collision] = :force\r\n when /\\Aq\\z/i\r\n $stdout.puts \"aborting #{spec.name}\"\r\n raise SystemExit\r\n when /\\An\\z/i then :skip\r\n when /\\Ay\\z/i then :force\r\n else\r\n $stdout.puts <<-HELP\r\nY - yes, overwrite\r\nn - no, do not overwrite\r\na - all, overwrite this and all others\r\nq - quit, abort\r\nd - diff, show the differences between the old and the new\r\nh - help, show this help\r\nHELP\r\n raise 'retry'\r\n end\r\n rescue\r\n retry\r\n end", "title": "" }, { "docid": "fc3434730688d47554a42f53883be529", "score": "0.61295867", "text": "def check_file\n\tif File.exists?(\"inventory.accdb\") or File.exists?(\"inventory.mdb\")\n\t\tprint \"The inventory database file is there.\\n\"\n\t\tdb = AccessDb.new('inventory.accdb')\n\t\tdb.open\n\t\tscan_barcode(db)\t\t\t\n\telse\n\t\tprint \"There is no inventory file in your default directory, would you\\n\"\n\t\tprint \"like to specify a file location? (Y/N)\\n\"\n\t\tanswer = gets.chomp\n\t\tif answer == \"Y\" or answer == \"y\"\n\t\t\tprint \"Enter the full file location, including the inventory file at the end: \"\n\t\t\tdir = gets.chomp\n\t\t\twhile !File.exists?(dir)\n\t\t\t\tprint \"\\nThis file still isn't there. Try entering it again: \"\n\t\t\t\tdir = gets.chomp\n\t\t\tend\n\t\t\tprint \"\\nFound the database!\\n\"\n\t\t\tdb = AccessDb.new(dir)\n\t\t\tdb.open\n\t\t\tscan_barcode(db)\n\t\tend\n\t\tif answer == \"N\" or answer == \"n\"\n\t\t\tprint \"Fine then, I didn't want to help you anyway :|.\\n\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "1d5010a1d77bbd8aa94fae93ff5e0f8d", "score": "0.6127498", "text": "def force_on_collision?\n base.shell.file_collision(destination){ render }\n end", "title": "" }, { "docid": "91f66f234c9fda9a0ffc5479b3fb72fd", "score": "0.6105266", "text": "def get_new_filename\n\tprint \"save as?\\nEnter filename: \"\n filename= gets.chomp\n while(filename==\"\"|| File.exist?(\"#{filename}.yml\"))\n \tputs \"Invalid/That file already exists. Save as? \"\n \tfilename=gets.chomp\n end\n return filename\nend", "title": "" }, { "docid": "27cd14aa62fdb9ef18d36b532117a0a7", "score": "0.6094367", "text": "def check_if_user_gave_input\n abort(\"Please right the name of the folder after the name of your first ruby file to create\") if ARGV.empty?\nend", "title": "" }, { "docid": "e20dae2e83df4467e03d9e483bee9061", "score": "0.6068517", "text": "def filename_exist?\n if @filename\n true\n else\n puts \"You need to provide a image file\"\n puts \"For example: \"\n puts \"ruby main.ruby test.png\"\n false\n end\nend", "title": "" }, { "docid": "48f9e428946c50e0beae46bce220a416", "score": "0.60660774", "text": "def file_exist?(input_file)\n @file = Dir[\"#{DATA_PATH}/#{input_file}\"][0]\n [email protected]?\n end", "title": "" }, { "docid": "533abf11bb7621cef84e9472ff418718", "score": "0.60522383", "text": "def resource_file_exists(filename)\n unless File.exist?(filename)\n puts \"The provided resource file #{filename} doesnt exist.\"\n puts \"Please provide the correct file name and location.\"\n exit\n end\n end", "title": "" }, { "docid": "a3225bfcf90b0131f37a7b3d2f60fd74", "score": "0.6050181", "text": "def ensure_file_exists! file\n return if ::File.file? file\n fail ArgumentError, \"cannot find file #{file}\"\n end", "title": "" }, { "docid": "a3225bfcf90b0131f37a7b3d2f60fd74", "score": "0.6050181", "text": "def ensure_file_exists! file\n return if ::File.file? file\n fail ArgumentError, \"cannot find file #{file}\"\n end", "title": "" }, { "docid": "426740ff3d3fee233963e61e2216a143", "score": "0.604827", "text": "def force_on_collision?\n base.shell.file_collision(destination) { render }\n end", "title": "" }, { "docid": "ab20c4523f84bbe0816dcef1d8134c9e", "score": "0.6036619", "text": "def file_must_exist(filename, human_name)\n fatal(\"Cannot find #{human_name} #{filename}\") unless File.exist?(filename)\nend", "title": "" }, { "docid": "97ca7182f3499475ed1fe6b4aaf833c0", "score": "0.60286397", "text": "def check_file_exists file\n raise \"No such file #{file}\" unless File.exists? file\nend", "title": "" }, { "docid": "c0b7fd3988b7704a0aa4ffa6c200224d", "score": "0.60283405", "text": "def handle_existing_name(settings)\n\t# if problem occured previously\n\tFileUtils.rm_rf(settings.path, secure: true) if Dir.exists?(settings.path) and not File.exists?(settings.const_filter_file)\n\t\n\t# if name exists\n\tif Dir.exists?(settings.path)\n\t\tprint \"\nName \\\"#{settings[:name]}\\\" already exists.\n\nMerge new traces with existing (M), or\ndelete old traces and acquire new (D), or\nuse different name (N), or\ncancel (C)? \"\n\t\tch = $stdin.gets.chomp\n\t\tif merge = ch == \"M\"\n\t\t\t# i.e. merge = true\n\t\t\tputs \"\\nWill try to merge.\"\n\t\telsif ch == \"D\"\n\t\t\t# delete old traces and continue normally\n\t\t\tFileUtils.rm_rf(settings.path, secure: true)\n\t\t\tputs \"\\nOld traces deleted.\"\n\t\telsif ch == \"N\"\n\t\t\t# rename\n\t\t\tprint \"\\nEnter new name: \"\n\t\t\tbegin\n\t\t\t\tnewname = $stdin.gets.chomp\n\t\t\tend while Dir.exists?(\"#{GS[:data_dir]}/#{newname}\") and (print(\"Name #{newname} exists, enter a different name: \") or true)\n\t\t\tsettings[:name] = newname\n\t\t\tputs \"Continuing with a new name \\\"#{newname}\\\".\"\n\t\telse\n\t\t\t# cancel\n\t\t\t$stderr.puts \"\\nCancelled, exiting.\" or exit\n\t\tend\n\tend\n\t\n\treturn merge\nend", "title": "" }, { "docid": "c232b95990b7f4bf9a610dd4956d4401", "score": "0.6008767", "text": "def choose_file\n puts \"Please specify a file name\"\n puts \"If no file name is specified, students.csv will be used by default\"\n file = gets.chomp\n\n if file.empty?\n @filename = \"students.csv\"\n elsif File.exists?(file)\n @filename = file\n else\n puts \"Sorry, #{file} does not exist.\"\n choose_file\n end\nend", "title": "" }, { "docid": "619f6ba3946e6c54dc4a23cf10d053ef", "score": "0.5982799", "text": "def path_exists?(path)\n if(!Pathname.new(path).exist?)\n puts \"Sorry the file path does not exist. Please check the entered path\\n\" +\n \"Entered path: #{path}\"\n sleep 2\n return false\n end\n return true;\n end", "title": "" }, { "docid": "cb2065c6185370e583152a7ae1c59bd9", "score": "0.5982631", "text": "def file_collision(relative_path, content)\n choices = [\n { key: \"y\", name: \"yes, overwrite\", value: :yes },\n { key: \"d\", name: \"diff, compare files\", value: :diff },\n { key: \"n\", name: \"no, do not overwrite\", value: :no },\n { key: \"q\", name: \"quit, abort\", value: :quit }\n ]\n while (answer = prompt.expand(\"Overwrite #{relative_path}?\", choices)) == :diff do\n show_diff\n end\n interpret_answer(answer)\n end", "title": "" }, { "docid": "a50fa6e08da13086b65fcdaba0713e42", "score": "0.59726536", "text": "def Check_File(_Filename)\r\n unless FIle.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\nend", "title": "" }, { "docid": "836f0145551158bd51b665ac384ded8b", "score": "0.59721404", "text": "def auto_mode\n print 'Enter a Test file:'\n test_file = gets.chomp\n while !File.exists?(\"./test_files/#{test_file}.txt\")\n puts 'INVALID FILE -- Please check the spelling or existance of selected test-file.'\n test_file = gets.chomp\n end\n found_valid_file = \"./test_files/#{test_file}.txt\"\n p found_valid_file\n end", "title": "" }, { "docid": "64b629c8539e4196dca68f62eb4ebe60", "score": "0.5967841", "text": "def exist?\n filename.exist?\n end", "title": "" }, { "docid": "7f8439154ed7936c2a1d26cee76a822f", "score": "0.5966422", "text": "def file_exist?(name)\n File.exist?(name)\n end", "title": "" }, { "docid": "dc074a3e663d913dbb42581375663a93", "score": "0.5963928", "text": "def file_not_found_and_exit\n puts 'Input file not found.'\n exit 2\n end", "title": "" }, { "docid": "21c5dad8e14213b95e7b0a000d8b6dc6", "score": "0.5957325", "text": "def ensure_exists(sketch)\n puts \"Couldn't find: #{sketch}\" and exit unless FileTest.exist?(sketch)\n end", "title": "" }, { "docid": "ab54a977513545d1b88a84851520e5c8", "score": "0.59313565", "text": "def file_exist(name)\n if File.exist?(name)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "f8c1953879b1addd0f4e1e89c9191069", "score": "0.5921504", "text": "def exist\n ask_for(:exist, :with_arg => nil)\n end", "title": "" }, { "docid": "b2ae6a203e81f215c23675e16f2ccbed", "score": "0.58947635", "text": "def is_new?\n !File.exists?(@filename)\n end", "title": "" }, { "docid": "ad5779b08f43cabc6f5c68551478d4cd", "score": "0.58814937", "text": "def ensure_file_exist(filename)\n Dir.mkdir(filename) unless File.exist?(filename)\n end", "title": "" }, { "docid": "ad5779b08f43cabc6f5c68551478d4cd", "score": "0.58814937", "text": "def ensure_file_exist(filename)\n Dir.mkdir(filename) unless File.exist?(filename)\n end", "title": "" }, { "docid": "c9911a292c396864fc8f61b36d16add4", "score": "0.5881329", "text": "def fetch_file\n if check_file \n success \"#{filename} already exists, skipping\"\n return true\n else\n download\n end\n end", "title": "" }, { "docid": "b2f6662ce9285017bea69e35f15770e9", "score": "0.58799493", "text": "def handle_neither_exist(df)\n puts \"#{df} not found locally or on dropsync.\"\n puts \"We are creating one for you ...\"\n folder = prompt(\"Is it a folder? [y/N]: \") == 'y'\n if folder\n Dir.mkdir(\"#{DROPBOX_BASE}/.sync/#{df}\")\n else\n File.open(\"#{DROPBOX_BASE}/.sync/#{df}\", \"w\") {}\n end\n link_files(df)\nend", "title": "" }, { "docid": "c024c2faba1c556488b0f041c217ae05", "score": "0.58795184", "text": "def already_there(target, full_target)\n File.exists?(full_target) and (!CHECKSUMS.key?(target) or Digest::MD5.file(full_target).hexdigest == CHECKSUMS[target])\n end", "title": "" }, { "docid": "f7c3029cdea7e24ef3e8f8e5e5313e55", "score": "0.5869943", "text": "def exist?\n File.exist? filename\n end", "title": "" }, { "docid": "e6f987372c3d106f6709c5fddce476a4", "score": "0.5866458", "text": "def createSync(filename) \n\tprint \"Enter path of where you would like to sync: \"\n\tpath = gets.chomp\n\tFile.new(path + filename)\nend", "title": "" }, { "docid": "d6f718c3ccab06feb9f0898285bad179", "score": "0.5866184", "text": "def score?; File.exists? path_score end", "title": "" }, { "docid": "72c866dc7f326e1660978c536864d8af", "score": "0.58652914", "text": "def write_okay?(file)\n if File.exist?(file)\n if $FORCE\n FileUtils.rm_r(file)\n else\n return nil.status(:already_exists, file)\n end\n end\n true\n end", "title": "" }, { "docid": "f52d0ca608762f6991e9ae7e443e0a77", "score": "0.58652514", "text": "def check_existence path, params = nil\n params ||= {}\n params[:thing] ||= \"dosier/fichier “#{path && File.basename(path)}”\"\n params[:success] ||= \"le #{params[:thing]} existe bien.\"\n params[:failure] ||= \"le #{params[:thing]} est introuvable…\"\n params[:interactive].nil? && params[:interactive] = true\n if path && File.exists?(path)\n if params[:interactive]\n notice \"---> #{params[:success]} 👍\"\n end\n return true\n else\n error \"🚫  #{params[:failure]}\"\n return false\n end\n end", "title": "" }, { "docid": "065f515417519ff794a50f6925ba6be5", "score": "0.58550304", "text": "def must_be_an_existing_file\n errors.add(:complete_path, \"is not an existing file\") unless file?\n end", "title": "" }, { "docid": "fe760d401ca208c63c84ff7b945477d8", "score": "0.58491105", "text": "def check_for_duplicate_entry\n if file?(plist_path)\n fail_with 'FileError', \"Duplicate LaunchAgent plist already exists at #{plist_path}\"\n end\n end", "title": "" }, { "docid": "4e63f2c4c97faabc4388bc1ddb7d9f5d", "score": "0.5844788", "text": "def does_bin_already_exist?(competitor_name)\n return true if File.exists?(\"#{@battlecode_bin_path}/#{competitor_name}\")\n return false\n end", "title": "" }, { "docid": "246e5fe4d3748427cd30c41dd46596d2", "score": "0.58153707", "text": "def check_if_overwriting loc\n raise OverwriteError, \"#{loc} already exists! really want to overwrite it?\", caller if File.exist? loc\n end", "title": "" }, { "docid": "80341dd6564c878603069653c58fafa4", "score": "0.5811506", "text": "def check(icon_name, icon_file)\n if !(File.exist?(icon_file))\n puts \"MISSING:\" if !$has_missing\n $has_missing = true\n puts icon_name\n end\nend", "title": "" }, { "docid": "70673613596338dc710bee71dd4aabde", "score": "0.5806038", "text": "def pbRgssExists?(filename)\r\n if safeExists?(\"./Game.rgssad\")\r\n return pbGetFileChar(filename)!=nil\r\n else\r\n filename = canonicalize(filename)\r\n return safeExists?(filename)\r\n end\r\nend", "title": "" }, { "docid": "79ca4fc4b09926dc49ef687aefc9b99c", "score": "0.5804639", "text": "def save_game\n puts 'Please input a filename:'\n # Avoid allowing user to choose the extension.\n filename = gets.chomp.delete('.')\n if File.exist? \"./saves/#{filename}.yaml\"\n puts \"The file ./saves/#{filename}.yaml already exists.\"\n puts 'Do you want to overwrite this file? [y/n]'\n response = gets.chomp.upcase\n raise StandardError('Invalid Response.') unless response == 'Y'\n end\n write_to_file filename\n # Indicate the loop should break and store the new file in the hash.\n @game_saved = true\n populate_save_hash\n rescue StandardError\n retry\n end", "title": "" }, { "docid": "3aef7ab5f36a07fbe6fdc1f6d8addba0", "score": "0.57813436", "text": "def overwrite_file?(path)\n decision = choose(\"#{path} already exists as a dotfile. Do you want to replace it?\", 'replace', 'skip') do |menu|\n menu.index = :letter\n menu.layout = :one_line\n end\n decision == 'replace'\n end", "title": "" }, { "docid": "9a4b936cb8a55096fe8962f2cdf291da", "score": "0.57657605", "text": "def verify_file(filename)\n if File.file?(\"./#{filename}\")\n true\n else\n puts 'Usage: / ruby cub.rb cookbookname'\n exit\n end\nend", "title": "" }, { "docid": "aa2988c9028fc0aa7e2005450ddee118", "score": "0.57642484", "text": "def ensure_exists\n create unless Dir.exist? path\n end", "title": "" }, { "docid": "59be8183c1dc7e60bf6a1f879ba2b232", "score": "0.5760091", "text": "def validate_file(filename)#validates the file existence\n\t\tif File.exist? (filename)\n\t\t\tputs \"Note: Valid file name : #{filename}\"\n\t\telse\n\t\t\tputs \"Note: Invalid file name : #{filename}\"\n\t\t\tabort(\"ERROR : Invalid file name : #{filename} ... Exiting... [Note: Please correct the file path/name]\")\n\t\tend\n\tend", "title": "" }, { "docid": "bd00698a4bb029e37cc92359c8ddbd40", "score": "0.5760062", "text": "def overwrite_file?\n decision = choose(\"#{@path} already exists as a dotfile. Do you want to replace it? Your original file will be renamed.\", 'replace', 'abort') do |menu|\n menu.index = :letter\n menu.layout = :one_line\n end\n\n decision == 'replace'\n end", "title": "" }, { "docid": "23974aea440545c263530278d1776df3", "score": "0.573929", "text": "def create_file(file)\n#Function that deletes a file with a given name and creates it again everytime it is called.\n#Input: name of the file\n\n if File.exists? (file)\n File.delete(file)\n end\n\n return File.open(file, 'w')\nend", "title": "" }, { "docid": "ddb5489638acc3cbb5e4021012aeb9df", "score": "0.5737652", "text": "def create_file_unless_existing(file_path, content)\n return if File.exist? file_path\n File.open(file_path, 'w') do |f|\n f.puts content\n end\n say \"Created `#{file_path}`\"\n end", "title": "" }, { "docid": "633d3dee47c74a5d5a159b9dac19ab11", "score": "0.57271284", "text": "def check_for_web_page_overwrite\n if File.exist?(HTML_OUT_FNAME)\n STDERR.puts <<-OVERWRITE_EOM\n\n WARNING: This program will create the file '#{HTML_OUT_FNAME}',\n however this file already exists in this directory!\n\n 1) Please check that you are running this program in the right\n directory.\n\n 2) Otherwise, please move, rename or delete the existing file\n '#{HTML_OUT_FNAME}' before running this program again.\n\n Program now ending.\n\n OVERWRITE_EOM\n exit 2\n end\nend", "title": "" }, { "docid": "eb516448e9e638d7f8c7275692bae376", "score": "0.572616", "text": "def exist?(filename)\n FileTest.exist?(filename)\n end", "title": "" }, { "docid": "d81bfffc93ddea86033ff155b8f98d65", "score": "0.57044303", "text": "def initialize (file_name)\n @file_name = file_name\n \n case file_name\n when File.exists?(file_name) == true\n\tputs \"#{$mark_Green} File exist\"\n\tlogger.info \"#{file_name} file is exist!\"\n when File.exists?(file_name) == false\n\tputs \"#{$mark_Red} File is not exist\"\n\tlogger.error \"#{file_name} file is not exist!\"\n\texit!\t\t# Back to prompt\n end\n \n end", "title": "" }, { "docid": "16a8d51ff6b15b8be5def56874a4b5f0", "score": "0.56981254", "text": "def file_exists(ip_filename, script_filename)\r\n if ip_filename.nil?\r\n puts\r\n puts 'You haven\\'t entered an IP filename.'\r\n puts\r\n show_usage\r\n false\r\n elsif script_filename.nil?\r\n puts\r\n puts 'You haven\\'t entered a script filename.'\r\n puts\r\n show_usage\r\n false\r\n else\r\n\r\n # Checking and opening IP and Ports file\r\n begin\r\n File.open(ip_filename, 'r') do |f|\r\n f.each_line do |line|\r\n $ips_and_ports.push(line.strip.gsub(/\\t/,' '))\r\n end\r\n end\r\n rescue Errno::ENOENT\r\n puts\r\n puts \"Failed to open #{ip_filename}.\"\r\n puts\r\n show_usage\r\n false\r\n end\r\n\r\n # Checking and opening script txt file\r\n begin\r\n File.open(script_filename, 'r') do |f|\r\n f.each_line do |line|\r\n $script_lines.push(line.strip)\r\n end\r\n end\r\n rescue Errno::ENOENT\r\n puts\r\n puts \"Failed to open #{script_filename}.\"\r\n puts\r\n show_usage\r\n false\r\n end\r\n end\r\nend", "title": "" }, { "docid": "d3ae79d1a8a1b18604dc1dbca1ee4514", "score": "0.5697041", "text": "def files_exist?\n File.exists?(options.dictionary) and File.exists?(options.puzzle)\n end", "title": "" }, { "docid": "8c79e1c2acc89ea30c8133076e9508c4", "score": "0.5693964", "text": "def overwrite?(path)\n if File.exist?(path)\n return yes? \"A file already exists at '#{ path }'. Do you want to overwrite? [y/n]\"\n end\n true\n end", "title": "" }, { "docid": "7366976645893da59ca9fd266dfe086a", "score": "0.5690315", "text": "def exist?(name, options = nil)\n read_file\n @cache.nil? ? nil : @cache.include?(name.to_s)\n end", "title": "" }, { "docid": "d9fcc9dd0af576c24a8ed09dff5bd717", "score": "0.56879216", "text": "def file_exsists?(filename, directory = '/')\n req = Net::HTTP::Head.new(\"/bingo#{directory}/#{filename}\")\n req.digest_auth(@username, @password, @res)\n @last_response = @http.request(req)\n return @last_response.code.eql?(\"200\")\n end", "title": "" }, { "docid": "3b11ef9c1a6e178b9a86f05f793ced2b", "score": "0.56878024", "text": "def file_exists? params=nil\n File.exists?(db.absolute(self.send(aaif[:name_field]),\n params))\n end", "title": "" }, { "docid": "b4254b8f966c70fb4ec2f761962fd2ba", "score": "0.5680005", "text": "def check_file_existence(files)\n\tfiles.each do |file|\n\t\tpath = Rails.root.join('db','data',file)\n\n\t\tFile.file?(path) || raise('File %s does not exist. Did you misspell the file name?' % file)\n\tend \nend", "title": "" }, { "docid": "1872270388dca23c1ecd148e769953f7", "score": "0.5658131", "text": "def try_save_students(filename)\n filename.nil? ? filename = @loadfile : filename\n if File.exists? (filename)\n save_students(filename)\n puts \"Saved to file: #{filename}\"\n else\n puts \"Sorry, file doesn't exist\"\n return\n end\nend", "title": "" }, { "docid": "a2769b0d23ba4cbfac8b489aee04b155", "score": "0.56496954", "text": "def file_exists?\n File.file?(file_path_and_name)\n end", "title": "" }, { "docid": "acd6e98ccc14d750fd2f57c7d6d49e77", "score": "0.5649583", "text": "def exist?\n File.file?(@file)\n end", "title": "" }, { "docid": "3d77a4ab05d5e669371e53085f962208", "score": "0.56466323", "text": "def file_exists_in_guest?(file)\n output = `#{@base_command} -gu #{@guest_user} -gp #{@guest_password} fileExistsInGuest \"#{datastore}\" \"#{file}\"`\n# output = system(vm_command)\n if output =~ /The file exists/\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "7427a48b7ba914e1b5eb9549f2436445", "score": "0.56462085", "text": "def existing_file\n if sqlite3 && database && !File.exist?(database)\n self.errors.add(:database, :not_exist)\n end\n end", "title": "" }, { "docid": "0b6ab636cc2b7be01f160da8b8375e3f", "score": "0.564148", "text": "def simulate_existing_file(file, data = \"some existing text\\n\")\n # raise \"File #{file} already exists in call to simulate_existing_file\" if File.exist?(file)\n path = Pathname.new(File.join(destination_root, file))\n mkdir_p(path.dirname)\n File.open(path, \"w+\") do |f|\n f.puts(data) if data.present?\n end\nend", "title": "" }, { "docid": "7a70a1e8fec47350baa563e807e1405d", "score": "0.5638836", "text": "def exist?\n !find_file.nil?\n end", "title": "" }, { "docid": "0ef98aba55778ac247762b25d1033ea2", "score": "0.5635076", "text": "def config_file_does_not_exist!\n return unless File.exist?(config_file_path)\n\n puts \"\\nConfiguration file already exists, please move or rename: #{config_file_path}\\n\\n\"\n exit(-1)\n end", "title": "" }, { "docid": "cbe8e9cfa18a3d4fe866d84e91c83256", "score": "0.56339055", "text": "def exist?\n !original_filename.blank?\n end", "title": "" }, { "docid": "a536a1fe12331b2f6d52d109a55a9347", "score": "0.56305355", "text": "def ensure_aliases_file_exists\n unless io.file_exists?(FilePath)\n io.exec(\"touch #{FilePath}\")\n end\n end", "title": "" }, { "docid": "930b34db4824248e09e132faf6a19654", "score": "0.5627322", "text": "def get_input_file\n print \"\\nPlease enter the path to the #{@input_type} input file\\n\\n#{PROMPT}\"\n path = gets\n if path == \"\" then path = Dir.pwd + \"//input//\" + \".#{@input_type}\"; end;\n if File.exists?(path.chomp!)\n return path\n else\n puts \"#{path} is not a valid path to a file...\\n\\n\"\n get_input_file\n end\nend", "title": "" }, { "docid": "4d6c35f8b204bfd88ae0509587f8e923", "score": "0.5623571", "text": "def check_if_user_gave_input\n abort(\"mkdiruby : Please enter the new Repository name\") if ARGV.empty?\nend", "title": "" }, { "docid": "13d076bddefc5b68587c124719411c13", "score": "0.5621714", "text": "def file_exists(filename)\n if filename.nil?\n puts\n puts 'You haven\\'t entered a filename.'\n puts\n show_usage\n false\n else\n begin\n File.open(filename, 'r') do |f|\n f.each_line do |line|\n $ips.push(line.strip)\n end\n end\n rescue Errno::ENOENT\n puts\n puts \"Failed to open #{filename}.\"\n puts\n show_usage\n false\n end\n end\nend", "title": "" } ]
29963b6d519e4c4bca773ace702bca7c
check if all elements in tree is lesser than value
[ { "docid": "1a7decd29ffe81b75d82cff5234e9c01", "score": "0.7101835", "text": "def is_subtree_lesser(root, value)\nend", "title": "" } ]
[ { "docid": "b7e900fc79654e786b1ee1a5b02e1926", "score": "0.71955454", "text": "def is_subtree_lesser?(value, root = @root)\n return true if root == nil\n if root.value <= value &&\n is_subtree_lesser?(value, root.link_left) &&\n is_subtree_lesser?(value, root.link_left) \n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "ef6627ef061a83bd4aa9d432451f2fed", "score": "0.7070122", "text": "def check_tree\n nodes = @nodes.collect { |node| node if node.id>=0 } #without deleted\n nodes.compact!\n\n size = nodes.all? do |node|\n node.size>=@min && node.size<=@max\n end\n\n val = nodes.all? do |node|\n less, greater = [], []\n node.sub_trees.each_with_index do |sub_tree, index|\n less << ( @nodes[sub_tree].right < node.keys[index] if index<node.size && !sub_tree.nil? )\n greater << ( @nodes[sub_tree].left > node.keys[index-1] if index>0 && !sub_tree.nil? )\n end\n less.compact!.delete(false).nil? && greater.compact!.delete(false).nil? #Arrays has only true values ?\n end\n \n size && val\n end", "title": "" }, { "docid": "6aa771107f12b58c7c4c39d99a7ad182", "score": "0.67165995", "text": "def validate_bst(node)\n return true if node.less.nil? && node.more.nil?\n if node.less.nil? && node.more.value < node.value\n validate_bst(node.more)\n elsif node.more.nil? && node.less.value < node.value\n validate_bst(node.less)\n elsif node.less.value < node.value && node.more.value < node.value\n validate_bst(node.less)\n validate_bst(node.more)\n end\n false\n\nend", "title": "" }, { "docid": "0d9e248ee3e89ef8dcdd7e601004aa40", "score": "0.6616107", "text": "def lesser_than(value)\n lt value\n end", "title": "" }, { "docid": "4084733ce1d770ff540f782d6c373e2b", "score": "0.6490399", "text": "def call(root, min = nil, max = nil)\n min ||= 10 ** 5 * -1\n max ||= 10 ** 5\n\n # We are in a leaf no worries keep going\n return true if root == nil\n\n return false unless call(root.left, min, root.value)\n # let's say that all duplicates go on the left\n return false unless min <= root.value && root.value < max\n return false unless call(root.right, root.value, max)\n\n # update the global min. It's okay this is not cheating\n @min_value = root.value\n\n true\n end", "title": "" }, { "docid": "0c844fb46ead550e54f8d2a9559b7555", "score": "0.64324754", "text": "def my_min(list)\n list.each do |ele|\n if list.all? { |ele_2| ele_2 >= ele }\n return ele\n end \n end\n false \nend", "title": "" }, { "docid": "91bfff3efb6a98fba1d3b7d00f966127", "score": "0.63848734", "text": "def my_min2(list)\n test_el = list.first\n list.each { |el| test_el = el if el < test_el }\n\n test_el\nend", "title": "" }, { "docid": "5acb6d43ef617fc81c20169770225619", "score": "0.6374606", "text": "def contains(value)\n current_node = self\n\n while !current_node.nil?\n if value < current_node.value\n current_node = current_node.left\n elsif value > current_node.value\n current_node = current_node.right\n else\n return true\n end\n end\n\n return false\n\n end", "title": "" }, { "docid": "9c75ce76575817b8a745af61b2e9c97a", "score": "0.636789", "text": "def floor(value)\n # We're going to use a private method which also takes a node as input\n # This allows us to use recursion\n # We evaluate here to avoid bringing nil into comparisons in #find_floor\n best_find = find_floor(value, @root)\n best_find > value ? nil : best_find\n end", "title": "" }, { "docid": "907b4175c0e71508f60bac719e1c50a7", "score": "0.63543165", "text": "def bst?(node)\n min = -Float::INFINITY\n traverse_in_order(node) do |n, op|\n case op\n when :gt\n return false if n.val <= min\n when :geq\n return false if n.val < min\n end\n\n min = n.val\n end\n true\nend", "title": "" }, { "docid": "d45b891141c6f87d6df0680c1346b30b", "score": "0.6303803", "text": "def find(val)\n if self.value == val\n return true\n else\n self.value > val ? prune(self.left_child, val) : prune(self.right_child, val)\n end\n end", "title": "" }, { "docid": "32d200f862ac3969f8da2d415be9c233", "score": "0.6295866", "text": "def minimum_value(node)\n node = node.left until node.left.nil?\n node\n end", "title": "" }, { "docid": "6ead019bcdbcd6e09b62e96df9f0b1b7", "score": "0.6295856", "text": "def tree_minimum_support(node)\n y = node\n until y.left.nil? do\n y = y.left\n end\n y\n end", "title": "" }, { "docid": "d455ac2aced8fbf81532dd7cc63a09a8", "score": "0.6270617", "text": "def > other_node\n return true if other_node.nil?\n\n self.val > other_node.val && self > other_node.left && self > other_node.right\n end", "title": "" }, { "docid": "f2bdf279b2b3fcd9cbfb171a93a30dc4", "score": "0.6269625", "text": "def min_value_with_loop(root = @root)\n return nil if root == nil\n until root.link_left == nil\n root = root.link_left\n end\n root.value\n end", "title": "" }, { "docid": "604bdb6e0ff3230309804f5d4b4114c8", "score": "0.6245616", "text": "def minimum_value(value)\n minimum_value = value\n until value.left.nil?\n minimum_value = value.left.data\n value = value.left\n end\n minimum_value\n end", "title": "" }, { "docid": "287161ee657df9bbf3ca8d2d7eb34bad", "score": "0.6200967", "text": "def min_value(node)\n current = node\n current = current.left until current.left.nil?\n\n current.data\n end", "title": "" }, { "docid": "e10ce8baf25058e293134a3754ed4940", "score": "0.6194162", "text": "def < other_node\n return true if other_node.nil?\n\n self.val < other_node.val && self < other_node.left && self < other_node.right\n end", "title": "" }, { "docid": "fccb727ea8fa8d6c8e582225c323a4fa", "score": "0.61791086", "text": "def my_min_1(arr)\n arr.each do |element|\n min = true\n arr.each do |compare_element|\n min = false if compare_element < element\n end\n\n return element if min\n end\nend", "title": "" }, { "docid": "2389a75d8d1d32c9bbfd6a31638edae5", "score": "0.6178246", "text": "def min_value_node(node)\n current = node\n\n while current.left != nil\n current = current.left\n end\n return current\n end", "title": "" }, { "docid": "957a3df4a56b9c44848c893d9417e5c9", "score": "0.61724913", "text": "def level(value)\n current_node = @root\n tracker = 1\n\n until current_node.nil? || current_node.value == value\n tracker += 1\n current_node = current_node.value < value ? current_node.right : current_node.left\n end\n\n current_node.nil? ? nil : tracker\n end", "title": "" }, { "docid": "7cd40c1df37af653e5904e5067a7e6cc", "score": "0.61700964", "text": "def contains?(value)\n current_node = self\n\n while !current_node.nil?\n if value < current_node.value\n current_node = current_node.left\n elsif value > current_node.value\n current_node = current_node.right\n else\n return true\n end\n end\n\n false\n end", "title": "" }, { "docid": "449a8e7b616a6b1948e457a9634443c8", "score": "0.616399", "text": "def my_min(arr)\n arr.each do |element|\n return element if arr.all? {|ele| ele >= element}\n end\nend", "title": "" }, { "docid": "dc48827ff8e08e4490abad73a6f9d0d5", "score": "0.61528873", "text": "def my_min_1(list)\n\n (0...list.length).each do |i|\n return list[i] if list.all? {|ele| ele >= list[i]} \n end\n\nend", "title": "" }, { "docid": "7978d27c9ab2cdde672341cb0d3b38f8", "score": "0.614033", "text": "def search(value)\n node = @root # node could be named current_node\n\n while node\n return true if node.value == value\n value < node.value ? node = node.left : node = node.right\n end\n\n return false\n end", "title": "" }, { "docid": "68a1067e3ff1fbd6fdc2b034c8461d34", "score": "0.61307955", "text": "def my_min(list)\n min = 0\n list.each do |ele1|\n min = ele1 if list.all? do |ele2|\n ele1 <= ele2\n end\n end\n min\nend", "title": "" }, { "docid": "a87fb6cec22dc694aeb7b324686554f5", "score": "0.61178136", "text": "def binary_search_tree(one_tree)\n \n nodes = []\n nodes.push([one_tree, -Float::INFINITY, Float::INFINITY])\n \n while nodes.any? \n node, lowest_number, highest_number = nodes.pop\n \n return false if ((node.current_value <= lowest_number) || (node.current_value >= highest_number))\n \n nodes.push([node.left, lowest_number, node.current_value]) if node.left\n nodes.push([node.left, node.current_value, highest_number]) if node.right\n end \n true\nend", "title": "" }, { "docid": "cc51a46fed104f611ceede19dc946e76", "score": "0.6084418", "text": "def find_min(root)\n until root.left_child.nil?\n root = root.left_child\n end\n root\n end", "title": "" }, { "docid": "e51aebcb1fd0d2ee06ebbfcdc22561d7", "score": "0.607762", "text": "def my_min_1(list)\n\n list.each do |num_1|\n return num_1 if list.all? { |num_2| num_1 <= num_2 }\n end\nend", "title": "" }, { "docid": "58cb1fff0d38970cb3a71b910be7dff3", "score": "0.60637933", "text": "def largestValuesInTreeRows(t)\n res = []\n return res if t.nil?\n\n node_queue = [[t, 0]]\n\n until node_queue.empty?\n node, depth = node_queue.shift\n if res[depth].nil? || node.value > res[depth]\n res[depth] = node.value\n end\n\n node_queue.push([node.left, depth + 1]) if node.left\n node_queue.push([node.right, depth + 1]) if node.right\n end\n res\nend", "title": "" }, { "docid": "985855187aafa9c05234f8949f725012", "score": "0.60360175", "text": "def smallest_value(root = @root)\n smallest = root.data\n until root.left.nil?\n smallest = root.left.key\n root = root.left\n end\n smallest\n end", "title": "" }, { "docid": "0b23de6b48fcf00d6efbe998d5c7ea26", "score": "0.60338336", "text": "def find(value)\n node = root\n\n loop do\n if node.nil? || value == node.data\n break\n elsif value < node.data\n # TODO: move parent tracking somewhere else\n temp = node\n node = node.left\n node.parent = temp unless node.nil?\n elsif value > node.data\n # TODO: move parent tracking somewhere else\n temp = node\n node = node.right\n node.parent = temp unless node.nil?\n end\n end\n\n node\n end", "title": "" }, { "docid": "bca1406f77cf5304ee0f8b5f8556fabb", "score": "0.60248405", "text": "def less_than value\n @items.with_filter(attribute, \"LT\", value)\n end", "title": "" }, { "docid": "57e88e68e7d378750f4143c876726e6f", "score": "0.60231096", "text": "def traverse(value)\n curr_node = @root\n \n until !curr_node.left && value <= curr_node.value || !curr_node.right && value > curr_node.value\n \n if value <= curr_node.value\n curr_node = curr_node.left\n elsif value > curr_node.value\n curr_node = curr_node.right\n end \n # if value <= start.value && !start.left \n # start.left = BSTNode.new(value)\n # found = true\n # elsif value > start.value && !start.right \n # start.right = BSTNode.new(value)\n # found = true\n # elsif value <= start.value && start.left.value \n # start = start.left\n # found = false \n # elsif value > start.value && start.right.value\n # start = start.right\n # found = false \n # end\n end \n curr_node\n end", "title": "" }, { "docid": "d16538b7c54257cf24585595662bce33", "score": "0.60110587", "text": "def min\n val = min_node(@root).data if @root\n val\n end", "title": "" }, { "docid": "9eb27083d89040e3d81d7b25aefacc65", "score": "0.5999672", "text": "def greater_or_equals(value)\n ge(value)\n end", "title": "" }, { "docid": "9b43164d3cacf98c14f9d569eaa98188", "score": "0.5996", "text": "def good_my_min(list)\n min_el = nil\n list.each do |el1|\n min_el = el1 if min_el.nil? || el1 < min_el\n end\n\n min_el\nend", "title": "" }, { "docid": "85ed1759c947b8fff8609cd9c4deb625", "score": "0.59926397", "text": "def min\n minNode = self\n\n @children.each do |subtree|\n if subtree.min.value < minNode.value\n minNode = subtree.min\n end\n end\n minNode\n end", "title": "" }, { "docid": "51f08bfd07fd51306d87644419457fff", "score": "0.59913486", "text": "def tree_minimum(x)\n return if x.nil?\n while !x.left.nil?\n x = x.left\n end\n x\n end", "title": "" }, { "docid": "b0126ec70eab9a6bea77939568382c17", "score": "0.5983114", "text": "def get_node_with_lowest_f_value(nodes)\n chosen_node = nil\n\n nodes.each do |node|\n chosen_node = node if chosen_node.nil? || get_f_value(node) < get_f_value(chosen_node)\n end\n\n chosen_node\n end", "title": "" }, { "docid": "18285fc58c9b586e2a9dcca9949fde6b", "score": "0.59804183", "text": "def largest_smallerthan_x(root, x=MAX_INT)\n if root.val >= x # its left or doesnt exist\n\n if root.left? # might be one in the left tree\n return largest_smallerthan_x(root.left, x)\n else # came up empty\n return nil\n end\n\n else # could be root or right tree\n\n if root.right? # might be one in the right tree\n r = largest_smallerthan_x(root.right, x) # check right tree\n return r unless r.nil? # found one in the right tree\n end\n root # didn't find or no right tree exists\n\n end\nend", "title": "" }, { "docid": "f808b5c32f8541a64aca828a61ce0b42", "score": "0.5960365", "text": "def my_min_v1(list)\n list.each do |l|\n flag = true\n list.each do |k|\n flag = false if l > k\n end\n return l if flag == true\n end\nend", "title": "" }, { "docid": "e1a42d47df341069897cb9ddd7067060", "score": "0.5958838", "text": "def include?(value)\n node = @tree\n while !node.nil?\n if node.key > value\n node = node.left\n elsif node.key < value\n node = node.right\n elsif node.key == value\n return true\n end\n end\n false\n end", "title": "" }, { "docid": "70cd7f63a2e98d0b103708da32344194", "score": "0.59498274", "text": "def my_min(list)\n result = 0\n list.each do |i|\n result = i if list.all? {|ele| i <= ele}\n end\n result\nend", "title": "" }, { "docid": "8e2994f352875c48eca13b7ce96512cd", "score": "0.59317106", "text": "def succ(key)\n return if @root.nil? or @root.right_child.nil?\n _min(@root.right_child)\n end", "title": "" }, { "docid": "e5e0bebeaa610f243a0ce6cbeae449c5", "score": "0.5925818", "text": "def traverse(value)\n current_node = root\n loop do\n break if current_node.value == value\n\n if (value < current_node.value)\n next_node = current_node.left\n if next_node != nil\n if next_node.value < value\n # insert inbetween\n elsif next_node.value > value\n # insert leave\n current_node == current_node.left\n end\n\n end\n elsif (value > current_node.value)\n if current_node.right != nil\n current_node == current_node.right\n end\n end\n end\n current_node\n end", "title": "" }, { "docid": "0c22dad9e4b3e4b3743c70be39a7daf2", "score": "0.5918654", "text": "def find_min\n raise \"Empty heap\" if @list.nil?\n remove_min_tree.first.root\n end", "title": "" }, { "docid": "7f4232807f64680e8fb05bc14031019d", "score": "0.5910886", "text": "def search(value)\n node = @root\n while node\n if value > node.value\n node = node.right\n elsif value < node.value\n node = node.left\n else\n break\n end\n end\n node\n end", "title": "" }, { "docid": "2de141a0a305825ede2786eb501748e1", "score": "0.5906765", "text": "def closest(value)\n closest = node = @root\n while node\n if value > node.value && node.right && node.right.value < value\n node = node.right\n elsif value < node.value && node.left && node.left.value > value\n node = node.left\n else\n break\n end\n closest = node\n end\n closest\n end", "title": "" }, { "docid": "d9829af7a9c14981f10e6b4e5174ff55", "score": "0.59061277", "text": "def less_than(value, references)\n return value.to_f < references.to_f\n end", "title": "" }, { "docid": "46a4d9634c47d5f78d680ab6266fe0a8", "score": "0.5905202", "text": "def my_min(arr)\n arr.each do |ele_1|\n return ele_1 if arr.all? { |ele_2| ele_1 <= ele_2 }\n end\nend", "title": "" }, { "docid": "9418fc8dbc20e82c90adb6744e848130", "score": "0.5901082", "text": "def compare_and_compute_node(node, x)\n return x.left if node.value < x.value\n x.right\n end", "title": "" }, { "docid": "03cc015da3b0e4878bfa0531af170687", "score": "0.5900021", "text": "def my_min(list)\n list.each_with_index do |ele, i|\n num = ele\n if list.all? { |l| num <= l }\n return num\n end\n end\nend", "title": "" }, { "docid": "679c4e6c0a44d14f6582886b797b1655", "score": "0.5895742", "text": "def minValueNode(node)\n current = node\n #loop down to leftmost leaf\n until current.left == nil\n current = current.left\n end\n return current\n end", "title": "" }, { "docid": "2f1b9a385a9f83cc419b47adb2218571", "score": "0.58759236", "text": "def find(value)\n @known = @root\n hit = false; result = \"#{value} not found\"\n until hit == true\n if @known == value\n result = @known; hit = true\n\n elsif @known.nil? || @known.is_leaf?\n hit = true\n elsif @known > value # [value < @known] doesn't work\n @known_prev = @known\n @known = @known.left_child\n elsif @known < value\n @known_prev= @known\n @known = @known.right_child\n end\n end\n return result\n end", "title": "" }, { "docid": "a49ab2834eedb15e7399501099c13564", "score": "0.58747554", "text": "def minimal_tree(sorted_array)\n minimal_tree_helper(sorted_array, 0, sorted_array.length - 1)\nend", "title": "" }, { "docid": "78b05093eb04a5094a29dac0abd2673e", "score": "0.58409786", "text": "def min\n return if @root.nil?\n _min(@root)\n end", "title": "" }, { "docid": "10eea11e195b8ca7a61efb07f100c5d0", "score": "0.5840385", "text": "def first_value\n tree = @nodes[@root]\n loop do\n break if tree.leaf?\n tree = @nodes[tree.sub_trees[0]]\n end\n if tree.size>0 then tree.left else false end\n end", "title": "" }, { "docid": "08210d02a08c56c03af5802278c908b5", "score": "0.58386284", "text": "def min\n find_min_node.value\n end", "title": "" }, { "docid": "c4b7194b91e53c5f66d9a4633fca1513", "score": "0.583525", "text": "def test_min_block\n assert_equal 9, @triple.min { |e, f| -e <=> -f }\n end", "title": "" }, { "docid": "754fcf5f1b1e0b0518d954d23d85bc4c", "score": "0.58306247", "text": "def find(value)\n return unless contains?(value)\n\n current_node = @root\n until current_node.nil?\n break if current_node.value == value\n\n # if value is less set the current node to the left child otherwise set the current node to the right child\n current_node.value > value ? current_node = current_node.left_child : current_node = current_node.right_child\n end\n current_node\n end", "title": "" }, { "docid": "956a5b434295defea02bc4e519ce46cf", "score": "0.58246446", "text": "def tree_successor(x)\n return if x.nil?\n return tree_minimum(x.right) unless x.right.nil?\n y = x.p\n while !y.nil? && x == y.right\n x = y\n y = y.p\n end\n y\n end", "title": "" }, { "docid": "3eabb054afd199e1082c972f9c59ff4d", "score": "0.58243835", "text": "def insert(value)\r\n current_node = @root\r\n while current_node != nil # while there currently is a node\r\n if value < current_node.value && current_node.left == nil # when there is no node to the left\r\n current_node.left = TreeNode.new(value, nil, nil) # Create a new node to the left\r\n elsif value > current_node.value && current_node.right == nil # when there is no node to the right\r\n current_node.right = TreeNode.new(value, nil, nil) # Create a new node to the right\r\n elsif value < current_node.value # when the value is smaller than the current node's value and there is a node to the left\r\n current_node = current_node.left # current node is set to current node's left\r\n elsif value > current_node.value # when the value is greater than the current node's value and there is a node to the right\r\n current_node = current_node.right # current node is set to current node's right\r\n else\r\n return\r\n end\r\n end\r\n end", "title": "" }, { "docid": "268d28174d79d45735069c60e8e3d3c2", "score": "0.5813632", "text": "def my_min(arr)\n\n\n arr.each do |el1|\n #assume el1 is the smallest\n smallest = true\n arr.each do |el2|\n #compare el1 and el2\n if el1 > el2\n smallest = false\n end\n end\n #return l1 if all el2s are bigger than el1\n return el1 if smallest == true\n end\n\nend", "title": "" }, { "docid": "a315629e1bec4e4d5eacd3e0cfb3c3c2", "score": "0.5812487", "text": "def insert_with_loop(value)\n new_node = Node.new(value)\n #if tree is empty root points to new element (node)\n if @root == nil \n @root = new_node\n return\n end\n #if tree is not empty, traversal until method find appropriate place\n temp_node = @root\n while true \n if value <= temp_node.value\n if temp_node.link_left == nil\n temp_node.link_left = new_node\n return\n else\n temp_node = temp_node.link_left\n end\n else #value > temp_node.value\n if temp_node.link_right == nil\n temp_node.link_right = new_node\n return\n else\n temp_node = temp_node.link_right\n end\n end\n end\n end", "title": "" }, { "docid": "d726c3c753c70818cef373269d1d6bbd", "score": "0.58091265", "text": "def succ(value)\n find_result = find_value(value)\n if find_result[:find]\n node = @nodes[find_result[:node]]\n position = node.keys.index(value)\n\n if node.sub_trees[position+1].nil? # Is next value in sub tree ?\n if value==node.right # Value is at node end ?\n if node.id==@root\n parent = node\n parent_position = node.keys.index(value)+1\n else\n parent = @nodes[node.parent]\n parent_position = parent.find_subtree(value)\n end\n if parent_position<parent.size then parent.keys[parent_position] else false end\n else\n node.keys[position+1]\n end\n else\n sub_tree = @nodes[node.sub_trees[position+1]]\n loop do\n break if sub_tree.leaf?\n sub_tree = @nodes[sub_tree.sub_trees[0]]\n end\n sub_tree.left\n end\n else\n false\n end\n end", "title": "" }, { "docid": "8c8ae145ef73aa7d40d66421fba3c97f", "score": "0.58090794", "text": "def check_weight(node)\n return node.weight if node.children.nil?\n\n weights = node.children.map { |c| check_weight(c) }\n if weights.uniq.size == 1\n return node.weight + weights.inject(&:+)\n else\n diff = weights.max - weights.min\n id = weights.index(weights.max)\n puts node.children[id].weight - diff\n exit\n end\nend", "title": "" }, { "docid": "ffc5d3469a1a68e33f573bc96afbba97", "score": "0.5803518", "text": "def find(value)\n curr = root\n\n while curr do\n if curr.value == value\n return curr\n else\n curr = curr.value > value ? curr.left : curr.right\n end\n end\n end", "title": "" }, { "docid": "6f1f12e157060cb04bdaac63e2267df6", "score": "0.5796667", "text": "def >=(o); ge(o); end", "title": "" }, { "docid": "e5cb4c9e695811e324225f82329243b8", "score": "0.5796151", "text": "def inOrder(node)\n\n\tif(node == nil)\n\t\treturn true\n\tend\n\n\treturn false unless inOrder(node.left)\n\n\tif node.value < $currentNode\n\t\treturn false\n\tend\n\t$currentNode = node.value\n\t# compare to previous value?\n\t# return false if not greater than previous, otherwise continue\n\treturn false unless inOrder(node.right)\n\treturn true\nend", "title": "" }, { "docid": "43fa824f7c853ae109ab57d39e946081", "score": "0.5792965", "text": "def value_fiter(value)\n @orders.select { |order| order.value > value }.size\n end", "title": "" }, { "docid": "ca93761f2aa64b603bae9794e0ffa9b7", "score": "0.57923985", "text": "def my_min_2(list)\n current_min = 0\n list.each do |el|\n current_min = el if el < current_min\n end\n current_min\nend", "title": "" }, { "docid": "22708a69ba0f5cbf91f8105e8e71583b", "score": "0.5790438", "text": "def s_min\n return nil if @root.nil?\n\n current_node = @root\n current_node = current_node.left until current_node.left.nil?\n current_node.value\n end", "title": "" }, { "docid": "6db07a29734a274af7b0badc73aceba3", "score": "0.5787998", "text": "def my_min2(list)\n min = 0\n list.each do |ele|\n min = ele if min >= ele\n end\n min\nend", "title": "" }, { "docid": "3dd3679cac07b865e2f9f667036be144", "score": "0.57760036", "text": "def find_value(value_to_find, root)\n current = root\n\n until current.nil?\n return puts true if current.data == value_to_find\n\n current = if value_to_find < current.data\n current.left\n else\n current.right\n end\n end\n\n puts false\n end", "title": "" }, { "docid": "ce3900e8e3bbc4ad453840b3067ae704", "score": "0.57750344", "text": "def my_min_slow(list) # n = input\n list.each do |ele1| # loops n times\n list.all? do |ele2| # loops n times\n if ele1 < ele2\n return ele1\n end\n end\n end\nend", "title": "" }, { "docid": "15aa85aaaa899572217e4bfe051a09ee", "score": "0.5770033", "text": "def my_min(array)\n array.each do |el1|\n smallest = true\n array.each do |el2|\n smallest = false if el2 < el1\n end\n return el1 if smallest\n end\nend", "title": "" }, { "docid": "40f28b66eea67f72fb27c2425de6583d", "score": "0.5759093", "text": "def find(value)\n raise(ArgumentError, 'value cannot be nil') if value.nil?\n\n if empty?\n nil\n else\n target = @root\n target = (target.value >= value ? target.left : target.right) while target&.value&.!=(value)\n target\n end\n end", "title": "" }, { "docid": "569fd759eea7dbccda645f054d5747ab", "score": "0.5757574", "text": "def find(value, node = @root)\n until value == node.value\n if value < node.value\n node.left ? node = node.left : break\n elsif \n node.right ? node = node.right : break\n end\n end\n\n node\n end", "title": "" }, { "docid": "3b0510afca8b3d88444a49a18b91c24f", "score": "0.5756001", "text": "def delete(value)\n current_node = @root\n parent_node = nil\n while(current_node)\n if(current_node.value == value)\n if(current_node.right == nil)\n if(parent_node == nil)\n @root = current_node.left\n else\n if(current_node.value < parent_node.value)\n parent_node.left = current_node.left\n else\n parent_node.right = current_node.left\n end\n end\n elsif(current_node.right.left == nil)\n if(parent_node == nil)\n @root = current_node.right\n else\n if(current_node.value < parent_node.value)\n parent_node.left = current_node.right\n else\n parent_node.right = current_node.right\n end\n end\n else\n left_most = current_node.right.left\n left_most_parent = current_node.right\n while(left_most.left != nil)\n left_most_parent = left_most\n left_most = left_most.left\n end\n\n left_most_parent.left = left_most.right\n left_most.left = current_node.left\n left_most.right = current_node.right\n\n if(parent_node == nil)\n @root = left_most\n else\n if(current_node.value < parent_node.value)\n parent_node.left = left_most\n else\n parent_node.right = left_most\n end\n end\n end\n return current_node.value\n elsif(value < current_node.value)\n parent_node = current_node\n current_node = current_node.left\n else\n parent_node = current_node\n current_node = current_node.right\n end\n end\n end", "title": "" }, { "docid": "d3d8ab5327852e1f116531ac794e4cf3", "score": "0.57510453", "text": "def insert(val)\n #check if value is already within tree\n if self.find(val)\n puts \"Value already in tree\"\n return nil\n else\n place = false\n end # => end of conditional\n\n cursor = @root\n place = false\n until place = true\n if val > cursor.data && val > cursor.right.data\n #if value is greater than cursor data, move to right\n cursor = cursor.right\n elsif val < cursor.data && val < cursor.left.data\n #if value is lesser than cursor data, move to left\n cursor = cursor.left\n elsif val \n \n end # => end of conditional\n end # => end of until \n end", "title": "" }, { "docid": "d1e6456fcabe77b5e0228ba91afa739f", "score": "0.57472986", "text": "def my_slow_min(list)\n list.each do |el|\n min = true \n list.each do |el2|\n min = false if el2 < el \n \n end \n return el if min \n end \nend", "title": "" }, { "docid": "6533f22769fe185e18b1d4281e8d57f0", "score": "0.5742271", "text": "def bst_checker(root)\n pos_infinity = 1.0 / 0.0\n neg_infinity = -1.0 / 0.0\n stack = [[root, pos_infinity, neg_infinity]]\n\n while stack.any?\n node, lower_bound, upper_bound = stack.pop\n\n return false if ( node.value < lower_bound ) and ( node.value > upper_bound )\n\n stack.push([ node.left, lower_bound, node.value ]) if node.left\n stack.push([ node.right, node.value, upper_bound ]) if node.left\n\n # if node.left or node.right are nil, they won't be pushed to the stack\n end\n\n return true\nend", "title": "" }, { "docid": "a8d18244ae3d407db8b6e4b8845295ef", "score": "0.5742244", "text": "def find(value)\nreturn \"Sorry your tree doesn't include the value\" if root == nil\nnode = @root\nuntil node.data == value\n break if node == nil\n if node.data < value\n node = node.right_child\n else\n node = node.left_child\n end\nend\nnode\nend", "title": "" }, { "docid": "59439159e5e1b3b72b76e78fc7f2c209", "score": "0.5739124", "text": "def find(value)\n current_node = @root\n until current_node.nil?\n return current_node if current_node.data == value\n\n current_node = value > current_node.data ? current_node.right : current_node.left\n end\n current_node\n end", "title": "" }, { "docid": "85293f271b045638c97059af0bc20c4e", "score": "0.573882", "text": "def min(sorted_set, value)\n sorted_set.each do |val|\n return val if val > value\n end\n return sorted_set.first\nend", "title": "" }, { "docid": "572168f48ea0f461b9ba26f967d57374", "score": "0.5736443", "text": "def compare_and_insert(value, node)\n if node.value > value\n if !node.left\n new_node = BSTNode.new(value)\n node.left = new_node\n new_node.parent = node\n else\n compare_and_insert(value, node.left)\n end\n elsif !node.right\n new_node = BSTNode.new(value)\n node.right = new_node\n new_node.parent = node\n else\n compare_and_insert(value, node.right)\n end\n end", "title": "" }, { "docid": "71090a2600f3a3e7b13344496d5b9c6a", "score": "0.5732013", "text": "def height(value)\nnode = @root\n return \"Sorry your tree seems to be empty\" if node == nil\n\n until node.data == value\n if value < node.data\n node = node.left_child\n else value > node.data\n node = node.right_child\n end\n end\n \n queue = []\n queue.push(node)\n left_counter = 0\n right_counter = 0\n \n until queue.empty?\n level_size = queue.length?\n level = []\n level_size.times do\n node = queue.shift\n queue.push(node.left_child) unless node == nil\n left_counter += 1 unless node == nil\n queue.push(node.right_child) unless node == nil\n right_counter += 1 unless node ==nil\nend\nend\nif left_counter > right_counter\n print \"#{values} height is #{left_counter}\"\nelse\n print \"#{values} height is #{right_counter}\"\nend\nend", "title": "" }, { "docid": "6c772805e3c43f215c486674f9808175", "score": "0.5725547", "text": "def test_sorting_nodes_into_array_by_ascending_score_value\n assert_equal [({\"Armageddon\" => 58}),({\"Star Trek\" => 85}),({\"Sharknado 3\" => 92})], @tree.sort(@tree.root_node)\n end", "title": "" }, { "docid": "3da60f6c9cd129eeb3e1262d1b430aa5", "score": "0.57239527", "text": "def my_min(list)\n ans = list.first \n list.each do |ele|\n if ele < ans \n ans = ele \n end \n end \n ans \nend", "title": "" }, { "docid": "6d3cfca32c184e2188cc436858a264b4", "score": "0.57187825", "text": "def largestValuesInTreeRows(t)\n\n maxValues = {}\n nodes = []\n if t\n nodes << [t, 0]\n end\n while !nodes.empty?\n a = nodes.pop\n node = a[0]\n depth = a[1]\n if !maxValues[depth] || node.value > maxValues[depth]\n maxValues[depth] = node.value\n end\n if node.left\n nodes.unshift [node.left, depth + 1]\n end\n if node.right\n nodes.unshift [node.right, depth + 1]\n end\n end\n maxValues.values\n\nend", "title": "" }, { "docid": "184f407eb0bc991290fcbb2c3f723039", "score": "0.5708929", "text": "def key_for_min_value(item)\n smallest_value = nil \n other_value = nil\n item.each do |key, value|\n if other_value == nil || value < other_value\n other_value = value \n smallest_value = key\nend\nend\nsmallest_value\nend", "title": "" }, { "docid": "235cc576928251c7350356c450cdee0d", "score": "0.57081145", "text": "def contains?(value, root = @root)\n #NOTE if value are diff data type will throw error(if you searching for integer in tree of strings)\n return false if root == nil\n if root.value == value\n return true\n elsif value <= root.value\n contains?(value, root.link_left)\n else\n contains?(value, root.link_right)\n end\n end", "title": "" }, { "docid": "996855ba723f5bc862c3a4bc75c7633c", "score": "0.5705283", "text": "def smallest(array)\n anchor = array.first\n array.each do |value|\n anchor = value if value < anchor\n end\n anchor\nend", "title": "" }, { "docid": "c92668c575d3871c3b98d4f1456589f0", "score": "0.5704754", "text": "def find_lowest(root)\n current = root\n until current.left.nil?\n current = current.left\n end\n return current\n end", "title": "" }, { "docid": "987265ee268afe86d37f590a6beb1967", "score": "0.5704263", "text": "def my_min_1(list)\n smallest = nil\n list.each do |el1|\n smallest = el1 if smallest == nil\n list.each do |el2|\n if el2 < el1 && el2 < smallest\n smallest = el2\n end\n end\n end\n smallest\nend", "title": "" }, { "docid": "40146dde7eb503d60ac07a3c20896915", "score": "0.5703376", "text": "def greater(value, neighbor)\n neighbor == nil || value >= neighbor\n end", "title": "" }, { "docid": "99f386041fb3ea367598febb146e3e55", "score": "0.56995", "text": "def contains?(value, node = @root)\n return false if node.nil?\n\n if node.value == value\n true\n elsif value > node.value\n contains?(value, node.right)\n else\n contains?(value, node.left)\n end\n end", "title": "" }, { "docid": "ad1bdcfca3b35ce45ec0a3e7e6366f1f", "score": "0.56848824", "text": "def gte_min?(integer_value)\n return true if min.nil?\n integer_value >= min\n end", "title": "" }, { "docid": "912085a42d2c23d0b6cc6b35b44f66be", "score": "0.5682845", "text": "def largestValuesInTreeRows(t)\n return [] unless t\n queue = [t]\n children = []\n out = [t.value]\n row_largest = nil\n until queue.empty?\n current = queue.shift\n if current.left\n children << current.left\n if row_largest.nil? || row_largest < current.left.value\n row_largest = current.left.value\n end\n end\n if current.right\n children << current.right\n if row_largest.nil? || row_largest < current.right.value\n row_largest = current.right.value\n end\n end\n if queue.empty?\n queue = children\n out << row_largest if row_largest\n row_largest = nil\n children = []\n end\n end\n out\nend", "title": "" } ]
190e5db94cb2cb7644be278cc9b4afc7
Used to set meta data in headers.
[ { "docid": "1403b7ecf8d15e53e6e70aa089ad3046", "score": "0.0", "text": "def injectable_meta \n set_meta_tags title: \"#{controller_name.humanize.titleize + ' - ' + action_name.capitalize}\",\n description: 'NoBull Software Co.\\'s NoBull Website Ordering Thingy™!👋' ,\n keywords: 'webapp, web site development, business information',\n index: false,\n nofollow: true,\n icon: [\n { href: \"#{ActionController::Base.helpers.asset_path('favicon.ico')}\"},\n { href: \"#{ActionController::Base.helpers.asset_path('favicon-96x96.png')}\", sizes: '32x32 96x96', type: 'image/png' },\n { href: \"#{ActionController::Base.helpers.asset_path('apple-icon.png')}\", rel: 'apple-touch-icon-precomposed', sizes: '32x32', type: 'image/png' },\n ]\n end", "title": "" } ]
[ { "docid": "c24d9de19f45c7aa17796e0755e324c8", "score": "0.77405524", "text": "def set_meta_headers(headers)\n @logger.info \"Setting #{headers.keys.join(', ')} for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n :headers => headers\n })\n\n # Confirm meta data changes\n response = @connection.request({\n :method => 'HEAD'\n })\n\n @logger.info \"Done setting account meta key.\"\n end", "title": "" }, { "docid": "3f115a35aa4754c2a34f83eb1760424c", "score": "0.7497527", "text": "def meta(meta_data)\n @_meta = meta_data\n end", "title": "" }, { "docid": "149cd43823dc9df02c71fc088a4be8e0", "score": "0.74807924", "text": "def set_meta\n meta.tap do |m|\n m.tag = [{\n system: META_SYSTEM,\n code: META_CODE,\n display: META_DISPLAY\n }]\n end\n end", "title": "" }, { "docid": "55d4243817af7bfe0eca96d2875613e1", "score": "0.7378034", "text": "def set_meta\n puts 'meta'\n end", "title": "" }, { "docid": "6e32a41352aa84e6c2cc329696b086a2", "score": "0.6489013", "text": "def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend", "title": "" }, { "docid": "cec5c986e60ed5c8ef40210baaf7fecd", "score": "0.6487701", "text": "def headers=(hash); end", "title": "" }, { "docid": "cec5c986e60ed5c8ef40210baaf7fecd", "score": "0.6487701", "text": "def headers=(hash); end", "title": "" }, { "docid": "b6784abd39656d9bf4ce8de9eea06124", "score": "0.6456048", "text": "def add_meta_data(meta_hash)\n meta.merge! meta_hash\n end", "title": "" }, { "docid": "94a37cf3010abfc71155267ef94dbabf", "score": "0.645019", "text": "def set_meta_headers_for(instance)\n # Open storage with cf admin credentials for setting quotas and meta-key\n storage_options_for_tenant = @fog_options[:storage].merge(:hp_tenant_id => instance.tenant_id)\n storage = VCAP::Services::Swift::Storage.new(@logger, storage_options_for_tenant)\n storage.set_meta_key_and_quotas(instance.account_meta_key, BASE_QUOTA)\n end", "title": "" }, { "docid": "9516e10f1eaf4f3bb720a8b034446584", "score": "0.64348626", "text": "def set_header key, value\n headers.update(key => value)\n end", "title": "" }, { "docid": "1a22640ad4f2799a55545b062243fafb", "score": "0.64112186", "text": "def fill_header(response); end", "title": "" }, { "docid": "08bdca1b88f7e2269c278419b4480b9a", "score": "0.64106935", "text": "def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n arr.inject({}) do |hash, hdr|\n key, val = hdr.split(/:\\s+/, 2)\n hash[key.downcase] = val\n hash\n end\n end\n end", "title": "" }, { "docid": "ab860a0f3e4ecc47b2143c96205f4b42", "score": "0.6391362", "text": "def header(name, value)\n har_headers << [name, value]\n super(name, value)\n end", "title": "" }, { "docid": "26588b231630360edf8fd96ad29c9b61", "score": "0.6381457", "text": "def set_header name, value\n response_object.header name, value\n end", "title": "" }, { "docid": "35f2513dc871cb1af058812a190928c1", "score": "0.6368427", "text": "def headers=(hash)\n if headers\n headers.replace hash\n else\n super\n end\n end", "title": "" }, { "docid": "ae23f52089d6afa26f7d08907d3499be", "score": "0.6339865", "text": "def []=(k, v) @headers[translate_header_to_sym(k)] = v end", "title": "" }, { "docid": "d74ccec5aeb840fcac568292c11f5c67", "score": "0.63379997", "text": "def metadata=(_); end", "title": "" }, { "docid": "a1555ce8ef44fcc6feb58a8f128cf604", "score": "0.632615", "text": "def add_headers; end", "title": "" }, { "docid": "635313e4be7106452b0d9871c8a11da3", "score": "0.6319316", "text": "def set_header(object, key, value)\n headers = object.is_a?(::ActionController::Response) ? object.headers : object\n \n info = case headers[\"Ajax-Info\"]\n when String\n JSON.parse(headers[\"Ajax-Info\"])\n when Hash\n headers[\"Ajax-Info\"]\n else\n {}\n end\n\n # Deep merge hashes\n if info.has_key?(key.to_s) &&\n value.is_a?(Hash) &&\n info[key.to_s].is_a?(Hash)\n value = info[key.to_s].merge(value, &DEEP_MERGE)\n end\n\n # Concat arrays\n if info.has_key?(key.to_s) &&\n value.is_a?(Array) &&\n info[key.to_s].is_a?(Array)\n value = info[key.to_s].concat(value)\n end\n \n info[key.to_s] = value\n headers[\"Ajax-Info\"] = info.to_json\n end", "title": "" }, { "docid": "26e2ad0cffb6e23e9f626e9bf3c39def", "score": "0.62933743", "text": "def set_attributes_from_header(page, filepath)\n template = Locomotive::Mounter::Utils::YAMLFrontMattersTemplate.new(filepath)\n\n if template.attributes\n attributes = template.attributes.clone\n\n # set the editable elements\n page.set_editable_elements(attributes.delete('editable_elements'))\n\n # set the content type\n if content_type_slug = attributes.delete('content_type')\n attributes['templatized'] = true\n attributes['content_type'] = self.mounting_point.content_types.values.find { |ct| ct.slug == content_type_slug }\n end\n\n page.attributes = attributes\n end\n\n page.template = template\n end", "title": "" }, { "docid": "6deebeb47e6430f6ecd2beddb09355d4", "score": "0.62932974", "text": "def header=(new_header)\n @header = new_header\n # prepare defaults\n @header[\"description\"] ||= \"\"\n # handle tags\n @dependencies = parse_tag_list(Array(@header[\"requires\"]))\n @provides = parse_tag_list(Array(@header[\"provides\"]))\n\n @extends = case @header[\"extends\"]\n when Array then Tag.new(@header[\"extends\"][0])\n when String then Tag.new(@header[\"extends\"])\n else nil\n end\n\n @replaces = case @header[\"replaces\"]\n when Array then Tag.new(@header[\"replaces\"][0])\n when String then Tag.new(@header[\"replaces\"])\n else nil\n end\n end", "title": "" }, { "docid": "32398ef3f12b9468cc99f6751a31bc06", "score": "0.628214", "text": "def head \n meta_author \"Kane Baccigalupi\"\n end", "title": "" }, { "docid": "44e1a4574168e5471209b332a99f3088", "score": "0.62272304", "text": "def set_metadata(*args)\n self.metadata.set(*args)\n end", "title": "" }, { "docid": "39c5d782c46c50d658e5666df72df21a", "score": "0.62261933", "text": "def set_headers(parsed_response)\n headers['expire_at'] = parsed_response[\"exp\"].to_s\n end", "title": "" }, { "docid": "dbea285ab0610f51ed3697023e29a37e", "score": "0.62086046", "text": "def response_metadata=(_); end", "title": "" }, { "docid": "b19c5f98f5a3b0f188e9560ed841975c", "score": "0.6205435", "text": "def set_meta(key, value)\n metas.where(key: key).update_or_create({value: fix_meta_value(value)})\n cama_set_cache(\"meta_#{key}\", value)\n end", "title": "" }, { "docid": "b9e678381d2487c11827445197e61aa5", "score": "0.6203427", "text": "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "title": "" }, { "docid": "b9e678381d2487c11827445197e61aa5", "score": "0.6203427", "text": "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "title": "" }, { "docid": "b9e678381d2487c11827445197e61aa5", "score": "0.6203427", "text": "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "title": "" }, { "docid": "e184c4b454c0d7ae5ddacad5d397ddf1", "score": "0.61862946", "text": "def []=( key, value )\n _meta_data[key.to_s] = value\n end", "title": "" }, { "docid": "54255ba3e984ea71b8f2711d074daca9", "score": "0.6174947", "text": "def meta\n meta = {}\n set_meta(meta)\n return meta\n end", "title": "" }, { "docid": "a300e903fc53ce4dc1ed99329b968ed1", "score": "0.61703044", "text": "def add_meta(meta)\n self.meta.merge!(meta)\n self\n end", "title": "" }, { "docid": "076ede876c1589f1199b9b590448cd00", "score": "0.61626345", "text": "def setup_header(dat)\n @headers = { to: to }\n dat.each do |key, val|\n key = key.to_s.downcase\n raise \"invalid field #{key}\" unless valid_fields.include?(key)\n @headers[key.to_sym] = val unless val.nil?\n end\n end", "title": "" }, { "docid": "6a1866ba6f8cda35648661d645d8a239", "score": "0.61066663", "text": "def set_header_options(curl)\n summary = summary_for_feed\n \n unless summary.nil?\n curl.headers['If-None-Match'] = summary[:etag] unless summary[:etag].nil?\n curl.headers['If-Modified-Since'] = summary[:last_modified] unless summary[:last_modified].nil?\n end\n \n curl\n end", "title": "" }, { "docid": "22ae7825da22d6babc733b09bd1a7d3c", "score": "0.6106591", "text": "def store_metadata\n html = HTMLParse.new(url)\n self.meta_title = html.title\n self.meta_desc = html.desc\n end", "title": "" }, { "docid": "89cf1756b0afde67a7db7c2bb948fb2a", "score": "0.6098334", "text": "def headers\n super\n @headers['User-Agent'] = \"Recurly Ruby Client v#{VERSION}\"\n @headers\n end", "title": "" }, { "docid": "82d1304355e81599e915d9c6d217c824", "score": "0.6095844", "text": "def headers=(headers)\n @headers = headers.merge({\"User-Agent\" => user_agent})\n end", "title": "" }, { "docid": "e0957abd6ebcf9d66d26d3a78f1f73c2", "score": "0.6082997", "text": "def meta\n @meta ||= decoded_body[:meta]\n end", "title": "" }, { "docid": "4f95a6e63ca72a368f4878087066ba82", "score": "0.608293", "text": "def header_set(name, value)\n return dup_without_response.header_set(name, value) if response\n\n name = name.to_s\n if value.nil?\n @headers.delete name\n return self\n end\n\n @headers[name] = value.to_s\n self\n end", "title": "" }, { "docid": "7efbf87bfab2373a721d68b021cd23a3", "score": "0.60776645", "text": "def add_caching_headers\n if etag = resource.generate_etag\n response.headers['ETag'] = ensure_quoted_header(etag)\n end\n if expires = resource.expires\n response.headers['Expires'] = expires.httpdate\n end\n if modified = resource.last_modified\n response.headers['Last-Modified'] = modified.httpdate\n end\n end", "title": "" }, { "docid": "5b8283982c0fcc8494dc55cc844367a2", "score": "0.60739654", "text": "def fill_header response\n @response = Mechanize::Headers.new\n\n response.each { |k,v|\n @response[k] = v\n } if response\n\n @response\n end", "title": "" }, { "docid": "2f152db7f51fb270e67cce41f2a6dfe1", "score": "0.6073899", "text": "def set_headers # :nodoc:\n {\n 'User-Agent' => \"twm-ruby-#{VERSION}\",\n 'Content-Type' => 'application/json; charset=utf-8',\n 'Accept' => 'application/json'\n }\n end", "title": "" }, { "docid": "6b32a17dfd34f2b32fbc436205b4ec2c", "score": "0.60734326", "text": "def on_header_init()\n end", "title": "" }, { "docid": "5c9d3f6dbcb8501d793be7ba66261d9e", "score": "0.605898", "text": "def perform\n add_request_if_new do |request|\n request.header_set(*arguments)\n end\n end", "title": "" }, { "docid": "76971f566ea2e66aa9885bceef79a9b2", "score": "0.6058978", "text": "def headers\n end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6055378", "text": "def headers; end", "title": "" }, { "docid": "dae513c3e68a04a9af8203f158ade4e4", "score": "0.6054232", "text": "def []=(name, value)\n if name.to_s == 'body'\n self.body = value\n elsif name.to_s =~ /content[-_]type/i\n header[name] = value\n elsif name.to_s == 'charset'\n self.charset = value\n else\n header[name] = value\n end\n end", "title": "" }, { "docid": "374bf5fbf15a51266f599f6deb71e563", "score": "0.60327536", "text": "def []=(key, value)\n @header[key] = value\n end", "title": "" }, { "docid": "739492920aa931f02272b3049214ec9f", "score": "0.6027368", "text": "def set_bookmark_meta_data\n begin\n page = Pismo::Document.new(self.full_url)\n self.name = page.html_title\n self.favicon_url = page.favicon\n self.description = page.description\n rescue => e\n self.description = \"Error => #{e}\"\n ensure\n self.save\n end\n end", "title": "" }, { "docid": "0c406557409031d34420f5377891ff57", "score": "0.60270697", "text": "def set_header(header, value)\n @lunetas_headers[header.to_s] = value\n end", "title": "" }, { "docid": "5a947301699504ff4fe22bcdb3d447cc", "score": "0.60175663", "text": "def create_header(meta_data)\n station = meta_data.station\n start_date = meta_data.start_date\n @header = I18n.t(\"forecast_text.main.header_start\")\n @header.concat(station.name)\n @header.concat(I18n.t(\"forecast_text.main.header_conn\"))\n @header.concat(start_date.to_s)\n nil\n end", "title": "" }, { "docid": "8b13c80888f7888bbbc5c0618afcd693", "score": "0.60007805", "text": "def header=(header)\n @header = header\n end", "title": "" }, { "docid": "c7604b7110cc3e2a0f9d99a977276e68", "score": "0.5990257", "text": "def meta_information\n @meta_hash ||= {}\n end", "title": "" }, { "docid": "6c6d96e8d508fd9fc57f43fa3e4605e6", "score": "0.5981487", "text": "def set_page_meta_tags\n req = self.request\n set_meta_tags_for_url_path(req.base_url, req.fullpath)\n end", "title": "" }, { "docid": "b6147673ab1d1af149ea7e0fb53a691d", "score": "0.59742457", "text": "def meta_data\n @meta_data ||= params['metaData']\n end", "title": "" }, { "docid": "98a7328780ad14075767ff0d260aabac", "score": "0.5972414", "text": "def metadata=(value)\n @metadata = value\n end", "title": "" }, { "docid": "98a7328780ad14075767ff0d260aabac", "score": "0.5972414", "text": "def metadata=(value)\n @metadata = value\n end", "title": "" }, { "docid": "ba89e05dfa82453c306740d6fc0eaea6", "score": "0.5962191", "text": "def method_missing(m, *args, &block)\n\t\t\treturn super unless header.respond_to?(m)\n\t\t\theader.send(m, *args, &block)\n\t\tend", "title": "" }, { "docid": "26202767d517f42f00565e3dc907b682", "score": "0.59619987", "text": "def set_individual_action_meta_information(args={})\n\t\t\t@title = args[:title]\n\t\t\t@meta_description = args[:description]\n\t\tend", "title": "" }, { "docid": "a6a3e44093242e4709f59e853db62f9f", "score": "0.5957452", "text": "def []=(key, value)\n @headers[key] = value\n end", "title": "" }, { "docid": "d5ea41b00604e0afe99ba5c163b3af2a", "score": "0.5951591", "text": "def upd_header(headers)\n hdr={'Content-Type' =>'application/json'}\n if(headers!=nil)\n headers['Content-Type']='application/json'\n hdr=headers\n end\n hdr\n end", "title": "" }, { "docid": "cf5a1204dc90f8d4e8e23c3e54d20556", "score": "0.5951222", "text": "def site_meta\n end", "title": "" }, { "docid": "cf5a1204dc90f8d4e8e23c3e54d20556", "score": "0.5951222", "text": "def site_meta\n end", "title": "" }, { "docid": "48d0d88cd716cd32eb21bf68f2bfe209", "score": "0.59470075", "text": "def set_meta(data)\n \n data[LASERID] = self.identity.chomp\n data[LASER_CURRENT] = self.laser_current.chomp\n data[PIEZO_WAVEFORM] = self.piezo_waveform.chomp\n data[PIEZO_FREQUENCY] = self.piezo_frequency.chomp\n data[PIEZO_AMPLITUDE] = self.piezo_amplitude.chomp\n data[PIEZO_OFFSET] = self.piezo_offset.chomp\n data[PIEZO_VOLTAGE] = self.piezo_voltage.chomp\n data[LASER_TEMP] = self.laser_temperature.chomp\n data[CC_ENABLE] = self.cc_enable.chomp\n\n end", "title": "" }, { "docid": "d6ed592a1988931e55110c9fcd84c0c1", "score": "0.5946156", "text": "def set_account_meta_key(account_meta_key)\n @logger.info \"Setting account meta key for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n :headers => { \n 'X-Account-Meta-Temp-URL-Key' => account_meta_key\n }\n })\n \n # Confirm meta data changes\n response = @connection.request({\n :method => 'HEAD'\n })\n \n @logger.info \"Done setting account meta key.\"\n end", "title": "" }, { "docid": "cb942e4aa1b3f487c600ab8fd5318b2e", "score": "0.5945452", "text": "def set_asset_metadata\n headers = fog_connection.head_object(CarrierWave::Uploader::Base.fog_directory, upload_data[:path]).headers\n\n self.name = upload_data[:filename]\n self.size = headers['Content-Length']\n self.etag = headers['Etag']\n self.content_type = headers['Content-Type']\n end", "title": "" }, { "docid": "1a381ef88a88b20a951efa8f0c69cb2a", "score": "0.59377635", "text": "def addMeta(platform, key, value)\n if @support_platforms.include?(platform) then\n if not @meta_data.key?(platform)\n @meta_data[platform] = Hash.new\n end\n \n if @allow_override_meta then\n @meta_data[platform][key] = value\n elsif (@meta_data[platform][key] == nil ) then\n @meta_data[platform][key] = value\n else\n puts \"Meta #{key}=>#{@meta_data[platform][key]} already exists, can not override it.\"\n end\n else\n raise \"The given #{platform} platform not support.\"\n end\n end", "title": "" }, { "docid": "f2eb3637362ec9382b6c4baa1546e3d9", "score": "0.5936535", "text": "def set_request_headers!(request); end", "title": "" }, { "docid": "3130efd63a73b24297b2e195b98cf522", "score": "0.5935775", "text": "def setup_attributes\n setup_location_header\n # TODO: Should setup_content_length_header?\n setup_status_and_body\n end", "title": "" }, { "docid": "8a45df2a467bf66052491cf62bd63e9e", "score": "0.59276885", "text": "def set_seo_meta(title,keywords = '',desc = '')\n if title\n @page_title = \"#{title}\"\n if params[:page]\n @page_title += \" &raquo; (First#{params[:page]}Page)\"\n end\n @page_title += \" &raquo; #{@setting.site_name}\"\n else\n @page_title = @setting.site_name\n end\n @meta_keywords = keywords\n @meta_description = desc\n end", "title": "" }, { "docid": "edbe4f5419827ab6ec41c091e5c12a30", "score": "0.5918208", "text": "def set_header(name, value)\n @headers[name] = value\n \n return self\n end", "title": "" }, { "docid": "e4c1d1b71994adf233610727ba678d33", "score": "0.5913648", "text": "def add_metadata(meta={})\n @local_metadata.deep_merge!(meta.dup)\n end", "title": "" }, { "docid": "1d5975bacd81691b1db76add78bf1948", "score": "0.59108955", "text": "def http_header(field=nil, value=nil)\n @_http_header ||= {}\n @_http_header[field] = value if field\n @_http_header\n end", "title": "" }, { "docid": "304e71f3b3524239c3f029d13a967b6d", "score": "0.59094507", "text": "def method_missing(sym, *args)\n if sym.to_s =~ /=$/\n self[sym.to_s[0..-2].to_sym] = args.first\n elsif @headers.has_key?(sym)\n self[sym]\n else\n super\n end\n end", "title": "" }, { "docid": "d9f70dc9b4972a67b3d409d9639bf367", "score": "0.5909127", "text": "def headers=(v)\n cfg_set(:headers, v)\n end", "title": "" }, { "docid": "8a334faea0bcf2099931fe6714988d4e", "score": "0.5896086", "text": "def set_metadata(metadatahash)\n headers = {}\n metadatahash.each{|key, value| headers['X-Object-Meta-' + key.to_s.capitalize] = value.to_s}\n response = self.container.connection.cfreq(\"POST\",@storagehost,@storagepath,headers)\n raise NoSuchObjectException, \"Object #{@name} does not exist\" if (response.code == \"404\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"202\")\n true\n end", "title": "" }, { "docid": "0610e5f2c5a4737f4d9607cbec2184b6", "score": "0.58942825", "text": "def header=(header)\n @header = header\n end", "title": "" }, { "docid": "9775720efa5b3b0b2946e5cf1b25356f", "score": "0.58936816", "text": "def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end", "title": "" }, { "docid": "d5dfda0359ba20907ad5ca31235cfcbf", "score": "0.58933026", "text": "def set_meta( title, *description )\n\t\t@title = title\n\t\t@description = description.first[0..200] unless description.first.blank?\n\tend", "title": "" }, { "docid": "7709a35660870e98537ba4e0a6c2c797", "score": "0.58925587", "text": "def set_headers(arg=nil,clear=false)\n clear_headers if clear\n if arg.nil?\n begin\n clear_headers\n WWMD::DEFAULT_HEADERS.each { |k,v| self.headers[k] = v }\n return \"headers set from default\"\n rescue => e\n putw \"WARN: \" + e\n return false\n end\n elsif arg.class == Symbol\n set_headers(WWMD::HEADERS[arg])\n putw \"headers set from #{arg}\"\n return true\n elsif arg.class == Hash\n arg.each { |k,v| self.headers[k] = v }\n putw \"headers set from hash\"\n return true\n end\n putw \"error setting headers\"\n return false\n end", "title": "" }, { "docid": "809c4b855c6d82cc298830e526c67a3f", "score": "0.58890945", "text": "def headers=(_arg0); end", "title": "" }, { "docid": "809c4b855c6d82cc298830e526c67a3f", "score": "0.58890945", "text": "def headers=(_arg0); end", "title": "" }, { "docid": "809c4b855c6d82cc298830e526c67a3f", "score": "0.58890945", "text": "def headers=(_arg0); end", "title": "" }, { "docid": "809c4b855c6d82cc298830e526c67a3f", "score": "0.58890945", "text": "def headers=(_arg0); end", "title": "" }, { "docid": "d705eb66071daad1352be7ddcc87e2f7", "score": "0.58843696", "text": "def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end", "title": "" }, { "docid": "d705eb66071daad1352be7ddcc87e2f7", "score": "0.58843696", "text": "def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end", "title": "" }, { "docid": "d88b3e28800ca43039b9045f2ed889bb", "score": "0.5879148", "text": "def header=(hdr)\n order_check(hdr)\n hdr.each {|s| raise \"Header must contain strings\" if ! s.kind_of? String }\n @header = hdr\n end", "title": "" }, { "docid": "8f2daeb1ca0252d3628b4207e3f91965", "score": "0.5878744", "text": "def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end", "title": "" }, { "docid": "e483a0dba206707d11eba8d8a70ddb3c", "score": "0.5871379", "text": "def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end", "title": "" }, { "docid": "d5053289e4384d2a635f6d3cf4b033ad", "score": "0.5863236", "text": "def headers=(hash)\n @headers.replace hash\n end", "title": "" }, { "docid": "21e6b51f41dc6796bea80d3b506796ed", "score": "0.5862475", "text": "def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end", "title": "" }, { "docid": "6141dac635bb209a7d68097764ab7628", "score": "0.58527285", "text": "def set_header_insert(opts)\n opts = check_params(opts,[:headers])\n super(opts)\n end", "title": "" } ]
5157deac13eff82d3f611eabf057e66e
Generates the Remember_Me token for the user.
[ { "docid": "b3462e0b0f517b462464b095e54ccdac", "score": "0.0", "text": "def remember_me!\n self.remember_token = encrypt(\"#{salt}--#{id}--#{Time.now.utc}\")\n save_without_validation\n end", "title": "" } ]
[ { "docid": "2aa3895fc375fe2f42d0e7ff17175278", "score": "0.78993034", "text": "def generate_remember_token\n self[:remember_token] = User.new_token\n end", "title": "" }, { "docid": "cdc482c24c1afb7adf565a1a65ccccd0", "score": "0.72598", "text": "def remember_me\n self.remember_token = self.class.generate_hash\n self.remember_token_expires_at = 2.weeks.from_now.utc\n end", "title": "" }, { "docid": "57329ba6da8930cd04c59cd11a5ff1bb", "score": "0.72316504", "text": "def create_remember_token\n remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "57329ba6da8930cd04c59cd11a5ff1bb", "score": "0.72316504", "text": "def create_remember_token\n remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "57329ba6da8930cd04c59cd11a5ff1bb", "score": "0.72316504", "text": "def create_remember_token\n remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "57329ba6da8930cd04c59cd11a5ff1bb", "score": "0.72316504", "text": "def create_remember_token\n remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "02bdf9e0a965adc7b5313bc0c41fc377", "score": "0.7208771", "text": "def remember_me\n self.remember_token_expires_at = 52.weeks.from_now\n self.remember_token = rand_key(self.username)\n self.save(false)\n end", "title": "" }, { "docid": "cab71a00e2eb9d60457f50d5609241c3", "score": "0.7207043", "text": "def remember_me\n self.remember_token_expires_at = Time.now+(60*60*24*14) #2.weeks.from_now.utc\n self.remember_token = \"#{email}--#{remember_token_expires_at}\"\n save! && remember_token \n end", "title": "" }, { "docid": "5225672ddf78feb67f3611dfde504e31", "score": "0.7159962", "text": "def create_remember_token\n self.remember_token = User.digest(User.new_remember_token)\n end", "title": "" }, { "docid": "5225672ddf78feb67f3611dfde504e31", "score": "0.7159962", "text": "def create_remember_token\n self.remember_token = User.digest(User.new_remember_token)\n end", "title": "" }, { "docid": "5225672ddf78feb67f3611dfde504e31", "score": "0.7159962", "text": "def create_remember_token\n self.remember_token = User.digest(User.new_remember_token)\n end", "title": "" }, { "docid": "a2baa92a68142fb0cb3472957c4c16eb", "score": "0.7127793", "text": "def create_remember_token\n # Generate the hash for a new token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "7185497ed077b5c4c609078157174be3", "score": "0.71071786", "text": "def create_remember_token\n\t\tremember_token = User.hash(User.new_remember_token)\n\tend", "title": "" }, { "docid": "7185497ed077b5c4c609078157174be3", "score": "0.71071786", "text": "def create_remember_token\n\t\tremember_token = User.hash(User.new_remember_token)\n\tend", "title": "" }, { "docid": "7185497ed077b5c4c609078157174be3", "score": "0.71071786", "text": "def create_remember_token\n\t\tremember_token = User.hash(User.new_remember_token)\n\tend", "title": "" }, { "docid": "7185497ed077b5c4c609078157174be3", "score": "0.71071786", "text": "def create_remember_token\n\t\tremember_token = User.hash(User.new_remember_token)\n\tend", "title": "" }, { "docid": "ed7f37360b30ae3fc20426cd1e8ceca4", "score": "0.7091552", "text": "def create_remember_token\n self.remember_token = User.hash_token(User.new_remember_token)\n end", "title": "" }, { "docid": "e230d72926a9fd9be98ef2b41684df80", "score": "0.70800024", "text": "def create_remember_token\n self.remember_token = User.digest(User.new_remember_token)\n end", "title": "" }, { "docid": "54cfb5a602f69d37904506e0ede1e544", "score": "0.70794386", "text": "def remember_me\n self.remember_token_expires_at = Time.now.utc + (1 * 365 * 24 * 60 * 60)\n self.remember_token ||= \"#{uuid}-#{uuid}\"\n save\n end", "title": "" }, { "docid": "2248f1cc1fb9532c2b90ce7b308860df", "score": "0.70729077", "text": "def remember_token\n remember_token = User.new_token\n update_attribute(:remember, User.digest(remember_token))\n return remember_token\n end", "title": "" }, { "docid": "cf15edd9faf3ffa810408b39959fc518", "score": "0.7067772", "text": "def remember_me\n self.remember_token_expires_at = (Time.now+(2*3600*24*14)).utc.to_s\n self.remember_token = encrypt(\"#{self.login}--#{self.remember_token_expires_at}\",self.salt)\n end", "title": "" }, { "docid": "ea3317438d5fd1e653900a4a95209188", "score": "0.7065879", "text": "def create_remember_token\n\n # Create the token.\n self.remember_token = SecureRandom.urlsafe_base64\n\n end", "title": "" }, { "docid": "c46460c165065cafdad7e7bc45ca4e71", "score": "0.7051555", "text": "def remember_token\n loop do\n token = generate_token\n break token unless Oath.config.user_class.find_by(remember_token: token)\n end\n end", "title": "" }, { "docid": "87af5b0a30754e25d4207020fbbfc851", "score": "0.70346045", "text": "def create_remember_token\n\t \tself.remember_token = User.digest(User.new_remember_token)\n\t end", "title": "" }, { "docid": "e0356c2dad6363443e5a77acb3b73289", "score": "0.70228016", "text": "def create_remember_token\n # The use of self here refers to the instance of User\n self.remember_token = User.digest(User.new_remember_token)\n end", "title": "" }, { "docid": "e15900d0c2f680e2262c29fc4fbb364f", "score": "0.70132834", "text": "def create_remember_token\n \t\tself.remember_token = User.digest(User.new_remember_token)\n \tend", "title": "" }, { "docid": "ab6e6d598c7e17e97a52d9548c57e36f", "score": "0.70063126", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_token)\n end", "title": "" }, { "docid": "2926cf35ef91d9b6bace6391e707f6cb", "score": "0.7003977", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now\n self.remember_token = encrypt(\"#{username}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "1bc115a292d6f24cdf65bf3c7b1b78b0", "score": "0.6992027", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "1bc115a292d6f24cdf65bf3c7b1b78b0", "score": "0.6992027", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "965aaf6692bab486a26d19dc67cb4c1a", "score": "0.69917566", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "965aaf6692bab486a26d19dc67cb4c1a", "score": "0.69917566", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "965aaf6692bab486a26d19dc67cb4c1a", "score": "0.69917566", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "965aaf6692bab486a26d19dc67cb4c1a", "score": "0.69917566", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" }, { "docid": "4074a7ed968fb392b2fb375523ada5ea", "score": "0.6987765", "text": "def generate_reset_token_merchant_user\n begin\n self.reset_password_token ||= SecureRandom.urlsafe_base64\n end while User.exists?(reset_password_token: self.reset_password_token)\n self.remember_me_token_expires_at = Time.zone.now + 30.days\n self.reset_password_email_sent_at = Time.zone.now\n end", "title": "" }, { "docid": "61dde70c99be10efeb3d7b588b1f2868", "score": "0.6974055", "text": "def create_remember_token\n unless self.remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end\n end", "title": "" }, { "docid": "7f1a09a71465c7d8233b64bab1bef913", "score": "0.6969086", "text": "def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\r\n save(false)\r\n end", "title": "" }, { "docid": "7f1a09a71465c7d8233b64bab1bef913", "score": "0.6969086", "text": "def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\r\n save(false)\r\n end", "title": "" }, { "docid": "7a997f92f8c13a15ab44f97ea3f1f7e6", "score": "0.6963992", "text": "def create_remember_token\n self.remember_token = SecureRandom.hex\n end", "title": "" }, { "docid": "9963aa3bc3c0991259a1d4e3e25d8e9d", "score": "0.6961146", "text": "def create_remember_token\n\t\t \t\tself.remember_digest = User.encrypt(User.new_token)\n\t\t end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960523", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960523", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960523", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960523", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960523", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "005e22a4051bdeacbfebbf1935cd345c", "score": "0.6960179", "text": "def create_remember_token\n self.remember_token = User.hash(User.new_remember_token)\n end", "title": "" }, { "docid": "ab7c5c68bb37523d3cb87f354b261daa", "score": "0.6958497", "text": "def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\r\n save_without_validation\r\n end", "title": "" }, { "docid": "e59f5e362ab0812d7184ca8fbe680715", "score": "0.695793", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = random_digest\n save(false)\n end", "title": "" }, { "docid": "e75f82f93908137ad48b34d69ba5f564", "score": "0.69569755", "text": "def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email_address}--#{remember_token_expires_at}\")\r\n save(false)\r\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "4527c4ddab2cb935d4d3f03e2e63acaf", "score": "0.69527996", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "3b9abc56169f73635e5a0ea0c8dfec5c", "score": "0.6952039", "text": "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" }, { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.69517905", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" } ]
8e125af3ef901032daff66ca7a898df3
there is definitely repeated work to be done here. noteably that if a subsequence is already increasing or decreasing you only need to know the next value and the last value to determine if that's still true.
[ { "docid": "1cff4200fece9d0f890266f1758e6e16", "score": "0.0", "text": "def quicksort(array)\n return array if array.length <= 1\n\n pivot = array.first\n left = array.drop(1).select { |el| el <= pivot }\n right = array.drop(1).select { |el| el > pivot }\n quicksort(left) + [pivot] + quicksort(right)\nend", "title": "" } ]
[ { "docid": "1abbda63fdf8cde0799594f8dc2f2f07", "score": "0.73293227", "text": "def almostIncreasingSequence(sequence)\n counter = 0\n biggest_value = -10 ** 5 # valeur la plus basse de l'exo\n second_biggest_value = biggest_value\n\n sequence.each do |seq|\n if seq > biggest_value # si le nb est plus grand que le précédent - increasing\n second_biggest_value = biggest_value # on assigne la second_biggest_value à la précédente biggest_value\n biggest_value = seq # on assigne la biggest_value au nb actuel\n\n elsif seq > second_biggest_value # si le nb n'est pas plus grand que le précédent mais est plus grand que le 2è précédent\n biggest_value = seq\n counter += 1\n\n else\n counter += 1\n\n end\n end\n counter <= 1 ? true : false\n\nend", "title": "" }, { "docid": "e80ec4418ca2ab47c8dba6ce3f427bcf", "score": "0.72753865", "text": "def validSubsequence(arr,subsequence)\n subseq_pointer = 0\n arr_pointer = 0\n while subseq_pointer < subsequence.size && arr_pointer < arr.size \n subseq_pointer+=1 if subsequence[subseq_pointer] == arr[arr_pointer]\n arr_pointer+=1\n end\n subseq_pointer == subsequence.length\nend", "title": "" }, { "docid": "19090fba591ca115231ff92ec6efe3be", "score": "0.7170592", "text": "def validSubsequence(arr,subsequence)\n subseq_pointer = 0\n for val in arr\n break if subseq_pointer == subsequence.size\n subseq_pointer +=1 if val == subsequence[subseq_pointer]\n end\n subseq_pointer == subsequence.size\nend", "title": "" }, { "docid": "54e38702dcc9aadaf92e6e97031b5eb4", "score": "0.71385866", "text": "def validate_subsequence(array, subsequence)\n array_index = 0\n sub_index = 0\n while array_index < array.length && sub_index < subsequence.length\n if subsequence[sub_index] == array[array_index]\n sub_index += 1\n end\n array_index += 1\n end\n sub_index == subsequence.length\nend", "title": "" }, { "docid": "dba49a009b9f9077526a8fa08d74e064", "score": "0.71232945", "text": "def almostIncreasingSequence(sequence)\r\n index = 0 ;\r\n while index < sequence.length \r\n new_arr = sequence.dup\r\n new_arr.delete_at(index)\r\n if (sorted(new_arr))\r\n return true\r\n end\r\n index += 1;\r\n end\r\n return false;\r\nend", "title": "" }, { "docid": "eb6cb76c12575356eb3ff26c58e74e9e", "score": "0.7056255", "text": "def almostIncreasingSequence(sequence)\n count = 0\n \n if (sequence.count - sequence.uniq.count) > 1\n return false\n end\n \n for i in 1..(sequence.count - 2)\n if sequence[i-1] > sequence[i]\n count += 1\n end\n end\n \n if count == 0\n return true\n end\n \n count_1 = 0\n \n for i in 2..(sequence.count - 1)\n count_2 = 0\n if sequence[i-1] > sequence[i]\n count_2 += 1\n end\n \n if sequence[i-2] > sequence[i]\n count_2 += 1\n end\n \n if (count_2 > 1)\n return false\n end\n end\n \n for i in 1..(sequence.count - 1)\n if sequence[i-1] > sequence[i]\n count_1 += 1\n end\n end\n \n if count_1 > 1\n false\n else\n true\n end\nend", "title": "" }, { "docid": "b4cd3856273aa8472f8fe1f0be5f18a1", "score": "0.7007944", "text": "def find_longest_increasing_subsequence(array)\n increasing_subsequence_length = [1]\n increasing_subsequence_length.fill(1, 0, array.size - 2)\n\n all_increasing_sequences = [[array[0]]]\n \n (1..array.size-1).each do |index|\n \n new_sequence_needed = true\n all_increasing_sequences.each do |increasing_sequence|\n if increasing_sequence[-1] <= array[index]\n new_sequence_needed = false\n increasing_sequence.push(array[index])\n #check if we need to updated the longest increasing sequence length conut\n\n if increasing_subsequence_length[index-1] <= increasing_sequence.size\n increasing_subsequence_length[index] = increasing_sequence.size\n else\n increasing_subsequence_length[index] = increasing_subsequence_length[index-1]\n end\n \n break #once insert, quick the loop\n end\n end\n \n #this element is smaller than all increasing sequence's largest number, a new \n #increasing sequence is needed to track\n if new_sequence_needed\n all_increasing_sequences.push([array[index]])\n #it can't be larger thatn existing increasing sequence\n increasing_subsequence_length[index] = increasing_subsequence_length[index-1]\n end\n \n \n end #end of scnaning all the elm in array\n \n longest_increasing_sequence = nil\n all_increasing_sequences.each do |i_sequence|\n p i_sequence\n if i_sequence.size == increasing_subsequence_length[-1]\n longest_increasing_sequence = i_sequence\n end\n end\n\n return longest_increasing_sequence\nend", "title": "" }, { "docid": "987a849e4f661880b3762913a12897d5", "score": "0.6894026", "text": "def nondecreasing(array)\n subsequences = 0\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n nondecreasing = true\n p array[i..j]\n array[i..j].each_index do |k|\n if array[i + k + 1] && array[i + k] > array[i + k + 1]\n nondecreasing = false\n break\n end\n end\n if nondecreasing\n subsequences += 1\n end\n end\n end\n subsequences\nend", "title": "" }, { "docid": "ea8e2462ea69801519abaaac0899c5d4", "score": "0.6868572", "text": "def is_subsequence_of?(seq, other_seq)\n\ti = 0\t\n\tseq.each do |x|\n\t\twhile other_seq[i] != x\n\t\t\ti += 1\n\t\t\treturn false if (i >= other_seq.length)\n\t\tend\n\tend\n\t\n\treturn true\nend", "title": "" }, { "docid": "217cab3d95b213504fa3d586605b9d08", "score": "0.68298316", "text": "def subsequence?(seq1, seq2); end", "title": "" }, { "docid": "93ff631dce4180978e481a71f130d24e", "score": "0.68212783", "text": "def increasing_sequence?(seq)\n\tseq.inject {|mem, x| return false if mem >= x; x}\n\ttrue\nend", "title": "" }, { "docid": "989867bc6d92232ea34de64e9761d2df", "score": "0.66851526", "text": "def is_increasing?(last)\n list.(size-1).times do |i|\n if list[i] >= list[i+1]\n return false\n end\n return true\n end\nend", "title": "" }, { "docid": "e2d56e14716253304d621f95643a1da5", "score": "0.6680281", "text": "def is_subsequence?(s1, s2)\n j = 0\n (0...s2.length).each do |i|\n j += 1 if s2[i] == s1[j]\n end\n return j==s1.length\nend", "title": "" }, { "docid": "3b765523c03a168eeb2395d321caeeac", "score": "0.6626095", "text": "def longest_subsequence(arr)\n ongoing_subsequence = [1]\n (1...arr.length).each do |i|\n (0...ongoing_subsequence.length).each do |j|\n if arr[i] > arr[j]\n next_subsequence = ongoing_subsequence[j] + 1\n if ongoing_subsequence[i].nil? || next_subsequence > ongoing_subsequence[i]\n ongoing_subsequence[i] = next_subsequence\n end\n end\n\n ongoing_subsequence[i] = 1 if ongoing_subsequence[i].nil?\n end\n end\n\n ongoing_subsequence[-1]\nend", "title": "" }, { "docid": "e7f2345c914849dbf0fd6204f9da596b", "score": "0.6496926", "text": "def contiguous_sequence(arr)\n return arr[0] if arr.length == 1\n max_sum = arr.first\n current_sum = arr.first\n i = 1\n while i < arr.length - 1\n new_sum = current_sum + arr[i]\n if new_sum < 0 && new_sum < max_sum\n puts\n current_sum = arr[i]\n i +=1\n else\n current_sum = current_sum + arr[i]\n max_sum = max_sum < current_sum ? current_sum : max_sum\n i += 1\n end\n end\n puts max_sum\nend", "title": "" }, { "docid": "7883b8b48153daa807dca359d34c33d2", "score": "0.6477069", "text": "def no_consecutive_repeats?(arr)\n return true if arr.length ==1\n \n(0...arr.length-1).all?{|i| arr[i]!=arr[i+1] }\nend", "title": "" }, { "docid": "2df18ed1dff5028a351ff23931e55c8f", "score": "0.64690804", "text": "def changing_sequence(arr)\n if arr.first < arr[1]\n arr.each_with_index do |num, idx|\n break if idx >= arr.size - 1\n return idx if num > arr[idx + 1]\n end\n end\n if arr.first > arr[1]\n arr.each_with_index do |num, idx|\n break if idx >= arr.size - 1\n return idx if num < arr[idx + 1]\n end\n end\n -1\nend", "title": "" }, { "docid": "b26e28ee4677c988b2ad08bfa106012a", "score": "0.6460882", "text": "def no_consecutive_repeats?(arr)\n if arr.length == 1\n return true\n end\n (0...arr.length - 1).each do |idx|\n if arr[idx] == arr[idx + 1]\n return false\n \n end\nend\n return true\nend", "title": "" }, { "docid": "fa9b1dae1cf65ffe385f483249fd0ab5", "score": "0.6448766", "text": "def longest_increasing_subsequence(sequence)\n len = sequence.length\n\n # construct a temp array to store lenght of LIS at each index(default len: 1)\n temp = [1] * len # or Array.new(len, 1)\n\n # Compute optimized LIS values in a bottom up manner\n for i in (1..(len - 1))\n for j in (0..(i - 1))\n if sequence[i] > sequence[j] && temp[i] < temp[j] + 1\n temp[i] = temp[j] + 1\n end\n end\n end\n\n return temp.max\nend", "title": "" }, { "docid": "4cb0778050b7570c73decf107a59cae0", "score": "0.6448049", "text": "def graphSequence(sequence)\n sequence.sort! {|x,y| y <=> x }\n return true if sequence[0] <= 0\n 1.upto(sequence[0]) do |i|\n sequence[i] = sequence[i] - 1\n end\n sequence.delete_at(0)\n sequence.each do |e|\n return false if e < 0\n end\n graphSequence(sequence)\nend", "title": "" }, { "docid": "21dc733825800b5b5625574e1be2930c", "score": "0.6446908", "text": "def longestSequence (numbers)\n #If numbers.length > 0 then there is a subsequence of at least length 1.\n #This is important because my algorithm looks at the next element\n longest = tempLength = 1;\n longestFirst = tempFirst = 0;\n longestLast = tempLast = 0;\n \n while tempLast < numbers.length - 1 do\n tempLength = tempLength + 1;\n\n #If sequence elements can differ by more than 1 (e.g. [3,6,8] is a valid subsequence)\n #if numbers[tempLast] + 1 < numbers[tempLast + 1]\n\n #If the two elements are out of order restart the current sequence.\n if numbers[tempLast] + 1 != numbers[tempLast + 1]\n tempFirst = tempLast + 1;\n tempLength = 1;\n end\n\n tempLast += 1;\n if tempLength > longest\n longestFirst = tempFirst;\n longestLast = tempLast;\n longest = tempLength;\n end\n end\n\n #If the longest found subsequence is two or larger, slice it out of the array and return it.\n if longest > 1\n return numbers.slice(longestFirst, longestLast - longestFirst + 1);\n else #Else return an empty array.\n return [];\n end\nend", "title": "" }, { "docid": "a81370b6e866646cd7550dbc2e6123e7", "score": "0.64465", "text": "def is_increasing(list)\n a = list[0]\n (list.size-1).times do |n|\n if list[n] >= list[n+1]\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "96d1f96ca40ba5649de1006db3703616", "score": "0.6437486", "text": "def super_increasing(arr)\n arr.each_with_index do |num, idx|\n next if idx == 0\n return false unless num > arr[0..idx - 1].reduce(:+)\n end\n true\nend", "title": "" }, { "docid": "aec43a41a2885404aa373ec1a4715231", "score": "0.64136314", "text": "def check_sequence_for_winner(sequence)\n nconseq = 0\n if (! sequence.kind_of?(Array)) or sequence.length < 4\n return false\n end\n @logger.debug \"Checking sequence: \" + sequence.inspect\n last_val = sequence.shift # leftmost pop\n if last_val != @empty\n nconseq = 1\n end\n sequence.each { |val|\n if val == @empty\n return check_sequence_for_winner(sequence)\n end\n if val == last_val\n nconseq = nconseq + 1\n if nconseq == 4\n return val\n end\n else\n return check_sequence_for_winner(sequence)\n end\n }\n return false\n end", "title": "" }, { "docid": "b563babf0b245f86e144c851d081594c", "score": "0.64097154", "text": "def elide_repeated_subsequences &compare_block\n compare_block ||= lambda{|a,b| a == b}\n i = 0\n while i < size # Need to re-evaluate size on each loop - the array shrinks.\n j = i\n #puts \"Looking for repetitions of #{self[i]}@[#{i}]\"\n while tail = self[j+1..-1] and k = tail.index {|e| compare_block.call(e, self[i]) }\n length = j+1+k-i\n #puts \"Found at #{j+1+k} (subsequence of length #{j+1+k-i}), will need to repeat to #{j+k+length}\"\n if j+k+1+length <= size && compare_block[self[i, length], self[j+k+1, length]]\n #puts \"Subsequence from #{i}..#{j+k} repeats immediately at #{j+k+1}..#{j+k+length}\"\n slice!(j+k+1, length)\n j = i\n else\n j += k+1\n end\n end\n i += 1\n end\n self\n end", "title": "" }, { "docid": "b0a9261e750416b1f71d5a40edd688f1", "score": "0.6394971", "text": "def no_consecutive_repeats?(arr)\n arr.each_index {|i| return false if arr[i] == arr[i+1]}\n true\nend", "title": "" }, { "docid": "bd2b4f545ce0964d53c8c57ed231d863", "score": "0.63818556", "text": "def no_consecutive_repeats?(arr)\n arr.each_index do |i|\n return false if arr[i] == arr[i+1]\n end \n true \nend", "title": "" }, { "docid": "b7b32cadc1275c93daee6dc5cbf4c3c7", "score": "0.63798434", "text": "def no_consecutive_repeats?(arr)\n\n (0...arr.length - 1).each do |idx|\n\n return false if arr[idx] == arr[idx+1]\n\n end\n\n return true\n\nend", "title": "" }, { "docid": "ce0629d295f9795bab192e866f459f46", "score": "0.63714087", "text": "def find_sequence(array, target)\n cur = [array[0]]\n\n for i in 1..array.length-1\n if cur.inject(:+) == target\n pp cur\n return true\n end\n\n cur << array[i]\n\n while cur.inject(:+) > target\n cur = cur[1..-1]\n end\n end\nend", "title": "" }, { "docid": "403b67b4ab1aea2171a95a5fa9b76d03", "score": "0.63648707", "text": "def consecutive_collapse(nums)\r\n if nums.length == 1\r\n return nums\r\n end\r\n new_nums = []\r\n sequence = 0\r\n nums.each_index do |i|\r\n #debugger\r\n if !nums[i + 1].nil? && (nums[i] - nums[i + 1] == 1 || nums[i] - nums[i + 1] == -1) && sequence == 0\r\n sequence += 1\r\n else\r\n if sequence == 1\r\n sequence += 1\r\n next\r\n end\r\n new_nums << nums[i]\r\n end\r\n end\r\n return consecutive_collapse(new_nums) if new_nums != nums\r\n nums\r\nend", "title": "" }, { "docid": "48747b81e94aae3e4ce87bc1f830379d", "score": "0.6363556", "text": "def ChangingSequence(arr)\n arr.each_with_index do |num, i|\n next if i == 0\n break if i == arr.length - 1\n return i if num > arr[i - 1] && num > arr[i + 1]\n return i if num < arr[i - 1] && num < arr[i + 1]\n end\n -1\nend", "title": "" }, { "docid": "3b3a340873737e935fe554160406f8dc", "score": "0.63535124", "text": "def no_consecutive_repeats?(arr)\n return true if arr.length == 1\n\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n\n true\nend", "title": "" }, { "docid": "f5d5bc81dfc2dc27519a0f1420a106c2", "score": "0.6345087", "text": "def no_consecutive_repeats?(array)\n (0...array.length-1).each {|index| return false if array[index] === array[index+1]}\n true\nend", "title": "" }, { "docid": "42e4a10b5bbe67610fa48bab593cfd56", "score": "0.63328356", "text": "def find_sequence_in_array( sequence, array )\n\n# We don't search for big arrays in small arrays. ^^\n\n if (sequence.length > array.length) then\n return false, nil, nil \n end \n\n# First check at this end. (Beginning)\n \n matching = true\n sequence.each_with_index do |element, i|\n if element != array[i] then\n matching = false\n break\n end\n end\n \n if matching then\n if sequence.length == array.length then\n return true, 'beginning', nil\n else\n return true, 'beginning', array[sequence.length..array.length - 1]\n end\n end\n \n# And, if sequence and array are not of the same length…\n \n if not sequence.length == array.length then\n \n # We check at this other end. (End)\n \n matching = true\n sequence.reverse.each_with_index do |element, i|\n if element != array[array.length - 1 - i] then\n matching = false\n break\n end\n end\n \n end\n \n if matching then\n if sequence.length == array.length then\n return true, 'end', nil\n else\n return true, 'end', array[0..array.length - 1 - sequence.length]\n end\n end\n \n return false, nil, nil\n \nend", "title": "" }, { "docid": "145b0c2a20db515a163ed5bf771cc90c", "score": "0.63295877", "text": "def no_consecutive_repeats?(arr)\r\n (0..arr.length - 1).each do |i| \r\n if arr[i] == arr[i + 1]\r\n return false\r\n end\r\n end\r\n return true\r\n\r\nend", "title": "" }, { "docid": "eb15fbc0cb6b70beb579258d705cebbf", "score": "0.63292754", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |idx|\n return false if arr[idx] == arr[idx+1]\n end\n true\nend", "title": "" }, { "docid": "b6e585e65379823c8b52fc8dc71adb43", "score": "0.6320409", "text": "def no_consecutive_repeats?(array)\n array[0...-1].each_with_index do |ele, index|\n return false if ele == array[index + 1]\n end\n return true\nend", "title": "" }, { "docid": "c4104ff5ed539cddd3e3b34c91b7a9bf", "score": "0.6319227", "text": "def no_consecutive_repeats?(arr)\n arr[0...-1].each_with_index { |ele, idx| return false if ele == arr[idx+1] }\n true\nend", "title": "" }, { "docid": "e4bf18cc91e2741a66ff95607605cbcc", "score": "0.6316152", "text": "def jolly? seq\n n = seq.size - 1\n seen = Array.new(n, false)\n for d in (1..n) do\n diff = (seq[d] - seq[d - 1]).abs\n return false if diff < 1 || diff > n || seen[diff]\n seen[diff] = true\n end\n true\nend", "title": "" }, { "docid": "85a801b4a6a8684725834ed937f729ee", "score": "0.63160515", "text": "def no_consecutive_repeats?(arr)\n (0..arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "0f2619f5aa284c4829f7e9ba100ad1d6", "score": "0.6306543", "text": "def longest_subsequence(sequence)\n p sequence\n sequence.map!{|num| [num, [num]]}\n sequence.each_with_index do |value, curr_index|\n num, sub = value\n prev_subs = []\n curr_index.downto(0) do |k|\n if sequence[k][0] < num\n prev_subs << sequence[k][1]\n end\n end\n sequence[curr_index][1] = Array(prev_subs.max_by{|el| el.size}) + sequence[curr_index][1]\n end\n p sequence.max_by{|el| el[1].size}\nend", "title": "" }, { "docid": "08a50c96cfcc69b870ae622265697438", "score": "0.63022095", "text": "def no_consecutive_repeats?(arr)\r\n (0...arr.length - 1).each {|i| return false if arr[i] == arr[i + 1]}\r\n return true\r\nend", "title": "" }, { "docid": "6678e7b32416e607610185390b64fe17", "score": "0.63017994", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |idx|\n return false if arr[idx] == arr[idx + 1]\n end\n true\nend", "title": "" }, { "docid": "394971a6074cbf5e82780edf34f20c18", "score": "0.63011664", "text": "def no_consecutive_repeats?(arr)\n consecutive = true\n arr.each_with_index do |ele, index|\n consecutive = false if arr[index] == arr[index + 1]\n end\n consecutive\nend", "title": "" }, { "docid": "2e352e05f0dadad5fd11dcf628bd7bbb", "score": "0.6296359", "text": "def no_consecutive_repeats?(arr)\n arr.each_index { |i| return false if arr[i] == arr[i + 1] }\n true\nend", "title": "" }, { "docid": "7bd845e57cbbbd2db7cc6ce9708825a5", "score": "0.62907267", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "7bd845e57cbbbd2db7cc6ce9708825a5", "score": "0.62907267", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "7bd845e57cbbbd2db7cc6ce9708825a5", "score": "0.62907267", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "8d03e0618b5850e46274d02e1eaf1a55", "score": "0.6290037", "text": "def Superincreasing2(arr)\n total = 0 \n return arr.all? { |elem| elem > total and total += elem }\nend", "title": "" }, { "docid": "c7c151d2b4c96db80844ff20a1d4bf07", "score": "0.6287649", "text": "def no_consecutive_repeats?(arr)\n if arr.length == 1\n return true\n end\n\n arr.each_index do |i|\n if arr[i] == arr[i + 1]\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "7cb6ff5dabb23b488ad557f7db62caad", "score": "0.6284059", "text": "def no_consecutive_repeats?(arr)\n\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "79fd19447ea9964a092ed5f5706fda5a", "score": "0.6283124", "text": "def check_range(last_value, values)\n answer = true\n values.each do |value|\n if last_value.nil?\n last_value = value\n next\n end\n if last_value + 1 == value\n last_value = value\n else\n answer = false\n break\n end\n end\n answer\n end", "title": "" }, { "docid": "28da45260f4152fa15c9b408bf00e51e", "score": "0.6273101", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n if arr[i] == arr[i + 1]\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "c3b8667db0bf5919d468b52e0cee9251", "score": "0.62725335", "text": "def no_consecutive_repeats?(arr)\n iterator = 0\n while iterator < arr.length-1\n return false if arr[iterator] == arr[iterator+1]\n iterator += 1\n end\n true\nend", "title": "" }, { "docid": "16ca7b210ae6a82710f3bec2535fe782", "score": "0.6268945", "text": "def no_consecutive_repeats?(arr)\n arr.each_with_index do |el, i|\n if arr[i] == arr[i+1]\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "9fcc1a058a5d226697d39f802f2cf6e0", "score": "0.62670124", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i + 1]\n end\n true\nend", "title": "" }, { "docid": "705925a62d1b1460fdb76d6098917f9f", "score": "0.62636214", "text": "def increasing?(arr)\n (arr.length - 1).times { |idx| return false unless arr[idx] < arr[idx + 1] }\n true\nend", "title": "" }, { "docid": "f5ff15b01b4f242df1fab47c7cc046d1", "score": "0.6262417", "text": "def check_sequence(base_array, add_array)\n max_length = check_base_array(base_array, add_array, max_length)\n\n if add_array[0] # or: add_array.length > 0 ??\n max_length = recursive_insert_num(base_array, 0, add_array, 0, max_length)\n end\n\n return max_length\nend", "title": "" }, { "docid": "5b78060592426ee61dd5e7ed54129620", "score": "0.6259403", "text": "def no_consecutive_repeats?(array)\n\n (0...array.length-1).each do |idx|\n if array[idx] == array[idx + 1]\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "4903b6fe6bb6d1058669866a9aa46a4b", "score": "0.62566125", "text": "def consecutive_collapse(arr)\n # debugger\n while consecutive?(arr)\n (0...arr.length-1).each do |idx|\n if (arr[idx] == arr[idx+1] - 1 || arr[idx] == arr[idx+1] +1)\n arr = arr.slice(0...idx) + arr.slice(idx+2...arr.length)\n break\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "b89e850b719b19e360e1edfc0799da3d", "score": "0.62491494", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "fa5c4b628ca12660d37c86edf2da2cc7", "score": "0.6247939", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "fa5c4b628ca12660d37c86edf2da2cc7", "score": "0.6247939", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "title": "" }, { "docid": "a71e124685ef87a8cc6970530ca466b5", "score": "0.624609", "text": "def no_consecutive_repeats?(arr)\n (0...(arr.length - 1)).none? do |idx|\n arr[idx] == arr[idx + 1]\n end\nend", "title": "" }, { "docid": "9cc0754cabf73c093ec3e3bf1b24e1a8", "score": "0.62402105", "text": "def no_consecutive_repeats?(arr)\n arr.each_with_index do |el, i|\n return false if arr[i] == arr[i+1]\n end\n return true\nend", "title": "" }, { "docid": "5fe142cccd82d780280addc9f761314f", "score": "0.62393725", "text": "def find_largest_subsequence(array)\n sum = 0\n start_index = 0\n sub_num = 1\n total_elements = array.size\n return 0 if array.all? { |elem| elem < 0 } || array.empty?\n\n while start_index <= (total_elements - 1) do\n iteration_num = total_elements - start_index\n sub_num = 1\n while sub_num <= iteration_num do\n sub_sum = array[start_index, sub_num].sum\n sum = sub_sum if sub_sum > sum\n sub_num += 1\n end\n start_index += 1\n end\n sum\nend", "title": "" }, { "docid": "e9bf4d9240f1cf5fcc9ec4344b054456", "score": "0.6237086", "text": "def checkReverse( arr, size)\n\tstart = -1\n\tstop = -1\n\ti = 0\n\twhile (i < (size - 1))\n\t\tif (arr[i] > arr[i + 1])\n\t\t\tstart = i\n\t\t\tbreak\n\t\tend\n\t\ti += 1\n\tend\n\tif (start == -1)\n\t\treturn true\n\tend\n\ti = start\n\twhile (i < (size - 1))\n\t\tif (arr[i] < arr[i + 1])\n\t\t\tstop = i\n\t\t\tbreak\n\t\tend\n\t\ti += 1\n\tend\n\tif (stop == -1)\n\t\treturn true\n\tend\n\t# increasing property\n\t# after reversal the sub array should fit in the array.\n\tif (arr[start - 1] > arr[stop] || arr[stop + 1] < arr[start])\n\t\treturn false\n\tend\n\ti = stop + 1\n\twhile (i < size - 1)\n\t\tif (arr[i] > arr[i + 1])\n\t\t\treturn false\n\t\tend\n\t\ti += 1\n\tend\n\treturn true\nend", "title": "" }, { "docid": "128ac0741d2808b34e4054eb94374ab1", "score": "0.6225162", "text": "def can_jump_greedy(nums)\n last_pos = nums.size - 1\n (0..nums.size-1).reverse_each do |i|\n last_pos = i if i + nums[i] >= last_pos\n end\n last_pos == 0\nend", "title": "" }, { "docid": "bc9033780c9be3f95354e7318fe2355d", "score": "0.6223697", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i + 1]\n end\n true\nend", "title": "" }, { "docid": "aba262fda050c7a40e38ecc364d2139b", "score": "0.6218018", "text": "def no_consecutive_repeats?(arr)\n return true if arr.length == 1\n \n (0...arr.length).each do |idx|\n if arr[idx] == arr[idx+1]\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "528bad57e86b2e62862777e8ef882239", "score": "0.6215904", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n return true\nend", "title": "" }, { "docid": "7245d44a1c4bf44fcbda4d229de5825f", "score": "0.6215405", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n if arr[i] == arr[i+1]\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "04328c0aa08b6393a588c90b5aad9bd7", "score": "0.62078434", "text": "def solution(a)\n found = Array.new(a.length, false)\n\n a.each do |value|\n next if value <= 0\n next if value > a.length\n\n found[value-1] = true\n end\n\n found.each.with_index do |continue, index|\n return index+1 unless continue \n end\n\n return a.length+1\nend", "title": "" }, { "docid": "7a8b0bebd7f31ebfaf9dfc775d04785d", "score": "0.61988544", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length).all? { |i| arr[i] != arr[i+1] } \n\nend", "title": "" }, { "docid": "be8ef22ace4b0b49c1462448918e3d9f", "score": "0.61900103", "text": "def nextPermutation (number)\n\t# Find non-increasing suffix\n\ti = number.size - 1\n\t\n\twhile (i > 0 && number[i - 1].to_i >= number[i].to_i)\n\t\ti -= 1\n\tend\n\t\t\n\tif (i <= 0)\n\t\treturn false\n\tend\n\t\n\t# Find successor to pivot\n\tj = number.size - 1\n\t\n\twhile (number[j].to_i <= number[i - 1].to_i)\n\t\tj -= 1\n\tend\n\t\n\ttemp = number[i - 1]\n\tnumber[i - 1] = number[j]\n\tnumber[j] = temp\n\n\t# Reverse suffix\n\tj = number.size - 1\n\t\n\twhile (i < j) \n\t\ttemp = number[i]\n\t\tnumber[i] = number[j]\n\t\tnumber[j] = temp\n\t\ti += 1\n\t\tj -= 1\n\tend\n\t\n\treturn true\nend", "title": "" }, { "docid": "be8ef22ace4b0b49c1462448918e3d9f", "score": "0.61900103", "text": "def nextPermutation (number)\n\t# Find non-increasing suffix\n\ti = number.size - 1\n\t\n\twhile (i > 0 && number[i - 1].to_i >= number[i].to_i)\n\t\ti -= 1\n\tend\n\t\t\n\tif (i <= 0)\n\t\treturn false\n\tend\n\t\n\t# Find successor to pivot\n\tj = number.size - 1\n\t\n\twhile (number[j].to_i <= number[i - 1].to_i)\n\t\tj -= 1\n\tend\n\t\n\ttemp = number[i - 1]\n\tnumber[i - 1] = number[j]\n\tnumber[j] = temp\n\n\t# Reverse suffix\n\tj = number.size - 1\n\t\n\twhile (i < j) \n\t\ttemp = number[i]\n\t\tnumber[i] = number[j]\n\t\tnumber[j] = temp\n\t\ti += 1\n\t\tj -= 1\n\tend\n\t\n\treturn true\nend", "title": "" }, { "docid": "a4b029a92dffe1dc30d80a8715197c33", "score": "0.61881196", "text": "def longestIncreasingSubsequence(sequence)\n depth = Array.new(sequence.length)\n (0..sequence.length-1).each { |i|\n num = sequence[i]\n maxDepth = 0\n if i>0\n (0..i-1).each { |j|\n maxDepth = depth[j] if sequence[j]<num && depth[j]>maxDepth\n }\n end\n depth[i] = maxDepth + 1\n }\n depth.max\nend", "title": "" }, { "docid": "fb5f1c00001c7b70274b48c4f1bd3f4f", "score": "0.6187581", "text": "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each { |i| return false if arr[i] == arr[i + 1] }\n\n return true\nend", "title": "" }, { "docid": "44928150db7ee1120f001de6e8736867", "score": "0.61866647", "text": "def longest_increasing_sequence(array, iter, n, prev)\n # exit condition\n return 0 if iter==n\n # exclude next seq \n excl = longest_increasing_sequence(array, iter+1, n, prev)\n # include seq\n incl = 0\n # seq is increasing \n if array[iter] > prev \n incl = 1 + longest_increasing_sequence(array, iter+1, n , array[iter]) \n end\n return [excl,incl].max\nend", "title": "" }, { "docid": "575aee463d27fd7370af8ee65abeb009", "score": "0.61672854", "text": "def no_consecutive_repeats?(array)\n array.each_with_index { |ele, index| return false if ele == array[index + 1] }\n true\nend", "title": "" }, { "docid": "acbebb5b33f0957604a4206455455999", "score": "0.61656946", "text": "def solution(array)\n array.sort!\n current = 1\n (0..array.size).step(1) do |n|\n return current unless array[n] == current\n\n current += 1\n end\nend", "title": "" }, { "docid": "9c5e42b25d7e80220566c425c89ee4a9", "score": "0.6163415", "text": "def no_consecutive_repeats?(arr)\n i = 0\n while i < arr.length - 1\n return false if arr[i] == arr[i + 1]\n i += 1\n end\n true\nend", "title": "" }, { "docid": "2c16f1f538adc72b11cac987d2a8f1a7", "score": "0.61550826", "text": "def consecutive? arr\n arr_dup = arr.dup\n laest_one = arr.last\n arr_dup.sort!\n while arr_dup.size > 2\n first_three = arr_dup.first(3)\n return true if first_three.include? laest_one && arr_dup[1] * 3 == first_three.inject(:+)\n arr_dup.shift\n end\n return false\n end", "title": "" }, { "docid": "0a3bd0ca81574dfad04ade1f799538b7", "score": "0.614992", "text": "def no_consecutive_repeats?(arr)\n new_arr = []\n check = true\n arr.each_with_index do |ele,ind|\n arr.each_with_index do |ele2,ind2|\n if ind > ind2 && ind - ind2 == 1\n check = false if ele == ele2\n end\n end\n end\n return check\nend", "title": "" }, { "docid": "b37ad0909850981026d1371805ba3241", "score": "0.6144079", "text": "def ChangingSequence(arr)\n if arr[0] < arr[1]\n arr.each_with_index{|n, i| return (i - 1) if n < arr[i - 1]}\n else\n arr.each_with_index{|n, i| return (i - 1) if n > arr[i - 1]}\n end\n -1\nend", "title": "" }, { "docid": "ef2a4452ca05b0cbd81f9ebc8e37b794", "score": "0.6140851", "text": "def no_consecutive_repeats?(array)\n (0...array.length - 1).each do |i|\n return false if array[i] == array[i + 1]\n end\n true\nend", "title": "" }, { "docid": "bbc16bc7159f940ce35309871077cb7d", "score": "0.6137548", "text": "def is_monotonic(a)\n monotonic = true\n prev_num = nil\n increasing = false\n decreasing = false\n \n a.each do |n|\n if prev_num.nil?\n prev_num = n\n elsif n > prev_num && !increasing && !decreasing\n increasing = true\n elsif n < prev_num && !increasing && !decreasing\n decreasing = true\n elsif (n > prev_num && decreasing) || (n < prev_num && increasing)\n return false\n end \n prev_num = n\n end\n true\nend", "title": "" }, { "docid": "389f6cc31410d47b3e0fbd7d588300ec", "score": "0.6135319", "text": "def succession?(array_vars)\n return array_vars.each_cons(2).all? {|co| co[1] == co[0].succ}\n end", "title": "" }, { "docid": "781b2578810a62e05378a1724a0b6e98", "score": "0.6134914", "text": "def no_consecutive_repeats?(arr)\n i = 0\n while i < arr.length \n if arr[i] == arr[i + 1]\n return false\n end\n i += 1\n end\n true\nend", "title": "" }, { "docid": "92073b9c972bee83125b2924bb3a22fe", "score": "0.6126796", "text": "def Superincreasing(arr)\n sum = 0\n arr.each do |num|\n \tif num <= sum\n \t\tfalse\n \tend\n \tputs sum += num\n end\n true\nend", "title": "" }, { "docid": "317697b872fbb84bd14ce6aaffee05a2", "score": "0.60948366", "text": "def is_monotonic(a)\n (1...a.length).each do |i|\n if a[i] > a[i - 1]\n ascending = true\n elsif a[i] < a[i - 1]\n descending = true\n end\n return false if ascending && descending\n end\n\n true\nend", "title": "" }, { "docid": "39558d6ced5793bab5e3c6ceb04fc6c5", "score": "0.6094316", "text": "def continuous_sequence(array)\n maxSum = 0\n sum = 0\n for i in 0..array.size - 1\n array[i] + sum > 0 ? sum += array[i] : sum = 0\n sum > maxSum ? maxSum = sum : nil\n end\n\n maxSum == 0 ? array.max : maxSum\nend", "title": "" }, { "docid": "5c4eadfaf9b14c655e5cf90811168501", "score": "0.609399", "text": "def consecutive_collapse(arr)\n collapsable = true\n\n while collapsable\n collapsable = false\n\n (0...arr.length - 1).each do |idx|\n # debugger\n if arr[idx] == (arr[idx + 1] + 1) || arr[idx] == (arr[idx + 1] - 1)\n arr.slice!(idx, 2)\n collapsable = true \n break\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "5fa31432c898a629d0fe43ee49b8c8d0", "score": "0.6088925", "text": "def solution(a)\n length = a.length\n i = 0\n a = a.sort\n smalest = 1\n while(i < length-1) do\n current_val = a[i]\n if current_val < 0\n i+=1\n next\n end\n next_val = a[i+1]\n if next_val - current_val > 1\n smalest = current_val + 1\n break\n elsif i == length-2\n smalest = next_val + 1\n break\n end\n i+= 1\n end\n smalest\nend", "title": "" }, { "docid": "c52aa3d0ed656e578b2afe9eae2c78ba", "score": "0.608441", "text": "def no_consecutive_repeats?(arr)\n array=[]\n return true if arr.length == 1\n arr.each_with_index do |ele1, i1|\n arr.each_with_index do |ele2, i2|\n if i2 == i1 + 1\n if arr[i1] == arr[i2]\n return false\n end\n end\n end\n end\n true\nend", "title": "" }, { "docid": "282abcab9a0ec00c35cb02dc128f3bf0", "score": "0.6082829", "text": "def consecutive_collapse(arr)\n new_arr = arr\n done = false\n \n while !done\n done = true\n (0...new_arr.length - 1).each do |i|\n if new_arr[i] + 1 == new_arr[i + 1] || new_arr[i + 1] + 1 == new_arr[i]\n new_arr = new_arr[0...i] + new_arr[i + 2..-1]\n done = false\n break\n end\n end\n end\n \n new_arr\nend", "title": "" }, { "docid": "252db74dc60149be4cf5d5dff9513b4e", "score": "0.6081476", "text": "def is_fibonacci?(num)\n sequence = [0, 1]\n while num > sequence.max\n x,y=sequence.pop(2)\n#sequence .pop(2) return and array of two values so I set x and y to be equal to those values respectively.\n sequence.push(x)\n sequence.push(y)\n sequence.push(x + y)\n end\n\n if num == sequence.max\n return true\n else\n return false\nend\nend", "title": "" }, { "docid": "f85be87d59cc877b6258d849f997b069", "score": "0.6079365", "text": "def ChangingSequence(arr)\n\n # code goes here\n if arr[0] > arr[1]\n for i in 1..arr.length-2\n if (arr[i + 1] > arr[i])\n return i\n break\n end\n end\n elsif arr[1]> arr[0]\n for i in 1..arr.length-2\n if (arr[i + 1] < arr[i])\n return i\n break\n end\n end\n end\n return -1 \n \nend", "title": "" }, { "docid": "2d1f5ffbab8c86bc000cce7ee42c2003", "score": "0.60726136", "text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend", "title": "" }, { "docid": "daa65150d831416e2efadb76420969b3", "score": "0.605979", "text": "def consecutive_collapse(array)\n return array if array.length < 2\n \n # debugger\n array.each_with_index do |num, idx|\n # debugger\n if (num + 1) == array[idx + 1] || (num - 1) == array[idx + 1]\n # debugger\n array.delete_at(idx + 1)\n array.delete_at(idx)\n consecutive_collapse(array)\n end\n end\nend", "title": "" }, { "docid": "fd1b780d3deb83593b4e42ea9d83cc30", "score": "0.6057287", "text": "def arithmetic?(arr)\n index = arr.length-1\n until index == 1\n current_diff = arr[index] - arr[index-1]\n index -= 1\n next_diff = arr[index] - arr[index-1]\n return false if next_diff != current_diff\n end\n true\nend", "title": "" } ]
757f090e68cd8bed83108dd1c1057f0f
Saves shifts in a period if template shift isn't already applied.
[ { "docid": "aea9f680cfd073e92306b6f0318e9475", "score": "0.6044031", "text": "def careful_make_period(i)\n self.careful_apply(i).each do |shift| shift.save end\n end", "title": "" } ]
[ { "docid": "3992687cdc16292c1b12b16af511e011", "score": "0.60999656", "text": "def make_period(i)\n self.apply(i).each do |shift| shift.save end\n end", "title": "" }, { "docid": "09731d291e0c5e22c5311302259d9e5a", "score": "0.5958003", "text": "def create\n Shift.active.first_or_create!\n s = Shift.active.first\n s.user_shifts.build\n s.user_shifts.find_or_create_by!(user_id: current_user.id)\n redirect_to work_path\n end", "title": "" }, { "docid": "e7e9494fe0f46dadd75e2eb398c55002", "score": "0.5761071", "text": "def set_shift_template\n @shift_template = ShiftTemplate.find(params[:id])\n end", "title": "" }, { "docid": "b96b7c5e41ae3726cb240f0c2c37cd92", "score": "0.57488644", "text": "def create\n @organization = Organization.find_by(id: current_user.organization_id)\n @shift = current_user.shifts.new(shift_params)\n @shift.shift_date = DateTime.now\n if @shift.save\n flash[:notice] = \"Shift was successfully created.\"\n redirect_to organizations_path\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "6493aa6ff6dad24e2017a51871c314ec", "score": "0.5728684", "text": "def set_shift_for_post(shift, start, finish)\n dup = shift.dup\n temp_start = dup.start_time.change(hour: start.hour, min: start.min)\n temp_finish = dup.finish_time.change(hour: finish.hour, min: finish.min)\n dup.start_time = temp_start\n dup.finish_time = temp_finish\n dup.post_id = shift.id\n dup.profile_id = profile.id\n\n dup\n end", "title": "" }, { "docid": "5a5cfff4967536d06b920b8a1f041981", "score": "0.57232016", "text": "def set_shifted\n @shifted = Shifted.find(params[:id])\n end", "title": "" }, { "docid": "9c4e529beb739ebc65da83df7d9a1d6d", "score": "0.5688346", "text": "def create\n if @user.organisation\n @shift = @user.shifts.build(shift_params)\n if @shift.save\n redirect_to organisation_shifts_path(@user.organisation)\n else\n render :new\n end\n else\n redirect_to dashboard_path\n end\n end", "title": "" }, { "docid": "9867df4490e66f9e15c913172b2d40e1", "score": "0.5680599", "text": "def set_shift\n @shift = Shift.find(params[:id])\n \n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ccde2073564fca83aecbd237d3250205", "score": "0.56477827", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "6965f67c95d2120585350812b7b155a0", "score": "0.5636247", "text": "def create_shift\n ve = nil\n if !params[\"id\"].blank?\n ve = VolunteerEvent.find(params[\"id\"])\n else\n if (params[\"assignment\"][\"volunteer_shift_attributes\"][\"roster_id\"].blank? || params[\"assignment\"][\"set_date\"].blank?)\n ve = VolunteerEvent.new # won't save\n else\n ve = Roster.find_by_id(params[\"assignment\"][\"volunteer_shift_attributes\"][\"roster_id\"]).vol_event_for_date(params[\"assignment\"][\"set_date\"])\n end\n end\n vs = ve.volunteer_shifts.new\n# vs.slot_count = 1\n# vs.volunteer_event_id = ve.id\n# vs.volunteer_event = ve\n vs.stuck_to_assignment = vs.not_numbered = true\n vs.attributes=(params[\"assignment\"][\"volunteer_shift_attributes\"])\n a = vs.assignments.new\n a.volunteer_shift = vs\n# a.volunteer_shift_id = vs.id\n a.attributes = (params[\"assignment\"])\n @assignments = vs.assignments = [a]\n vs.set_values_if_stuck\n vs.assignments = []\n @success = a.valid? && vs.save\n rt = params[:assignment].delete(:redirect_to)\n @my_url = {:action => \"create_shift\", :id => params[:id]}\n @assignment = a\n if @success\n vs = vs.reload\n @assignment = a = vs.assignments.new\n a.volunteer_shift = vs\n # a.volunteer_shift_id = vs.id\n a.attributes = (params[\"assignment\"])\n @assignments = vs.assignments = [a]\n\n if !@success\n vs.destroy\n end\n end\n if @success # and @assignment.volunteer_shift.save\n redirect_skedj(rt, ve.date_anchor)\n else\n render :template => 'assignments/edit'\n end\n end", "title": "" }, { "docid": "81d1d16796113de482f9469a1dea458f", "score": "0.5635286", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "ce64fe868c1247fe474ed91dd5fa5f73", "score": "0.5612127", "text": "def set_shift\n @shift = Shift.find(params[:id])\n end", "title": "" }, { "docid": "e7fb5b7a33f13c7628e9bff24e902928", "score": "0.55746835", "text": "def set_shift_time\n @shift_time = ShiftTime.find(params[:id])\n end", "title": "" }, { "docid": "f5085409afd3c181b83265af1b628199", "score": "0.55746347", "text": "def set_set_shift\n @set_shift = SetShift.find(params[:id])\n end", "title": "" }, { "docid": "1d271540900ee2609c5a4d17480e7795", "score": "0.55525875", "text": "def record!\n hours_rules, addon_rules = EarningRule.all.partition { |rule| rule.is_a?(HoursRule) }\n\n hours_rules.sort! { |a, b| a.rank < b.rank ? 1 : -1 }\n\n timesheet.shifts.each_with_object(EarningsContext.new) do |shift, ctx|\n shift.earnings.destroy_all\n\n ctx.next!(shift)\n\n hours_rules.each do |rule|\n break unless ctx.remaining_hours?\n\n applicable_hours = rule.hours(ctx).clamp(0, ctx.remaining_hours)\n\n next if applicable_hours <= 0\n\n shift.earnings.build(earning_rule: rule, units: applicable_hours)\n ctx.apply!(applicable_hours)\n end\n\n addon_rules.each do |rule|\n shift.earnings.build(earning_rule: rule, units: rule.units) if rule.addon?(ctx)\n end\n\n shift.save!\n end\n end", "title": "" }, { "docid": "839a034e61699137b920d351e9a9a208", "score": "0.5536555", "text": "def shifts=(value)\n @shifts = value\n end", "title": "" }, { "docid": "735a6d4d74a081d9dd3bb2003f22ef44", "score": "0.5526924", "text": "def create\n @shift = @store.shifts.new(params[:shift])\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to store_url(@store), notice: 'Shift was successfully created.' }\n format.json { render json: @shift, status: :created, location: @shift }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bd2c5a8515588b7e4ed25872f0d75a5", "score": "0.5503313", "text": "def take_shift\n user_shift = UserShift.find(params[:user_shift_id])\n original_user = user_shift.user\n user_shift.user = current_user\n if user_shift.save\n Notification.where(\n notification_type: @notification.notification_type,\n user_shift: user_shift\n ).each(&:destroy)\n Notification.where(\n user: original_user,\n action: false,\n notification_type: Notification::SHIFT_TAKEN,\n user_shift: user_shift).first_or_create\n flash[:notice] = 'We have successfully added your shift!'\n else\n flash[:error] = error_msg(user_shift)\n end\n redirect_to :root\n end", "title": "" }, { "docid": "1273b596d9c2c137d5dfa9806f52ef05", "score": "0.5458644", "text": "def create\n @shift.area_id = current_staff.staff_areas.first.area.id\n @shift.annotation = Annotation.new(:text => params[:annotation][:text])\n \n if @shift.created_at == nil || @shift.time_out == nil\n respond_to do |format|\n format.html { redirect_to({:action => \"new\", :shift => params[:shift], :annotation => params[:annotation][:text]}, :notice => \"You must complete both the \\\"Time in\\\" and a \\\"Time out\\\" fields before submitting your shift.\")}\n end\n return\n end\n\n # unless the following 2 commands are executed, the time is saved in the wrong time zone\n @shift.created_at = @shift.created_at.advance({:hours=>0})\n @shift.time_out = @shift.time_out.advance({:hours=>0})\n # can't understand why... but had to do it for tasks as well\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to({:action => \"#{@shift.staff.log_type}_log\", :controller => 'shifts', :id => @shift}, :notice => 'Your shift has been logged.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shift.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "944db851b9ef4946a2d2995811f3d7e2", "score": "0.5450542", "text": "def set_newshift\n @newshift = Newshift.find(params[:id])\n end", "title": "" }, { "docid": "292d1d21e575b0a98aa50b66f3d9c71f", "score": "0.5450251", "text": "def create\n @assignment = Assignment.find(params[:assignment_id])\n @shift = @assignment.shifts.new\n @shift.record_clock_in!\n\n\n respond_to do |format|\n if @shift.save\n\n\n \n format.html { redirect_to assignment_shift_path(@assignment, @shift), notice: 'Shift was successfully created.' }\n format.json { render :show, status: :created, location: @shift }\n format.js\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "0506513606432e32cc8176b16c17e752", "score": "0.5435068", "text": "def create\n @shift = current_user.shifts.build(shift_params)\n\n if @shift.save\n redirect_to shifts_path, notice: 'Shift was successfully created.'\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "84d8ab0eb42549fe20bc3daedf33c0b5", "score": "0.5395949", "text": "def update\n @shift.assign_attributes shift_params\n if @shift.save\n notice = 'Shift was successfully saved.'\n else\n alert = @shift.errors.full_messages.to_sentence\n end\n redirect_to shifts_path(date: @shift.start.to_date),\n notice: notice, alert: alert\n end", "title": "" }, { "docid": "cea58baca7f562bcc77dc4d3fa23657b", "score": "0.5394521", "text": "def create_work_shift_successful(shift)\n return unless meal_shift?(shift)\n sync_meal_to_shift(shift.meal, shift)\n end", "title": "" }, { "docid": "12430888a8a79a789db0e004fa0775b7", "score": "0.5369197", "text": "def shift_in_week\n #create ranges for botht eh week and shift\n week_range = (self.week.date_started)..(self.week.date_started + 1.week - 1.second)\n #shift_range = self.created_at..self.finished_at\n\n #invalid if they do not overlap\n errors.add(:created_at, \"The shift must have started within the week\") if !week_range.cover?(self.created_at) #only need the created at within if im going to close shifts at midnight\n #if !shift_range.overlaps?(week_range)\n end", "title": "" }, { "docid": "6441ae4239c3b8b38e2ac7724bcadc7e", "score": "0.5365072", "text": "def create\n @timesheet = Timesheet.new(timesheet_params)\n \n @timesheet.shifts.last\n \n \n authorize @timesheet\n\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to admin_timesheets_path(@timesheet), notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: @timesheet }\n else\n format.html { render :new }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2eb17849e81682083bc0a53a3572a97c", "score": "0.5365024", "text": "def create\n @shift = Shift.new(shift_params)\n if @shift.save\n notice = 'Shift was successfully created.'\n else\n alert = @shift.errors.full_messages.to_sentence\n end\n redirect_to shifts_path(date: @shift.start.to_date),\n notice: notice, alert: alert\n end", "title": "" }, { "docid": "a886ba8e4d51a17466bfa2486455f28b", "score": "0.5363372", "text": "def set_shift\n @shift = Shift.find(params[:id]).includes(:breaks)\n end", "title": "" }, { "docid": "af68c95b020ba79a2b9ef53edb652dee", "score": "0.5316808", "text": "def update\n @shift = Shift.find(params[:id])\n @day = @shift.day\n @week = @day.week\n\n unless @shift.free? or current_person.is_admin_for? @shift.saison\n flash[:error] = t'shifts.update.already_taken'\n redirect_to :back\n return\n end\n\n respond_to do |format|\n if @shift.update(shift_params)\n flash[:notice] = t'shifts.update.success'\n format.html { redirect_to( week_path(@week) ) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "040aec715b0804c4ddcfc5b002b594a3", "score": "0.53156847", "text": "def create\n @title = t('view.shifts.new_title')\n @shift = shifts_scope.new(shift_params)\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to shifts_url, notice: t('view.shifts.correctly_created') }\n format.json { render json: @shift, status: :created, location: @shift }\n else\n format.html { render action: 'new' }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edf0a5130a239ac594521a4fda83bd12", "score": "0.52976114", "text": "def shift=(shift)\n @shift = shift_calc(shift)\n end", "title": "" }, { "docid": "d275f4cc554819f1da15287303949b60", "score": "0.5291262", "text": "def append_shift(shift, weeks)\n if shift.start.strftime(\"%U\") != weeks[-1][-1][-1].start.strftime(\"%U\")\n weeks.append [[shift]]\n elsif shift.start.wday != weeks[-1][-1][-1].start.wday\n weeks[-1].append [shift]\n else\n weeks[-1][-1].append shift\n end\n end", "title": "" }, { "docid": "e67e4723b28309878b1ecc84ea583713", "score": "0.52890813", "text": "def create\n @shift = Shift.new(shift_params)\n @recurring_shift = RecurringShift.new(recurring_shift_params)\n respond_to do |format|\n if @shift.save\n @shift.set_duration\n @shift.office = @shift.caregiver.office\n @recurring_shift.end_recurrence_date = Date.strptime(@recurring_shift.time_span, \"%m/%d/%Y\")\n if @recurring_shift.frequency and @recurring_shift.end_recurrence_date and (@recurring_shift.frequency < 99)\n @recurring_shift.save\n create_recurring_shifts\n end\n created_shift_activity\n format.html { redirect_to shifts_url, notice: 'Shift was successfully created.' }\n format.json { render :index, status: :created, location: shifts_url }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "773d39d71556570832ff64311f0aac97", "score": "0.52791476", "text": "def create\n prior = params[:shift_detail][:prior].split(\"--\")\n location = prior[0] || params[:shift_detail][:location]\n description = prior[1] || params[:shift_detail][:description]\n\n @shift_detail = ShiftDetail.find_by_location_and_description(location, description)\n @shift_template = @shift_detail.shift_templates.create(shift_template_params)\n @user = User.where(username: params[:shift_template][:assigned_user]).take\n\n @shift_template.user = @user\n @shift_template.semesters << @semester\n @shift_template.save\n redirect_to semester_path(@semester)\n\n # @shift = Shift.new(shift_params)\n\n # respond_to do |format|\n # if @shift.save\n # format.html { redirect_to @shift, notice: 'Shift was successfully created.' }\n # format.json { render :show, status: :created, location: @shift }\n # else\n # format.html { render :new }\n # format.json { render json: @shift.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "91952e14d64ba0dd543a80bc91fc14be", "score": "0.5270434", "text": "def create\n @set_shift = SetShift.new(set_shift_params)\n\n respond_to do |format|\n if @set_shift.save\n format.html { redirect_to @set_shift, notice: 'Set shift was successfully created.' }\n format.json { render action: 'show', status: :created, location: @set_shift }\n else\n format.html { render action: 'new' }\n format.json { render json: @set_shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ccdc91231cf9c17cb7c3546237996a7", "score": "0.5267528", "text": "def create\n required = self.class.creation_params.select { |_, v| v }.keys\n required.each { |p| params.require p }\n p = params.permit self.class.creation_params.keys\n\n past_shift = p[:start_time] < DateTime.now\n return render status: :bad_request, json: { data: {\n message: \"Cannot create shift in the past\" } } if past_shift\n\n # get person flexibly\n p[:person] = Person.find_by_id_flexible p[:person_id]\n return render status: :not_found, json: { data: {\n message: \"Person not found\" } } if p[:person].nil?\n p.delete :person_id\n\n if params[:repeat].nil?\n @shift = create_shift p\n return render :show, status: :created\n end\n\n start_time = DateTime.parse p[:start_time]\n @shifts = (0..(Integer(params[:repeat]) - 1)).map do |iter|\n p[:start_time] = start_time + iter.weeks\n create_shift p\n end\n\n @shifts.sort_by!(&:start_time)\n render :index, status: :created\n rescue ActionController::ParameterMissing => e\n render_missing_params e.param, self.class.creation_params.keys\n rescue ActiveRecord::RecordInvalid\n render_validation_error @shift\n end", "title": "" }, { "docid": "c069f3a571736df3bd72f43ada6d814b", "score": "0.52550995", "text": "def create\n @semester = Semester.find(session[:semester][\"id\"])\n @shift = @semester.shifts.create(shift_params)\n flash[:notice] = \"#{@shift.description} @ #{@shift.location} was successfully created.\"\n redirect_to semester_path(@semester)\n \n # @shift = Shift.new(shift_params)\n\n # respond_to do |format|\n # if @shift.save\n # format.html { redirect_to @shift, notice: 'Shift was successfully created.' }\n # format.json { render :show, status: :created, location: @shift }\n # else\n # format.html { render :new }\n # format.json { render json: @shift.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "215ddab8a15ff16a482196de8e752c79", "score": "0.5251413", "text": "def set_shift\n @shift = Shift.find(params[:id])\n authorize @shift\n end", "title": "" }, { "docid": "fbda66c9b5e35e0e218ffbd6fed6de45", "score": "0.5224849", "text": "def update\n shifts = params[\"post\"][\"shifts\"]\n errors = Shift.sign_up(shifts, current_user)\n if errors[:failed_save]\n flash[:error] = errors[:failed_save]\n elsif errors[:claimed_shifts].present?\n # These are shifts that we could not assign because they had already been\n # assigned to another user.\n # It will be the view's responsibility to loop through these\n # and to correctly display the error message. \n # We have to put these in the session because we're redirecting back to the\n # index and those variables aren't persisted across requests.\n session[:claimed_shifts] = errors[:claimed_shifts]\n flash[:notice] = \"We saved some shifts, but there were errors with others.\"\n else\n flash[:notice] = \"You successfully signed up for your requested shifts!\"\n end\n\n # NOTE: If you change where this method redirects to, you also need to move\n # the rror div that loops through @claimed_shifts which is currently in the index.\n redirect_to doctors_path\n end", "title": "" }, { "docid": "ecf50d276777bc5466d5a4202921a57d", "score": "0.5192653", "text": "def set_shift_params\n params.require(:set_shift).permit(:assignee_id, :assigner_id, :start, :end, :is_PTO?)\n end", "title": "" }, { "docid": "132e6b2ede01b06fdb39ef848e886018", "score": "0.51913965", "text": "def update\n if @shift.update(shift_params)\n redirect_to organisation_shifts_path(@organisation)\n else\n render :edit\n end\n end", "title": "" }, { "docid": "ad3e10d98e78ae2cb207e021011185d9", "score": "0.5171003", "text": "def add_shift\n user_shift = UserShift.where(\n user: current_user,\n shift_id: params[:shift_id]\n ).first_or_initialize\n\n if user_shift.new_record? && user_shift.save\n @notification.destroy\n flash[:notice] = 'We have successfully added your shift!'\n else\n flash[:error] = error_msg(user_shift)\n end\n redirect_to :root\n end", "title": "" }, { "docid": "7e26ead6bf59a54eec9e0d0d6a29c824", "score": "0.5151548", "text": "def create\n @shiftable = find_shiftable\n @shift = @shiftable.shifts.build(params[:shift])\n if @shift.save\n flash[:notice] = \"Successfully created shift.\"\n noting_on = @shift.shiftable_type.pluralize\n id = @shift.shiftable_id\n # b/c of asset pipeline we will simply use the following eval hack (quick and painless):\n eval \"redirect_to #{@shift.shiftable_type.downcase}_path(:id=>#{id})\"\n else\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "3f3bc2cef1ceba1b805192f846d436be", "score": "0.51430255", "text": "def check_period(i)\n Shift.where(:template_shift_id=>self.template_shift, :start=>self.get_period(i)).exists?\n end", "title": "" }, { "docid": "c1a9962b1fbb5c22312188bd60a59b12", "score": "0.511103", "text": "def adjust_hours_and_wage!(shift, action)\n #case for the action being executed\n case action\n\n #on create simply add the values on shift\n when \"create\"\n hours = shift.hours_worked\n wage = shift.wage_earned\n\n #on update, calculate the change and adjust\n when \"update\"\n #get the differences\n hours = shift.hours_worked - (shift.hours_worked_before_last_save || 0)\n wage = shift.wage_earned - (shift.wage_earned_before_last_save || 0)\n\n #on destory remove entirely\n when \"destroy\"\n hours = -shift.hours_worked\n wage = -shift.wage_earned\n end\n\n #then adjust them on self if needed\n add_hours_to_day!(shift.day_worked, hours) if hours != 0\n add_wage_to_total!(wage) if wage != 0\n\n #and save, throwing an exception on a fail\n self.save!\n end", "title": "" }, { "docid": "31a737ba1c427f5ea0ed7c09ae9b3abf", "score": "0.5103777", "text": "def update\n @user_shift=UserShift.find(params[:id])\n @user_shift.update(user_shift_params)\n @user_shift.save\n redirect_to work_path\n end", "title": "" }, { "docid": "f9426bb6c49cd0068b314ce6fd94f5ce", "score": "0.5097337", "text": "def create\n shift = Shift.find(params[:shift_id])\n if shift.start > 1.day.from_now\n flash[:error] = \"You can't sign into a shift too far in advance\"\n redirect_to dashboard_path and return\n end\n\n @report = Report.new(shift_id: params[:shift_id], arrived: Time.now)\n\n if current_user.current_shift || current_user.punch_clock\n flash[:error] = \"You are already signed into a shift or punch clock.\"\n elsif @report.user!=current_user\n flash[:error] = \"You can't sign into someone else's report.\"\n else\n @report.save\n @report.report_items << ReportItem.new(time: Time.now, content: \"#{current_user.name} (#{current_user.login}) logged in from #{request.remote_ip}\", ip_address: request.remote_ip)\n a = @report.shift\n a.signed_in = true\n a.save(validate: false) #ignore validations because this is an existing shift or an unscheduled shift\n redirect_to @report and return\n end\n redirect_to shifts_path\n end", "title": "" }, { "docid": "26deac0b4e0fc0bb92218a7c04bba930", "score": "0.50794727", "text": "def create\n if params[:substitution][:entry].nil?\n flash[:error] = 'Please select a shift to substitute.'\n redirect_to :back\n return\n end\n sub_entry = Entry.find(params[:substitution][:entry])\n # split shift into 3 pieces, sub the middle one\n if params[:partial_shift] && params[:partial_shift][:enabled] && params[:partial_shift][:enabled] == \"1\"\n s = splitShift(sub_entry, params)\n if s == nil\n flash[:error] = \"Invalid partial shift times\"\n redirect_to :back\n return\n else\n sub_entry = s\n end\n end\n new_sub_params = {:entry => sub_entry,\n :description => params[:substitution][:description]}\n @substitution = Substitution.new(new_sub_params)\n @substitution.entry_id = sub_entry.id\n from_user = User.find(sub_entry.calendar.user)\n @substitution.user_id = from_user.id\n if from_user\n @substitution.users << from_user\n if params[:user] && params[:user][:id] && params[:user][:id] != \"\" && User.find(params[:user][:id])\n to_user = User.find(params[:user][:id])\n @substitution.users << to_user\n end\n end\n respond_to do |format|\n if @substitution.is_expired?\n if from_user\n flash[:error] = \"Expired Shift\"\n format.html { redirect_to request.referer }\n else\n flash[:error] = \"Expired Shift\"\n format.html { redirect_to new_substitution_path }\n end\n format.json { render json: @substitution.errors, status: :unprocessable_entity }\n elsif @substitution.save\n SubstitutionMailer.posted_sub(@substitution)\n if request && request.referer && request.referer.include?('admin')\n format.html { redirect_to manage_substitutions_path, notice: 'Substitution was successfully created.' }\n else\n format.html { redirect_to substitutions_path, notice: 'Substitution was successfully created.' }\n end\n format.json { render json: @substitution, status: :created, location: @substitution }\n else\n if request && request.referer && request.referer.include?('admin')\n format.html { redirect_to request.referer, notice: 'Substitution could not be created.' }\n else\n format.html { redirect_to new_substitution_path, notice: 'Substitution could not be created.' }\n end\n format.json { render json: @substitution.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "898c92f49bdadad37480e19f1c79c8b2", "score": "0.50763524", "text": "def create\n #@article = Article.find(params[:article_id])\n #@comment = @article.comments.create(comment_params)\n @shift = current_user.shifts.create(shift_params)\n redirect_to user_shifts_path(current_user)\n\n end", "title": "" }, { "docid": "dfe5f8904637d745319566deae40a53c", "score": "0.50734985", "text": "def set_option_shift\n @option_shift = OptionShift.find(params[:id])\n end", "title": "" }, { "docid": "e8a1239b362b86463e6da9f6e501133c", "score": "0.5073177", "text": "def create\n @option_shift = OptionShift.new(option_shift_params)\n\n respond_to do |format|\n if @option_shift.save\n format.html { redirect_to @option_shift, notice: 'Option shift was successfully created.' }\n format.json { render :show, status: :created, location: @option_shift }\n else\n format.html { render :new }\n format.json { render json: @option_shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11d49c1fc6855cd284306c6008c11c25", "score": "0.50434244", "text": "def save_as_week(tmpl, year, week)\n\n if tmpl.length != 7\n puts \"ERROR missing template items! Must be exactly 7\"\n return\n end\n\n wkBegin = Date.commercial(year, week, 1)\n wkEnd = Date.commercial(year, week, 7)\n\n index=0\n for d in wkBegin..wkEnd do\n tmpl_day = tmpl[index]\n BookingItem.create(tmpl_day)\n index = index + 1\n end\n end", "title": "" }, { "docid": "baee70ddb81f9f502f3b9fcb584dc7a5", "score": "0.5040418", "text": "def create\n @shift_time = ShiftTime.new(shift_time_params)\n\n from = shift_time_params[\"from\"]\n to = shift_time_params[\"to\"]\n total_hrs = to.to_time - from.to_time\n working_hrs = Time.at(total_hrs).utc.strftime(\"%H:%M\")\n\n if @shift_time.save\n @shift_time.update(working_hrs: working_hrs)\n @shift_time = ShiftTime.new\n @shift_times = ShiftTime.all\n @flag=true \n else\n @flag=false\n end\n end", "title": "" }, { "docid": "0e4abc16609e15d4b1797688c7a2a81a", "score": "0.5036163", "text": "def shift_params\n params.require(:shift).permit(:shift_start, :shift_end, :user_id, :month_id)\n end", "title": "" }, { "docid": "6cf40a41feb8f72d668228b1090d9deb", "score": "0.50261587", "text": "def create\n @shift = Shift.new(shift_params)\n @shift.save\n respond_with(@shift)\n end", "title": "" }, { "docid": "6cf40a41feb8f72d668228b1090d9deb", "score": "0.50261587", "text": "def create\n @shift = Shift.new(shift_params)\n @shift.save\n respond_with(@shift)\n end", "title": "" }, { "docid": "2fd423c94b06f4cacef337f16af3621f", "score": "0.5021321", "text": "def create\n @shift = Shift.new(shift_params)\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to new_shift_path, notice: 'Shift was successfully submitted.' }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecbf8e213030113f4d68e061a8747492", "score": "0.501407", "text": "def shifts\n helpers.validate_shift_params\n if Shift.all.ids.include? @s_id and User.all.ids.include? @u_id\n @user = User.find(@u_id)\n @shift = Shift.find(@s_id)\n if @shift.team_id == @user.team_id\n @user.shifts << @shift\n data = {\n user_shifts: current_user.shifts,\n team_shifts: current_user.team.shifts,\n }\n render json: { status: 'SUCCESS', message: 'User added to Shift successfully.', data: data }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Shift and User must be the same team.' }, status: :unprocessable_entity\n end\n else\n render json: { status: 'ERROR', message: 'Shift and/or User not found.' }, status: :not_found\n end\n end", "title": "" }, { "docid": "ec5d816c43f8e84f3dac9ab1eb505484", "score": "0.5012666", "text": "def create_swapped_closed_shifts(shiftA, shiftB)\n\t\tclosedShiftA = ClosedShift.new(open_shift_id: shiftA.id, new_assignee_id: shiftB.assignee_id, claimed: true)\n\t\tclosedShiftB = ClosedShift.new(open_shift_id: shiftB.id, new_assignee_id: shiftA.assignee_id, claimed: true)\n\t\tclosedShiftA.save!\n\t\tclosedShiftB.save!\n\tend", "title": "" }, { "docid": "83569e228b591f6fc7dff0e065f1d5f5", "score": "0.5011319", "text": "def shifts\n user = current_user\n url_id = request.fullpath.sub('/member_portal/users/', '')\n url_id = url_id.sub('/shifts','')\n redirect_to user_shifts_path(user.id) unless (url_id == user.id.to_s)\n @shifts = Shift.select { |shift| shift.shift_time > Time.now }.sort_by!{ |shift| shift.shift_time }\n @weeks = Array.new\n if @shifts.size == 0\n weekNum = 0\n else\n weekNum = (((@shifts.last.shift_time.to_date - Date.today) / 7)).ceil + 1\n end\n weekNum.times do |n|\n @weeks[n] = Date.today + (7 * n)\n end\n end", "title": "" }, { "docid": "27685158e92bd1187f4d4ecf81a31bde", "score": "0.5008045", "text": "def send_shifts\n @shifts.each do |time, metrics|\n to_send = {}\n\n metrics.each do |k|\n key = \"#{@prefix}.#{k}\"\n shifted_key = key + \"_shifted.#{time}_ago\"\n to_send[shifted_key] = @metrics[key]\n end\n\n seconds = Rufus.parse_time_string time\n @logger.log(Time.now + seconds,to_send)\n end\n end", "title": "" }, { "docid": "c811f0b4f5423055b41b8508f7486b01", "score": "0.5002735", "text": "def shift_params\n params.require(:shift).permit(:assignment_id, :date, :start_time, :end_time, :notes)\n end", "title": "" }, { "docid": "1baf3f3ddfe02ddd88b520c8a058f60c", "score": "0.49981478", "text": "def create\n @update_shift = shift_params\n @update_shift[:date] = Date.strptime(shift_params[:date].to_s, \"%m/%d/%Y\") \n @shift = Shift.new(@update_shift)\n @assignment = @shift.assignment\n respond_to do |format|\n if @shift.save\n @shifts = @assignment.shifts.select{ |s| can? :read, s}.to_a.paginate(:page => params[:shifts_page], :per_page => 8) \n format.js\n format.html { redirect_to @shift, notice: 'Shift was successfully created.' }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07a507a20caf138f61222897a1e70527", "score": "0.49927992", "text": "def create\n @shift_time = ShiftTime.new(params[:shift_time])\n\n respond_to do |format|\n if @shift_time.save\n Tutor.all.each do |tutor|\n Availability.new(:available => :pref, :tutor_id => tutor.id, :shift_time_id => @shift_time.id).save\n end\n format.html { redirect_to @shift_time, notice: 'Shift time was successfully created.' }\n format.json { render json: @shift_time, status: :created, location: @shift_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shift_time.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0b2176c483d4c816aafd98ed5ebf73c", "score": "0.4991528", "text": "def shift_params\n params.require(:shift).permit(:start_time, :end_time, :metashift_id)\n end", "title": "" }, { "docid": "4c9299602a2c432ac770b9c33045a3b7", "score": "0.49905542", "text": "def update\n @shift = @store.shifts.find(params[:id])\n\n respond_to do |format|\n if @shift.update_attributes(params[:shift])\n format.html { redirect_to store_url(@store), notice: 'Shift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2e74347a85d329b4576af4d32ddb041", "score": "0.498554", "text": "def update\n if @shift.update(shift_params)\n flash[:notice] = \"Shift was successfully edited.\"\n redirect_to organization_path(current_user.organization_id)\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "c10026622e14387b9f850538e7364108", "score": "0.49819025", "text": "def shift_params\n params.require(:shift).permit(:date, :time, :min_staff, :admin_branch_id)\n end", "title": "" }, { "docid": "46c19ef24c65071f28705f84e9a818c9", "score": "0.49772078", "text": "def shift_params\n params.permit(:organisation_id, :shift_date, :start_time, :finish_time, :break_length)\n end", "title": "" }, { "docid": "412cb531c2fff9f99d07ad0508024bea", "score": "0.49738798", "text": "def staff_shift_params\n params.require(:staff_shift).permit(:work_start_time, :work_end_time, :staff_id)\n end", "title": "" }, { "docid": "8b4e607282439398a33a0215a233cf15", "score": "0.49704525", "text": "def shift_params\n params.require(:shift).permit!\n end", "title": "" }, { "docid": "2cf737915286865115e7579f02120f27", "score": "0.49689153", "text": "def create\n @shift = Shift.new(shift_params)\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to @shift, notice: 'Shift was successfully created.' }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2cf737915286865115e7579f02120f27", "score": "0.49689153", "text": "def create\n @shift = Shift.new(shift_params)\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to @shift, notice: 'Shift was successfully created.' }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd85eca13fcf7192660811c3c8c76935", "score": "0.49594685", "text": "def update\n @shift_detail = ShiftDetail.find_by_location_and_description(params[:shift_detail][:location],params[:shift_detail][:description])\n if (!@shift_template.shift_detail.eql?@shift_detail)\n @temp_shift_detail = @shift_template.shift_detail\n @shift_template.shift_detail = @shift_detail\n @shift_template.save\n ShiftDetail.check_and_remove_hanging_details(@temp_shift_detail)\n end\n @user = User.where(username: params[:shift_template][:assigned_user]).take\n @shift_template.user = @user\n @shift_template.update_attributes!(shift_template_params)\n redirect_to semester_path(@semester)\n end", "title": "" }, { "docid": "843b7e8d3595c37e67f29c91b3b5699f", "score": "0.4957924", "text": "def shift_params\n params.require(:shift).permit!\n end", "title": "" }, { "docid": "48ce69a6726a84d1581a18483dd9f06d", "score": "0.4938383", "text": "def create\n \n @job = Job.find(params[:job_id])\n @employee = @job.employee\n\n @shift = @job.shifts.new(employee: @employee)\n @shift.startshift\n # @shift.employee = @employee\n # authorize @shift\n\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to job_shifts_path(@job), notice: 'Shift was successfully created.' }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81980c457c71a92d647a02b4633d13d9", "score": "0.49377838", "text": "def update\n @job = @shift.job\n @employee = @shift.employee\n @week = @shift.time_out || @shift.time_in\n @shift.week = @week.to_datetime.cweek\n\n respond_to do |format|\n if @shift.update(shift_params)\n format.html { redirect_to admin_shift_path(@shift), notice: 'Shift was successfully updated.' }\n format.json { render :show, status: :ok, location: @shift }\n else\n format.html { render :edit }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d987fb2e9510f6ffe99050bde9ade444", "score": "0.49285483", "text": "def reGenerateSchedule()\n start_of_month = Date.today.beginning_of_month\n end_of_month = Date.today.end_of_month\n \n # grab the suggested order from yaml config file\n suggested_order = Settings.predefined_shift_order\n \n # remove current schedules\n Shift.destroy_all\n \n employee_counter = 0\n (0..31).each do |i|\n date = start_of_month + i \n \n if date > end_of_month\n break\n end\n \n if Settings.skip_weekends and (date.saturday? or date.sunday?)\n next\n end\n \n if Settings.skip_holidays and Holidays.on(date, :us).length > 0\n next\n end\n \n available_employee_found = false\n try_counter = 0\n while !available_employee_found\n if employee_counter >= suggested_order.length\n employee_counter = 0\n end\n employee = Employee.find_by first_name: suggested_order[employee_counter]\n if !employee\n # we didn't find this employee...moving on!\n employee_counter += 1 \n next\n end \n if employee.work_restrictions.find_by date: date\n # swap the current employee with one [try_counter] down the array\n try_counter += 1\n if employee_counter + try_counter >= suggested_order.length\n # we'd overflow the array, start back at 0\n proper_offset = employee_counter + try_counter - suggested_order.length\n else\n proper_offset = employee_counter + try_counter\n end \n suggested_order[employee_counter], suggested_order[proper_offset] = suggested_order[proper_offset], suggested_order[employee_counter] \n next\n end \n available_employee_found = true\n end \n \n # create new schedules \n employee.shifts.create({on_call_date: date})\n if employee_counter == suggested_order.length\n #start back at the beginning\n employee_counter = 0\n else\n employee_counter += 1\n end\n end\n end", "title": "" }, { "docid": "edee1a2449eb05f945afdadd83ba22de", "score": "0.49257708", "text": "def adjust_weekly_payroll\n weekly_payroll = self.weekly_payroll\n action = after_clock_out? ? \"create\" : \"update\"\n weekly_payroll.adjust_hours_and_wage!(self, action) \n end", "title": "" }, { "docid": "687ff43f5d800f5c58bc8baa944b2060", "score": "0.49223727", "text": "def shift_params\n params.require(:shift).permit(:start, :finish, :breaks)\n end", "title": "" }, { "docid": "03e71b43ccfe97ae66c342ee12ab0f32", "score": "0.4919859", "text": "def save_timesheet\n\n # get the timesheet\n @timesheet = Timesheet.find(params[:timesheet_id])\n\n # approved or denied\n if params[:commit] == 'Approve'\n\n @timesheet.status = 'APPROVED'\n\n else\n\n @timesheet.status = 'DENIED'\n \n end\n\n # set the requirements to false... for validation\n @timesheet.timesheet_entries.each {|entry|\n\n entry.requireTimes = false\n entry.requireFullWeek = false\n \n }\n\n @timesheet.userName = current_user.full_name\n @timesheet.note = params[:notes]\n \n # save it\n if @timesheet.save(false)\n\n redirect_to approverdashboard_path\n\n else\n\n render :view_timesheet\n \n end\n\n end", "title": "" }, { "docid": "b1651742d7c0e64dd44ea31f3bc4ba51", "score": "0.4914619", "text": "def shift_params\n params.require(:shift).permit(:employee_id, :crew_id, :start_shift_date, :end_shift_date, :start_shift_time, :end_shift_time, :production_rate)\n end", "title": "" }, { "docid": "610eeabc45fe7df7bee63aaa2db37a5d", "score": "0.49133533", "text": "def update\n # @shift automatically loaded by CanCan\n params[:shift] ||= Hash.new\n params[:shift][:time_out] ||= Time.now\n params[:shift][:annotation] = params[:annotation][:text]\n\n @notice = \"\"\n if @shift.staff.on_duty?\n round = Round.where(:end_time => nil, :shift_id => @shift.id).first\n @notice += \"You are now off duty\"\n if round != nil\n round.end_time = Time.now\n round.save\n @notice += \" and off a round\"\n end\n @notice += \". Your shift has been logged.\"\n else\n @notice += \"Your #{@shift.staff.log_type} log has been updated.\"\n end\n\n if [email protected]_completed?\n @notice += \"..but some tasks were not completed!\"\n end\n\n \n respond_to do |format|\n if @shift.update_attributes(params[:shift])\n format.html { redirect_to({:action => \"#{@shift.staff.log_type}_log\", :controller => 'shifts', :id => @shift.id}, :notice => @notice) }\n format.js { render 'shifts/end_shift' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shift.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2a4b8b4e0bfbbf6f7d3f77308c32609", "score": "0.49106926", "text": "def archive\n @shifts = Shift.select { |shift| shift.shift_time < Time.now }.sort_by!{ |shift| shift.shift_time }\n end", "title": "" } ]
2e42a4f089c696c01c388dfd6c7a12a4
Pop entries off the schedule that are due
[ { "docid": "a8bb22af3946b1cba13648790adef9b8", "score": "0.7483986", "text": "def entries_due\n [].tap do |entries|\n sync do\n while schedules.first && schedules.first.due?\n entries << schedules.shift\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "3b405b97028701e9b5c115b2aec40406", "score": "0.67308563", "text": "def dequeue\n [].tap do |items|\n entries.each do |entry|\n items << entry\n end if entries.any?\n\n items.each {|i| entries.delete(i) }\n\n available = later.select {|entry| entry['when'] < Time.now.to_f }\n\n if available.any?\n available.each do |entry|\n items << entry['worker']\n end\n\n available.each {|a| later.delete(a) }\n end\n end\n end", "title": "" }, { "docid": "b89b8d4868434fb11c7ad04f4ad61d6b", "score": "0.65644795", "text": "def pop_next_available\n unused_entries = []\n result = nil\n while (entry = pop)\n if entry.run_at <= Time.now\n result = entry\n break\n else\n unused_entries << entry\n end\n end\n unused_entries.each {|e| push(e) }\n result\n end", "title": "" }, { "docid": "0f710ef6c69ae2b832612232cee3bffd", "score": "0.61721784", "text": "def reschedule\n # get non-old tuples\n # iterate through them, rescheduling\n end", "title": "" }, { "docid": "838dcab1ed9f358e852fc60108ffb32c", "score": "0.60290104", "text": "def populate_tasks(time_forward = 3.months)\n \n inserts = []\n places = []\n timestamp = Time.now.strftime('%Y-%m-%d %H:%M:%S')\n\n # Make sure not to populate the same event twice at boundaries\n due_dates = self.recurrence.occurrences(Date.today + time_forward)\n if due_dates.size > 0 && due_dates[0].to_date == self.recurrence.start_time.to_date\n due_dates.delete_at(0)\n end\n\n due_dates.each do |due_date|\n places.push \"(?,?,?,?,?,?,?)\"\n inserts.push(*[self.id, self.user_id, self.task, self.note, due_date.strftime('%Y-%m-%d'), timestamp, timestamp])\n end \n\n if places.length > 0\n sql_arr = [\"INSERT INTO tasks (task_recurrence_id, user_id, task, note, due_date, created_at, updated_at) VALUES #{places.join(\", \")}\"] + inserts\n sql = ActiveRecord::Base.send(:sanitize_sql_array, sql_arr)\n ActiveRecord::Base.connection.execute(sql)\n end \n\n if due_dates.size > 0\n self.recurrence.start_time = due_dates[-1]\n self.schedule = self.recurrence.to_hash\n self.save\n end\n end", "title": "" }, { "docid": "6181d3eef45adb8602767e16306a2171", "score": "0.6006943", "text": "def daily_standup_time_entries\n @_daily_standup_time_entries ||= billable_time_entries.select { |time_entry| time_entry.dig('task', 'id') == 9_701_231 }\n end", "title": "" }, { "docid": "332e74441f93600423936f6e25cefa57", "score": "0.6005667", "text": "def check_overdue\n overdue = [ ]\n each_working do |item|\n unless item.get_meta.nil?\n # then push, overdue items\n overdue.push(item) if item.overdue?\n else\n rcache.lrem(working_cache_key, 0, item.trx_id)\n end\n end\n overdue\n end", "title": "" }, { "docid": "83e959714ff7a94e70c25cac7021b62b", "score": "0.597746", "text": "def due_tasks\n assigned_tasks.select { |task| task.target_date < reference_date }\n end", "title": "" }, { "docid": "5a5d0a093fa061ba1fdb585a52064af1", "score": "0.59407157", "text": "def upcomming_schedule(limit:)\n object.upcomming_schedule(limit)\n end", "title": "" }, { "docid": "1f5a541bed949d5a41ab273d5fa0bec3", "score": "0.58887476", "text": "def overdue\n FilterableList.new(tasks.clone.keep_if do |t|\n t.date && t.date < Date.today && !t.done\n end)\n end", "title": "" }, { "docid": "d987fb2e9510f6ffe99050bde9ade444", "score": "0.58292615", "text": "def reGenerateSchedule()\n start_of_month = Date.today.beginning_of_month\n end_of_month = Date.today.end_of_month\n \n # grab the suggested order from yaml config file\n suggested_order = Settings.predefined_shift_order\n \n # remove current schedules\n Shift.destroy_all\n \n employee_counter = 0\n (0..31).each do |i|\n date = start_of_month + i \n \n if date > end_of_month\n break\n end\n \n if Settings.skip_weekends and (date.saturday? or date.sunday?)\n next\n end\n \n if Settings.skip_holidays and Holidays.on(date, :us).length > 0\n next\n end\n \n available_employee_found = false\n try_counter = 0\n while !available_employee_found\n if employee_counter >= suggested_order.length\n employee_counter = 0\n end\n employee = Employee.find_by first_name: suggested_order[employee_counter]\n if !employee\n # we didn't find this employee...moving on!\n employee_counter += 1 \n next\n end \n if employee.work_restrictions.find_by date: date\n # swap the current employee with one [try_counter] down the array\n try_counter += 1\n if employee_counter + try_counter >= suggested_order.length\n # we'd overflow the array, start back at 0\n proper_offset = employee_counter + try_counter - suggested_order.length\n else\n proper_offset = employee_counter + try_counter\n end \n suggested_order[employee_counter], suggested_order[proper_offset] = suggested_order[proper_offset], suggested_order[employee_counter] \n next\n end \n available_employee_found = true\n end \n \n # create new schedules \n employee.shifts.create({on_call_date: date})\n if employee_counter == suggested_order.length\n #start back at the beginning\n employee_counter = 0\n else\n employee_counter += 1\n end\n end\n end", "title": "" }, { "docid": "73afef141e6dc84fc6d351dc4ca02bf0", "score": "0.58269703", "text": "def pop\r\n\r\n # Jump out if no expired task available\r\n return if expired_tasks.empty?\r\n\r\n # They are already sorted by finish_time descending\r\n task = expired_tasks.first\r\n\r\n # Remove found one from Redis\r\n RedisConnection.srem( key, task.to_redis )\r\n\r\n task\r\n\r\n end", "title": "" }, { "docid": "b8caa44e4d60156530e954580ce88ccd", "score": "0.58265585", "text": "def overdue_tasks\n tasks = Task.joins(\"inner join task_statuses on tasks.task_status_id = task_statuses.id\").where('tasks.task_type_id' => self.id, 'task_statuses.finish' => false).where('tasks.attempt_next_contact_by IS NULL OR tasks.attempt_next_contact_by < ?', Time.current).order('created_at DESC')\n end", "title": "" }, { "docid": "6b9988e842abc5b56cb8aadc786ffce8", "score": "0.5776296", "text": "def incomplete_due_today\n a = get_incomplete\n a2 = []\n a.each do |task|\n if task.class == DueTask && task.due_date == Date.today\n a2 << task\n end\n end\n a2\n end", "title": "" }, { "docid": "11a7cf8cd26202872f990a02f0684af2", "score": "0.5708734", "text": "def getEventDate (schedule)\n\t# Loops until there's a valid date given and the data preceeding the start date is deleted from the list.\n\tk = 0\n\twhile k == 0\n\t\t# Loops until the user enters a valid date.\n\t\ti = 0\n\t\twhile i == 0\n\t\t\t# Receives the date from the user.\n\t\t\tprint \"Date of event (format \\\"yyyy-mm-dd\\\"): \"\n\t\t\tdate = gets.chomp\n\t\t\t# Splits the date into its components and checks to make sure they are numbers that make sense for dates.\n\t\t\tdateSplit = date.split(\"-\")\n\t\t\tif dateSplit[0].to_i > 9999 or dateSplit[1].to_i > 12 or dateSplit[2].to_i > 31\n\t\t\t\tputs \"Please enter a valid event date.\"\n\t\t\telse\n\t\t\t\t# The date is valid, exit the nested loop.\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\tend\n\n\t\tindex = 0\n\t\t# Creates a temporary list of Schedule objects that is a copy of the schedule list.\n\t\tscheduleTemp = schedule.map(&:clone)\n\t\t# Loops through each Schedule object and checks each date in its individual components.\n\t\tschedule.each do |scheduleObj|\n\t\t\tscheduleSplit = (scheduleObj.date).split(\"-\")\n\t\t\tif scheduleSplit[0].to_i != dateSplit[0].to_i or scheduleSplit[1].to_i < dateSplit[1].to_i or scheduleSplit[2].to_i < dateSplit[2].to_i\n\t\t\t\t# Delete a date in the temporary list that comes before the entered date (user cannot book events that happened in the past).\n\t\t\t\tscheduleTemp.delete_at(index)\n\t\t\t\tindex = index - 1\n\t\t\tend\n\t\t\tindex = index + 1\n\t\tend\n\t\tif scheduleTemp.length == 0\n\t\t\t# All the values in the temporary list were deleted, so the date entered clearly isn't valid.\n\t\t\tputs \"Please enter a valid date.\"\n\t\telse\n\t\t\tk = k + 1\n\t\tend\n\tend \n\t# Return the temporary list as the new list.\n\treturn scheduleTemp\nend", "title": "" }, { "docid": "0c47365f3b225da933659a88d50b51fe", "score": "0.57035017", "text": "def fetch_time_entries\n self.time_entries = { }\n fetch_time_entries_by_project\n end", "title": "" }, { "docid": "c5e8bab2e9fa52f3d5f83391b41fea61", "score": "0.5691556", "text": "def incomplete_due_today\n incomplete_due_today = []\n all_incomplete.each do |task|\n if (task.class == DueDateTask || task.class == Anniversary) && (task.due_date == Date.today)\n incomplete_due_today << task\n end\n end\n incomplete_due_today\n end", "title": "" }, { "docid": "ec45d6f4947a927bd45b78a863e1e148", "score": "0.5658095", "text": "def remove_past_items!\n @items = @items.reject do |item|\n item.more_advanced_date <= Time.now\n end\n end", "title": "" }, { "docid": "a7d3bee3785596e250a595835fcce742", "score": "0.5649531", "text": "def schedule\n oauth = @oauth\n\n old_entry_id = nil\n if oauth.entries.size > 1 && oauth.latest_post.present?\n old_entry_id = oauth.latest_post.entry_id\n end\n\n ran = 0\n if oauth.latest_post.present?\n latest_entry = Entry.find(oauth.latest_post.entry_id)\n if latest_entry.present?\n ran = latest_entry.ran\n end\n end\n if Entry.where( :oauth_id=>oauth.id, :publish=>true, :post_hour=>nil, :post_min=>nil).where(\"ran > #{ran}\").where.not(:id=>old_entry_id).count == 0\n if oauth.random == true\n else\n ran = 0\n end\n end\n\n order_str = \"ran ASC\"\n #@entries = Entry.where( :oauth_id=>oauth.id, :publish=>true, :post_hour=>nil, :post_min=>nil).where(\"ran >= #{ran}\").where.not(:id=>old_entry_id).order(order_str).page(params[:page])\n\n now = DateTime.now\n now_date = Date.today\n time = oauth.next_time(now.hour, (now.min / 10).floor * 10, now_date.wday)\n p time\n hour = time[0]\n min = time[1]\n wday = time[2]\n\n @schedule_hour = hour\n @schedule_min = min\n @schedule_wday = wday\n\n @entries = []\n @entry_times = []\n if oauth.has_time\n for i in 0..24\n if Entry.where(:oauth_id=>oauth.id, :publish=>true, :post_hour=>hour, :post_min=>min).where.not(:id=>old_entry_id).count > 0\n entry = Entry.where(:oauth_id=>oauth.id, :publish=>true, :post_hour=>hour, :post_min=>min).where.not(:id=>old_entry_id).order(order_str).first\n else\n entry = Entry.where( :oauth_id=>oauth.id, :publish=>true, :post_hour=>nil, :post_min=>nil).where(\"ran > #{ran}\").where.not(:id=>old_entry_id).order(order_str).first\n if entry.present?\n ran = entry.ran\n end\n end\n\n p \"#{hour}:::::::#{min}:::::::#{ran}\"\n if entry.present?\n p \"#{hour}--------#{min}\"\n old_entry_id = entry.id\n @entries.push entry\n @entry_times.push [hour, min, wday]\n end\n\n if Entry.where( :oauth_id=>oauth.id, :publish=>true, :post_hour=>nil, :post_min=>nil).where(\"ran > #{ran}\").where.not(:id=>old_entry_id).count == 0\n if oauth.random == true\n break\n else\n ran = 0\n end\n end\n time = oauth.next_time(hour, min, wday)\n hour = time[0]\n min = time[1]\n wday = time[2]\n=begin\n min += oauth.span_min\n if min >= 60\n hour = hour + (min / 60).round\n min = min % 60\n end\n hour = hour % 24\n=end\n end\n p @entry_times\n end\n\n @timer_entries = Entry.where( :oauth_id=>oauth.id, :publish=>true).where.not(:post_hour=>nil, :post_min=>nil).order(order_str)\n\n\n\n\n end", "title": "" }, { "docid": "1aeee4bf1acfc25c53185a95e9819a6a", "score": "0.5633518", "text": "def read_scheduled_kill_specs\n while kill_spec = @kill_spec_queue.pop(true)\n if @active_cursor_ids.include?(kill_spec.cursor_id)\n @to_kill[kill_spec.server_address] ||= Set.new\n @to_kill[kill_spec.server_address] << kill_spec\n end\n end\n rescue ThreadError\n # Empty queue, nothing to do.\n end", "title": "" }, { "docid": "ccc45ba41804d6f0950a40600d62cd56", "score": "0.56270826", "text": "def this_week\n @tasks = []\n @all_tasks.each do |task|\n @tasks << task if task.due_date > Time.now && task.due_date < Time.now+7.days\n end\n end", "title": "" }, { "docid": "94a6980f3c7d2e519f597d41c09c9646", "score": "0.56113756", "text": "def incomplete_without_due_date\n incomplete_no_due_date = []\n @task_list.each do |task|\n if (!task.done? && task.class == Task)\n incomplete_no_due_date << task\n end\n end\n incomplete_no_due_date\n end", "title": "" }, { "docid": "9269ee92c6d941bc3dc0e2b36d1a5f1d", "score": "0.5606797", "text": "def run_schedule\n scheduler = Scheduler.new(@user, @task)\n results = scheduler.schedule\n #results[0] = week, [1] = couldnt schedule, [2] = past_due\n update_tasks(results[0])\n end", "title": "" }, { "docid": "453d1bd33110084e4270bf802bfb1ad0", "score": "0.5593488", "text": "def handle_past_orders\n remove_all_empty_orders\n remove_timeout_orders\n end", "title": "" }, { "docid": "fc69a0630077063151db8629801cdee7", "score": "0.55790204", "text": "def reschedule_following_issues\n if start_date_changed? || due_date_changed?\n relations_from.each do |relation|\n relation.set_issue_to_dates\n end\n end\n end", "title": "" }, { "docid": "fc69a0630077063151db8629801cdee7", "score": "0.55790204", "text": "def reschedule_following_issues\n if start_date_changed? || due_date_changed?\n relations_from.each do |relation|\n relation.set_issue_to_dates\n end\n end\n end", "title": "" }, { "docid": "9d13ce3209c62ebd4c547ed52cb0f2e4", "score": "0.55733794", "text": "def this_weeks_schedule\r\n schedule = []\r\n [0,1,2,3,4,5,6].each do |i|\r\n schedule << self.get_schedule(Date.today + i.days)\r\n end\r\n schedule\r\n end", "title": "" }, { "docid": "503a91a36ff7104032575e9928fff644", "score": "0.5542065", "text": "def currently_due_tasks\n assigned_tasks.select{|task| task.currently_due? }\n end", "title": "" }, { "docid": "be185e5b932bac0400075365ea0f05a1", "score": "0.55417746", "text": "def fire_hire_cycle\n dice = rand(1..6)\n puts \"#{ dice } people will be fired at this three month interval, due to the dice roll...\"\n dice.times do\n person_fired = @people_working.pop\n puts \"person ##{ person_fired } is fired\"\n @people_waiting.enqueue(person_fired)\n end\n dice.times do\n person_hired = @people_waiting.dequeue\n puts \"person ##{ person_hired } is hired\"\n @people_working.push(person_hired)\n end\n puts \"These six people are working for the next three months...\"\n puts @people_working\n puts \"And these people are on the waiting list, in this order, beginning with those who will be the first hired...\"\n puts @people_waiting\n end", "title": "" }, { "docid": "cf0bd903ce83850c843e45f032d1d125", "score": "0.5530264", "text": "def flag_for_pickup \n self.one_week_schedule = 0 #Start clean\n 0.upto(7) do |idx|\n if (start_dt_tm.to_date <= Time.zone.now.to_date + idx) && (end_dt_tm.to_date >= Time.zone.now.to_date + idx)\n if Schedulehelper.IsEntryDueOn(self, Time.zone.now.to_date + idx)\n self.one_week_schedule |= (1 << idx) \n end\n end\n end\n end", "title": "" }, { "docid": "eb9207c8beb559b4dd3870347a636f41", "score": "0.55269206", "text": "def check_for_previous_planned_runs\n\t\tself.runs.return_past_uncompleted_runs_except_for_current_month.destroy_all\n\tend", "title": "" }, { "docid": "cddf2fd5d7e9e921ea1c67f43e241f38", "score": "0.55208284", "text": "def unschedule_unfit_events\n unfit_schedules = event_schedules.select do |event_schedule|\n event_schedule.start_time.min % schedule_interval > 0\n end\n EventSchedule.where(id: unfit_schedules.map(&:id)).destroy_all\n end", "title": "" }, { "docid": "cb9c474d84dd6fd90d0fe90ef765c9a4", "score": "0.5517217", "text": "def due_list\n @list.each { |x|\n if x.type == \"task\"\n new_date = x.due_date\n else\n new_date = x.recuring_date + \"/\"+Date.today.year.to_s[-2..-1]\n end\n # puts x.recuring_date, new_date\n if x.complete == false && Date.strptime(new_date, \"%m/%d/%y\") >= Date.today\n p a=x.each{|x| x.due_date=new_date}\n end\n }\n end", "title": "" }, { "docid": "85525c55d0a9e491f689316c7e122c35", "score": "0.55085915", "text": "def overdue_tasks\n\t\tself.tasks.where('is_completed = ? AND due_date > ?', false, Date.today)\n\tend", "title": "" }, { "docid": "ffe1c163f9564e135fd1c4db7d3a6f52", "score": "0.55044085", "text": "def gen_schedule\n @ih_calendar = [\"P2 (2017-11-16T15:45:00+00:00)\", \"SEC (2017-11-16T17:15:00+00:00)\", \"BRK (2017-11-16T17:25:00+00:00)\", \"P4 (2017-11-16T17:45:00+00:00)\", \"ACT (2017-11-16T19:15:00+00:00)\", \"LUN (2017-11-16T20:05:00+00:00)\", \"P6 (2017-11-16T20:50:00+00:00)\", \"P1 (2017-11-17T15:45:00+00:00)\", \"BRK (2017-11-17T17:10:00+00:00)\", \"P5 (2017-11-17T17:30:00+00:00)\", \"LUN (2017-11-17T18:55:00+00:00)\", \"P7 (2017-11-17T19:40:00+00:00)\", \"BRK (2017-11-17T21:05:00+00:00)\", \"P3 (2017-11-17T21:20:00+00:00)\", \"P2 (2017-11-27T15:45:00+00:00)\", \"SEC (2017-11-27T17:15:00+00:00)\", \"BRK (2017-11-27T17:25:00+00:00)\", \"P6 (2017-11-27T17:45:00+00:00)\", \"LUN (2017-11-27T19:10:00+00:00)\", \"P4 (2017-11-27T19:55:00+00:00)\", \"P1 (2017-11-28T15:45:00+00:00)\", \"BRK (2017-11-28T17:10:00+00:00)\", \"P7 (2017-11-28T17:30:00+00:00)\", \"LUN (2017-11-28T18:55:00+00:00)\", \"P3 (2017-11-28T19:40:00+00:00)\", \"BRK (2017-11-28T21:05:00+00:00)\", \"P5 (2017-11-28T21:20:00+00:00)\", \"P2 (2017-11-29T15:45:00+00:00)\", \"SEC (2017-11-29T17:15:00+00:00)\", \"BRK (2017-11-29T17:25:00+00:00)\", \"P4 (2017-11-29T17:45:00+00:00)\", \"ACT (2017-11-29T19:15:00+00:00)\", \"LUN (2017-11-29T20:05:00+00:00)\", \"P6 (2017-11-29T20:50:00+00:00)\", \"P1 (2017-11-30T15:45:00+00:00)\", \"BRK (2017-11-30T17:10:00+00:00)\", \"P3 (2017-11-30T17:30:00+00:00)\", \"LUN (2017-11-30T18:55:00+00:00)\", \"P5 (2017-11-30T19:40:00+00:00)\", \"BRK (2017-11-30T21:05:00+00:00)\", \"P7 (2017-11-30T21:20:00+00:00)\", \"P2 (2017-12-01T15:45:00+00:00)\", \"SEC (2017-12-01T17:15:00+00:00)\", \"BRK (2017-12-01T17:25:00+00:00)\", \"P6 (2017-12-01T17:45:00+00:00)\", \"ACT (2017-12-01T19:15:00+00:00)\", \"LUN (2017-12-01T20:05:00+00:00)\", \"P4 (2017-12-01T20:50:00+00:00)\", \"P1 (2017-12-05T15:45:00+00:00)\", \"BRK (2017-12-05T17:10:00+00:00)\", \"P5 (2017-12-05T17:30:00+00:00)\", \"LUN (2017-12-05T18:55:00+00:00)\", \"P7 (2017-12-05T19:40:00+00:00)\", \"BRK (2017-12-05T21:05:00+00:00)\", \"P3 (2017-12-05T21:20:00+00:00)\", \"P2 (2017-12-06T15:45:00+00:00)\", \"SEC (2017-12-06T17:15:00+00:00)\", \"BRK (2017-12-06T17:25:00+00:00)\", \"P4 (2017-12-06T17:45:00+00:00)\", \"ACT (2017-12-06T19:15:00+00:00)\", \"LUN (2017-12-06T20:05:00+00:00)\", \"P6 (2017-12-06T20:50:00+00:00)\", \"P1 (2017-12-07T15:45:00+00:00)\", \"BRK (2017-12-07T17:10:00+00:00)\", \"P7 (2017-12-07T17:30:00+00:00)\", \"LUN (2017-12-07T18:55:00+00:00)\", \"P3 (2017-12-07T19:40:00+00:00)\", \"BRK (2017-12-07T21:05:00+00:00)\", \"P5 (2017-12-07T21:20:00+00:00)\", \"P2 (2017-12-08T15:45:00+00:00)\", \"SEC (2017-12-08T17:15:00+00:00)\", \"BRK (2017-12-08T17:25:00+00:00)\", \"P6 (2017-12-08T17:45:00+00:00)\", \"ACT (2017-12-08T19:15:00+00:00)\", \"LUN (2017-12-08T20:05:00+00:00)\", \"P4 (2017-12-08T20:50:00+00:00)\", \"P1 (2017-12-11T15:45:00+00:00)\", \"BRK (2017-12-11T17:10:00+00:00)\", \"P3 (2017-12-11T17:30:00+00:00)\", \"LUN (2017-12-11T18:55:00+00:00)\", \"BRK (2017-12-11T21:05:00+00:00)\", \"P7 (2017-12-11T21:20:00+00:00)\", \"P2 (2017-12-12T15:45:00+00:00)\", \"SEC (2017-12-12T17:15:00+00:00)\", \"BRK (2017-12-12T17:25:00+00:00)\", \"P4 (2017-12-12T17:45:00+00:00)\", \"ACT (2017-12-12T19:15:00+00:00)\", \"LUN (2017-12-12T20:05:00+00:00)\", \"P6 (2017-12-12T20:50:00+00:00)\", \"P1 (2017-12-13T15:45:00+00:00)\", \"BRK (2017-12-13T17:10:00+00:00)\", \"P5 (2017-12-13T17:30:00+00:00)\", \"LUN (2017-12-13T18:55:00+00:00)\", \"P7 (2017-12-13T19:40:00+00:00)\", \"BRK (2017-12-13T21:05:00+00:00)\", \"P3 (2017-12-13T21:20:00+00:00)\", \"P2 (2017-12-14T15:45:00+00:00)\", \"SEC (2017-12-14T17:15:00+00:00)\", \"BRK (2017-12-14T17:25:00+00:00)\", \"P6 (2017-12-14T17:45:00+00:00)\", \"ACT (2017-12-14T19:15:00+00:00)\", \"LUN (2017-12-14T20:05:00+00:00)\", \"P4 (2017-12-14T20:50:00+00:00)\", \"SEC (2017-12-15T15:45:00+00:00)\", \"ACT (2017-12-15T16:05:00+00:00)\", \"P1 (2018-01-03T15:45:00+00:00)\", \"BRK (2018-01-03T17:10:00+00:00)\", \"P7 (2018-01-03T17:30:00+00:00)\", \"LUN (2018-01-03T18:55:00+00:00)\", \"P3 (2018-01-03T19:40:00+00:00)\", \"BRK (2018-01-03T21:05:00+00:00)\", \"P5 (2018-01-03T21:20:00+00:00)\", \"P2 (2018-01-04T15:45:00+00:00)\", \"SEC (2018-01-04T17:15:00+00:00)\", \"BRK (2018-01-04T17:25:00+00:00)\", \"P4 (2018-01-04T17:45:00+00:00)\", \"ACT (2018-01-04T19:15:00+00:00)\", \"LUN (2018-01-04T20:05:00+00:00)\", \"P6 (2018-01-04T20:50:00+00:00)\", \"P1 (2018-01-05T15:45:00+00:00)\", \"BRK (2018-01-05T17:10:00+00:00)\", \"P3 (2018-01-05T17:30:00+00:00)\", \"LUN (2018-01-05T18:55:00+00:00)\", \"P5 (2018-01-05T19:40:00+00:00)\", \"BRK (2018-01-05T21:05:00+00:00)\", \"P7 (2018-01-05T21:20:00+00:00)\", \"P2 (2018-01-08T15:45:00+00:00)\", \"SEC (2018-01-08T17:15:00+00:00)\", \"BRK (2018-01-08T17:25:00+00:00)\", \"P6 (2018-01-08T17:45:00+00:00)\", \"ACT (2018-01-08T19:15:00+00:00)\", \"LUN (2018-01-08T20:05:00+00:00)\", \"P4 (2018-01-08T20:50:00+00:00)\", \"P1 (2018-01-09T15:45:00+00:00)\", \"BRK (2018-01-09T17:10:00+00:00)\", \"P5 (2018-01-09T17:30:00+00:00)\", \"LUN (2018-01-09T18:55:00+00:00)\", \"P7 (2018-01-09T19:40:00+00:00)\", \"BRK (2018-01-09T21:05:00+00:00)\", \"P3 (2018-01-09T21:20:00+00:00)\", \"P2 (2018-01-10T15:45:00+00:00)\", \"SEC (2018-01-10T17:15:00+00:00)\", \"BRK (2018-01-10T17:25:00+00:00)\", \"P4 (2018-01-10T17:45:00+00:00)\", \"LUN (2018-01-10T19:10:00+00:00)\", \"P6 (2018-01-10T19:55:00+00:00)\", \"P1 (2018-01-11T15:45:00+00:00)\", \"BRK (2018-01-11T17:10:00+00:00)\", \"LUN (2018-01-11T18:55:00+00:00)\", \"P3 (2018-01-11T19:40:00+00:00)\", \"BRK (2018-01-11T21:05:00+00:00)\", \"P5 (2018-01-11T21:20:00+00:00)\", \"P2 (2018-01-12T15:45:00+00:00)\", \"BRK (2018-01-12T17:10:00+00:00)\", \"SEC (2018-01-12T17:15:00+00:00)\", \"BRK (2018-01-12T17:25:00+00:00)\", \"P3 (2018-01-12T17:30:00+00:00)\", \"P6 (2018-01-12T17:45:00+00:00)\", \"LUN (2018-01-12T19:10:00+00:00)\", \"P4 (2018-01-12T19:55:00+00:00)\", \"P1 (2018-01-16T15:45:00+00:00)\", \"BRK (2018-01-16T17:10:00+00:00)\", \"P3 (2018-01-16T17:30:00+00:00)\", \"LUN (2018-01-16T18:55:00+00:00)\", \"P5 (2018-01-16T19:40:00+00:00)\", \"BRK (2018-01-16T21:05:00+00:00)\", \"P7 (2018-01-16T21:20:00+00:00)\", \"P2 (2018-01-17T15:45:00+00:00)\", \"SEC (2018-01-17T17:15:00+00:00)\", \"BRK (2018-01-17T17:25:00+00:00)\", \"P4 (2018-01-17T17:45:00+00:00)\", \"LUN (2018-01-17T19:10:00+00:00)\", \"P6 (2018-01-17T19:55:00+00:00)\", \"P1 (2018-01-18T15:45:00+00:00)\", \"BRK (2018-01-18T17:10:00+00:00)\", \"P5 (2018-01-18T17:30:00+00:00)\", \"LUN (2018-01-18T18:55:00+00:00)\", \"P7 (2018-01-18T19:40:00+00:00)\", \"BRK (2018-01-18T21:05:00+00:00)\", \"P3 (2018-01-18T21:20:00+00:00)\", \"P1 (2018-01-24T15:45:00+00:00)\", \"BRK (2018-01-24T17:10:00+00:00)\", \"P3 (2018-01-24T17:30:00+00:00)\", \"LUN (2018-01-24T18:55:00+00:00)\", \"P5 (2018-01-24T19:40:00+00:00)\", \"BRK (2018-01-24T21:05:00+00:00)\", \"P7 (2018-01-24T21:20:00+00:00)\", \"P2 (2018-01-25T15:45:00+00:00)\", \"SEC (2018-01-25T17:15:00+00:00)\", \"BRK (2018-01-25T17:25:00+00:00)\", \"P4 (2018-01-25T17:45:00+00:00)\", \"ACT (2018-01-25T19:15:00+00:00)\", \"LUN (2018-01-25T20:05:00+00:00)\", \"P6 (2018-01-25T20:50:00+00:00)\", \"P1 (2018-01-26T15:46:00+00:00)\", \"BRK (2018-01-26T17:10:00+00:00)\", \"P5 (2018-01-26T17:30:00+00:00)\", \"LUN (2018-01-26T18:55:00+00:00)\", \"P7 (2018-01-26T19:40:00+00:00)\", \"BRK (2018-01-26T21:05:00+00:00)\", \"P3 (2018-01-26T21:20:00+00:00)\", \"P2 (2018-01-29T15:45:00+00:00)\", \"SEC (2018-01-29T17:15:00+00:00)\", \"BRK (2018-01-29T17:25:00+00:00)\", \"P6 (2018-01-29T17:45:00+00:00)\", \"ACT (2018-01-29T19:15:00+00:00)\", \"LUN (2018-01-29T20:05:00+00:00)\", \"P4 (2018-01-29T20:50:00+00:00)\", \"P1 (2018-01-30T15:45:00+00:00)\", \"BRK (2018-01-30T17:10:00+00:00)\", \"P7 (2018-01-30T17:30:00+00:00)\", \"LUN (2018-01-30T18:55:00+00:00)\", \"P3 (2018-01-30T19:40:00+00:00)\", \"BRK (2018-01-30T21:05:00+00:00)\", \"P5 (2018-01-30T21:20:00+00:00)\", \"P2 (2018-01-31T15:45:00+00:00)\", \"SEC (2018-01-31T17:15:00+00:00)\", \"BRK (2018-01-31T17:25:00+00:00)\", \"P4 (2018-01-31T17:45:00+00:00)\", \"ACT (2018-01-31T19:15:00+00:00)\", \"LUN (2018-01-31T20:05:00+00:00)\", \"P6 (2018-01-31T20:50:00+00:00)\", \"P1 (2018-02-01T15:45:00+00:00)\", \"BRK (2018-02-01T17:10:00+00:00)\", \"P3 (2018-02-01T17:30:00+00:00)\", \"LUN (2018-02-01T18:55:00+00:00)\", \"P5 (2018-02-01T19:40:00+00:00)\", \"BRK (2018-02-01T21:05:00+00:00)\", \"P7 (2018-02-01T21:20:00+00:00)\", \"P2 (2018-02-02T15:45:00+00:00)\", \"P6 (2018-02-02T16:50:00+00:00)\", \"BRK (2018-02-02T17:50:00+00:00)\", \"P4 (2018-02-02T18:10:00+00:00)\", \"ACT (2018-02-02T19:10:00+00:00)\", \"SEC (2018-06-04T14:45:00+00:00)\", \"ACT (2018-06-04T15:05:00+00:00)\"]\n @schedule = [] #here is an empty array \n \n @ih_calendar.each do |event|\n #event_array gets replaced with each new event - how do we save it? \n event_item = event.split(' ') #breaks the string into a 2 item array\n event_item[1] = event_item[1].slice(6..10) #deleting the extra information in that string\n # add event_item to schedule \n @schedule.push(event_item)\n # p event_item\n end\nend", "title": "" }, { "docid": "9fb2c6a5cbf76f0f56d3e8e4cb7a4232", "score": "0.54882884", "text": "def lawyer_upcoming_matter_tasks\n euid = get_employee_user_id\n upcoming_tasks = []\n matters ||= Matter.team_matters(euid, get_company_id)\n matters.each {|e| upcoming_tasks << e.upcoming_tasks(e.employee_matter_people_id(euid))}\n return upcoming_tasks.flatten\n end", "title": "" }, { "docid": "3b39ff55433c8c81e56163f47a7dc75a", "score": "0.54768646", "text": "def notify_upcoming\n current_time = Time.now\n\n FutureCriticalPeriod.where(:'notifications.time'.lte => current_time).all.each do |period|\n unless period.user.nil?\n @methods.each { |method| method.send_notification(period) }\n end\n\n period.notifications.all.each do |notification|\n notification.delete if notification.time <= current_time\n end\n end\n end", "title": "" }, { "docid": "21a9c5be81890aa5341a01950c8120d7", "score": "0.5459684", "text": "def expired_tasks\r\n\r\n tasks.select {|t| t.finish_time < Time.now }\r\n\r\n end", "title": "" }, { "docid": "cedd212bde62f5d5c4b0810573e377aa", "score": "0.5459053", "text": "def overdue_tasks(matter_people_id = nil)\n today = Time.zone.now.to_date\n self.matter_tasks.open_tasks.assigned_tasks(matter_people_id).overdue(today)\n end", "title": "" }, { "docid": "d3ca220bbb16e5e416312255580070de", "score": "0.54575616", "text": "def push_break_in_schedule(schedule, breaks, time)\n\t\twhile breaks and breaks.length > 0 and breaks[0][:time] < time do\n\t\t\tschedule.push breaks.pop\n\t\tend\n\tend", "title": "" }, { "docid": "8a7e2bb80d628b7aa484c62544c42337", "score": "0.54501927", "text": "def scheduled\n response = get 'scheduled'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "8a7e2bb80d628b7aa484c62544c42337", "score": "0.54501927", "text": "def scheduled\n response = get 'scheduled'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "a6c5cd0cd53e8221f596c92ead1b5c4a", "score": "0.54490346", "text": "def getStartTime (schedule)\n\t# Loops until there's a valid time given and the data preceeding the start time is deleted from the list.\n\tk = 0\n\twhile k == 0\n\t\t# Loops until the user enters a valid date.\n\t\ti = 0\n\t\twhile i == 0\n\t\t\t# Receives the time from the user.\n\t\t\tprint \"Start time of the event (format \\\"hh:mm AM/PM\\\"): \"\n\t\t\ttime = gets.chomp\n\t\t\t# Splits the time into its components and checks to make they are numbers that make sense for time.\n\t\t\ttimeSplit = time.split(/\\W+/)\n\t\t\tif timeSplit[0].to_i > 12 or timeSplit[1].to_i > 59 or (timeSplit[2] != \"AM\" and timeSplit[2] != \"PM\")\n\t\t\t\tputs \"Please enter a valid start time.\"\n\t\t\telse\n\t\t\t\t# The time is valid, exit the nested loop.\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\tend\n\t\tindex = 0\n\t\t# Creates a temporary list of Schedule objects that is a copy of the schedule list.\n\t\tscheduleTemp = schedule.map(&:clone)\n\t\t# Loops through each Schedule object and checks each time in its individual components.\n\t\tschedule.each do |scheduleObj|\n\t\t\tscheduleSplit = (scheduleObj.time).split(/\\W+/)\n\t\t\tif scheduleObj.date == schedule[0].date and ((scheduleSplit[0].to_i < timeSplit[0].to_i and scheduleSplit[2] == timeSplit[2]) or (timeSplit[0].to_i == scheduleSplit[0].to_i and timeSplit[1].to_i > 0 and timeSplit[2] == scheduleSplit[2]) or (scheduleSplit[0] == \"12\" and timeSplit[0].to_i > 1 and scheduleSplit[2] == timeSplit[2]) or (scheduleSplit[2] == \"AM\" and timeSplit[2] == \"PM\"))\n\t\t\t\tif timeSplit[0] != \"12\" or (timeSplit[2] == \"PM\" and scheduleSplit[2] == \"AM\")\n\t\t\t\t\t# Delete a time in the temporary list that comes before the entered time (user cannot book events that happened in the past).\n\t\t\t\t\tscheduleTemp.delete_at(index)\n\t\t\t\t\tindex = index - 1\n\t\t\t\telse\n\t\t\t\t\tif scheduleSplit[0] == \"12\"\n\t\t\t\t\t\t# Delete a time in the temporary list that comes before the entered time (user cannot book events that happened in the past).\n\t\t\t\t\t\tscheduleTemp.delete_at(index)\n\t\t\t\t\t\tindex = index - 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tindex = index + 1\n\t\tend\n\t\tif scheduleTemp.length == 0\n\t\t\t# All the values in the temporary list were deleted, so the date entered clearly isn't valid.\n\t\t\tputs \"Please enter a valid time.\"\n\t\telse\n\t\t\tk = k + 1\n\t\tend\n\tend\n\t# Returns the temporary list as the new list.\n\treturn scheduleTemp\nend", "title": "" }, { "docid": "987a94ec22836dfb9a359504b8621442", "score": "0.5437681", "text": "def schedule\n @jobs = []\n @current_week = Time.now\n\n until @current_week.strftime('%A') == 'Sunday' do\n @current_week = @current_week.advance(days: -1)\n end\n\n Job.all.order(:datetime).each do |job|\n if job.workers.include?(@user.id)\n if job.datetime > @current_week.at_beginning_of_day() && job.datetime < @current_week.advance(days: 6).at_end_of_day()\n @jobs.push(job)\n end\n end\n end\n\n end", "title": "" }, { "docid": "b92b3b69f565ef12fe08e05e10f1527b", "score": "0.54299146", "text": "def commit_time_entries\n self.time_entries = user.time_entries.not_on_timesheet.on_week(weekof)\n end", "title": "" }, { "docid": "6d42aff1cf5ec5994fe4afe99b819a81", "score": "0.5419156", "text": "def date_tasks_incomp\n date_tasks.select do |task|\n if !task.done?\n date_tasks_incomp << task\n end\n end\n\n end", "title": "" }, { "docid": "57731c031cf64ef7b476abf7fa40aad2", "score": "0.5417559", "text": "def index\n @project = Project.find(params[:project_id])\n @tasks = @project.tasks.where('status = 0').order('created_at DESC')\n \n # @tasks_row = @project.tasks.where('status = 0').order('due')\n # @tasks_row.each do |task|\n # today = Date.today\n # task_date = task.created_at.to_date\n # \n # case task.due\n # when Task::DUE_ASAP\n # when Task::DUE_TODAY\n # if task_date < today\n # task.due = Task::DUE_OVERDUE\n # end\n # when Task::DUE_TOMORROW\n # if task_date + 1 == today\n # task.due = Task::DUE_TODAY\n # elsif task_date + 1 < today\n # task.due = Task::DUE_OVERDUE\n # end\n # when Task::DUE_THISWEEK\n # if today - task_date == 7 - task_date.wday - 2\n # task.due = Task::DUE_TOMORROW\n # elsif today - task_date == 7 - task_date.wday - 1\n # task.due = Task::DUE_TODAY\n # elsif today - task_date >= 7 - task_date.wday\n # task.due = Task::DUE_OVERDUE\n # end\n # when Task::DUE_NEXTWEEK\n # # TODO\n # when Task::DUE_THISMONTH\n # days_in_month = Time.days_in_month(Time.now.month)\n # if today.month != task_date.month\n # task.due = Task::DUE_OVERDUE\n # elsif days_in_month - today.mday == 1\n # task.due = Task::DUE_TOMORROW\n # elsif days_in_month - today.mday == 0\n # task.due = Task::DUE_TODAY\n # # TODO. due_thisweek, due_nextweek\n # end\n # when Task::DUE_NEXTMONTH\n # if (task_date >> 1).month != today.month\n # task.due = Task::DUE_OVERDUE\n # # elsif \n # # task.due = Task::DUE_TOMORROW\n # # elsif\n # # task.due = Task::DUE_TODAY\n # # TODO. due_thisweek, due_nextweek\n # elsif today.month == task_date.month\n # task.due = Task::DUE_THISMONTH\n # end \n # when Task::DUE_THISYEAR\n # # TODO\n # else\n # end\n # end\n # \n # @tasks = @tasks_row.sort_by &:due\n @new_task = Task.new\n# @tasks.sort! { |t| t.due }\n# @tasks = current_user.todos.where('status = 0').order('created_at DESC')\n# @completed = current_user.todos.where('status = 1').order('updated_at DESC')\n # @tasks = Task.where('status = 0').order(\"content\")\n # @completed = Task.where('status = 1').order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "title": "" }, { "docid": "f4c760c364d012cabdf32c77c6fa6d9d", "score": "0.54117703", "text": "def tasks_assigned_today\n todays_tasks = []\n tasks.each do |task|\n todays_tasks << task if task.due_date == Date.today\n end\n todays_tasks\n end", "title": "" }, { "docid": "07e1e7af1441d70da0ce89ee6b2f1194", "score": "0.5411706", "text": "def get_schedules(delta, now)\n\n # TODO : bring that 'optimization' back in,\n # maybe every minute, if min != last_min ...\n\n #if delta < 1.0\n # at = now.strftime('%Y%m%d%H%M%S')\n # get_many('schedules', /-#{at}$/)\n #elsif delta < 60.0\n # at = now.strftime('%Y%m%d%H%M')\n # scheds = get_many('schedules', /-#{at}\\d\\d$/)\n # filter_schedules(scheds, now)\n #else # load all the schedules\n\n scheds = get_many('schedules')\n filter_schedules(scheds, now)\n\n #end\n end", "title": "" }, { "docid": "c5cbc0bd88bb9207cf290e4213784c16", "score": "0.5407766", "text": "def client_tasks_upcoming\n today = Time.zone.now.to_date\n self.client_tasks.find_all {|e| ((e.completed.nil? or !e.completed) or e.category.eql?('appointment')) and (e.end_date && e.end_date > today and e.end_date <= (today + 6.days)) }\n end", "title": "" }, { "docid": "c0884749251e5d5fa8b95dda35e73abd", "score": "0.5405027", "text": "def not_overdue\n FilterableList.new(tasks.clone.keep_if do |t|\n (!t.date || t.date < Date.today) && !t.done\n end)\n end", "title": "" }, { "docid": "8c33cb14a2f74b2cdb9f26760cd70795", "score": "0.5401254", "text": "def all\n tmp = GoodData.get \"/gdc/projects/#{GoodData.project.pid}/schedules\"\n tmp['schedules']['items'].map { |schedule| GoodData::Schedule.new(schedule) }\n end", "title": "" }, { "docid": "215da5ed661c6edef8974daf60a8e1c1", "score": "0.5395245", "text": "def update_schedule\n\t\t\tuser = User.find(params[:id])\n\t\t\tstart = user.events[0].start_date\n\t\t\tday_values = start.split(\"-\")\n\n\t\t\tfirst_day = Date.new(day_values[0].to_i, day_values[1].to_i, day_values[2].to_i)\n\t\t\tuser_queue = get_schedule_list\n\t\t\tcurrent_day = first_day\n\n\t\t\tEvent.delete_all\n\t\t\twhile !user_queue.empty? do \n\t\t\t\tindex = 0\n\t\t\t\tuser = User.find_by(name: user_queue[index])\n\n\t\t\t\tif !day_is_holiday_or_weekend?(current_day) && user.off_day != current_day.to_s\n\t\t\t\t\tuser.events.create(date: current_day, start_date: start)\n\t\t\t\t\tuser_queue.shift\n\t\t\t\tend\n\n\t\t\t\tif !day_is_holiday_or_weekend?(current_day) && user.off_day == current_day.to_s\n\t\t\t\t\twhile user.off_day == current_day.to_s || index >= 40 do\n\t\t\t\t\t\tindex +=1\n\t\t\t\t\t\tuser = User.find_by(name: user_queue[index])\n\t\t\t\t\tend\n\t\t\t\t\tuser.events.create(date: current_day, start_date: start)\n\t\t\t\t\tuser_queue.delete_at(index)\n\t\t\t\tend\n\t\t\t\tcurrent_day = current_day.next\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "a48523078c1110963b14cb1ecb03fcf9", "score": "0.5394416", "text": "def removeFilledSlots(people, scheduleGrid)\n\n # Reset Slots Array.\n slots = Array.new\n # Set up graveyard (Rows that are completely scheduled will go here).\n graveyard = Array.new(scheduleGrid[0].length, 0)\n # Set up counterArray (Going to count how scheduled a row is).\n counterArray = Array.new(scheduleGrid[0].length, 0)\n\n # Count number of scheduled tenters during a specific time.\n scheduleGrid.each do | currentPerson |\n counter = 0\n while counter < currentPerson.length\n if currentPerson[counter].status == \"Scheduled\"\n counterArray[counter] = counterArray[counter] + 1\n end\n counter = counter + 1\n end\n end\n\n # Iterate through every slot.\n i = 0\n while i < scheduleGrid.length\n\n currentPerson = scheduleGrid[i]\n counter = 0\n\n while counter < scheduleGrid[i].length\n\n # Determine how many people are needed.\n isNight = currentPerson[counter].isNight\n phase = currentPerson[counter].phase\n peopleNeeded = Helpers.calculatePeopleNeeded(isNight, phase)\n numPeople = counterArray[counter]\n\n addToSlot = currentPerson[counter].status == \"Available\" || currentPerson[counter].status == \"Somewhat\"\n # Only add in slot if necessary.\n if numPeople < peopleNeeded && addToSlot\n slots.push(currentPerson[counter])\n end\n\n # Update graveyard\n if numPeople >= peopleNeeded\n graveyard[counter] = 1\n end\n\n # Update person freedom\n # if numPeople >= peopleNeeded && currentPerson[counter].status == \"Available\"\n # if isNight\n # people[i].nightFree -= 1\n # else\n # people[i].dayFree -= 1\n # end\n # end\n\n counter = counter + 1\n\n end\n\n i = i + 1\n\n end\n\n return slots, graveyard, people\n\n end", "title": "" }, { "docid": "b0995adeb3f1f26750e848367e1297af", "score": "0.5394368", "text": "def remove_tasks(date=Time.now.strftime(\"%Y-%m-%d\"), filter={})\n planned = []\n tasks = self.get_tasks(date)\n tasks.each do |task|\n planned << task unless task.matches?(filter)\n end\n (tasks - planned).each do |task|\n if task.options[:follow_up] == date\n task.options[:follow_up] = nil\n end\n if task.options[:due_date] == date\n task.options[:due_date] = nil\n end\n @service.save(task.dir, task)\n end\n save_tasks(planned, true)\n tasks.size - planned.size\n end", "title": "" }, { "docid": "62ed03b0006b6b47b6ac5bf9f1a12e53", "score": "0.5383198", "text": "def upcoming_tasks(matter_people_id = nil)\n today = Time.zone.now.to_date\n custom_days = User.current_lawyer.upcoming.setting_value.to_i\n self.matter_tasks.open_tasks.assigned_tasks(matter_people_id).upcoming(today,custom_days)\n end", "title": "" }, { "docid": "c1e8f6a914a53ab6fa920b1ebe441922", "score": "0.5381393", "text": "def pop(from)\n\tsay(from, @redis.lpop(\"tasks:#{from}\"))\nend", "title": "" }, { "docid": "f81b4285a548a7e9c22018e265d82da2", "score": "0.5374274", "text": "def due_reminders\n # self.reminders.select { |reminder| reminder.is_due? }\n self.reminders.where('datetime < ?', Time.zone.now)\n end", "title": "" }, { "docid": "15f3c98544bee9316eb7f98904f6cfac", "score": "0.53619426", "text": "def not_completed_all\n not_completed_date_order\n not_completed\n puts @not_completed\n @not_completed.each do |each_task|\n @not_completed_date << each_task\n end\n @not_completed_date\n end", "title": "" }, { "docid": "4433a23c79978429213ee206b770a83e", "score": "0.5360962", "text": "def process_schedules\n\n now = Time.now.utc\n delta = now - @last_time\n\n return if delta < 0.8\n #\n # consider schedules at most twice per second (don't do that job\n # too often)\n\n @last_time = now\n\n @storage.get_schedules(delta, now).each { |s| turn_schedule_to_msg(s) }\n end", "title": "" }, { "docid": "08a74c70fc7a9a79dd55bea3c63b0034", "score": "0.535902", "text": "def schedule_upcoming_notification\n\t\t# queue = Sidekiq::ScheduledSet.new\n\t\t# queue.each do | job |\n\t\t# \tif job.klass == 'NotificationWorker' && job.args.size == 4 && job.args[0] == self.id && job.args[2] == 'Notifications::ContractNotification' && job.args[3] == 'upcoming'\n\t\t# \t\tjob.delete\n\t\t# \tend\n\t\t# end\n\n\n\t\t# # since we're going to notify 2 hours in advance, don't schedule a notification if\n\t\t# # the contract is going to start within 2 hours\n\t\t# return if start_date_time < DateTime.now + 2.hours\n #\n\t\t# should_send = if contract? || bounty?\n\t\t# \t!self.is_cancelled?\n\t\t# elsif roster?\n\t\t# \tr = Roster.find self.id\n\t\t# \tr.confirmed_users.count > 0\n\t\t# else\n\t\t# \tfalse\n\t\t# end\n\t\t# if should_send\n\t\t# \tNotificationWorker.perform_at(self.start_date_time - 2.hours, self.id, 'Contract', 'Notifications::ContractNotification', 'upcoming')\n\t\t# end\n\tend", "title": "" }, { "docid": "3a21a826be1b4a7fc9e376e188c772b7", "score": "0.53531563", "text": "def mark_entries_for_removal\n time_entries.each do |entry|\n entry.mark_for_destruction if entry.hours_spent <= 0\n end\n end", "title": "" }, { "docid": "71fb6a93d799c93ddb15687712b42566", "score": "0.5349605", "text": "def schedule(people, scheduleGrid)\n scheduleLength = scheduleGrid[0].length\n\n # Remove all availability slots that are already filled in the schedule.\n slots, graveyard, people = removeFilledSlots(people, scheduleGrid)\n\n # Remove all availability slots that are already filled in the schedule.\n while slots.length > 0\n\n # Weight Reset - set all weights to 1.\n slots = Weight.weightReset(slots)\n\n # Weight Balance - prioritize people with fewer scheduled shifts.\n people, slots = Weight.weightBalance(people, slots)\n\n # Weight Contiguous - prioritize people to stay in the tent more time at once.\n slots, scheduleGrid = Weight.weightContiguous(slots, scheduleGrid)\n\n # Weight Tough Time - prioritize time slots with few people available.\n slots = Weight.weightToughTime(slots, scheduleLength)\n\n # Sort by Weights\n slots.sort! { |a, b| b.weight <=> a.weight }\n # pp slots\n\n # Update people, spreadsheet, and remove slots.\n people, slots, graveyard, scheduleGrid = Weight.weightPick(people, slots, graveyard, scheduleGrid)\n\n end\n\n return processData(people, scheduleGrid)\n\n end", "title": "" }, { "docid": "e3369f6f8c9baaf33796a4fcf3719832", "score": "0.5346292", "text": "def prepare_schedules(first_day, last_day)\n investors_count = first_day.count\n schedules = []\n investors_count.times do |i|\n fday = first_day[i]\n lday = last_day[i]\n offset = (fday - 1)\n days_count = (lday - fday + 1)\n schedules << [offset, days_count]\n end\n schedules.sort_by { |i| [i.last, i.first] }\nend", "title": "" }, { "docid": "a9302c2e70787911471e7062eb33e871", "score": "0.53421766", "text": "def view_list # method to load the list for the user\n @tasks.each do |task, dline| #defines what is what\n index = 0 #set up for the loop below\n while index < @tasks.length\n puts \"Task: #{task}, Deadline: #{dline}\" #outputting schedule\n index += 1 #increasing index to stop loop\n end\n end\nend", "title": "" }, { "docid": "dc6adb68647287ff4146efc2fc6ee21a", "score": "0.53405184", "text": "def empty_hours\n\t\twhile @hours.length > 0\n\t\t\[email protected](@hours.pop)\n\t\tend\n\tend", "title": "" }, { "docid": "8354e3975221d792a8e69a721a71d1d5", "score": "0.53375673", "text": "def unscheduled?; end", "title": "" }, { "docid": "8354e3975221d792a8e69a721a71d1d5", "score": "0.53375673", "text": "def unscheduled?; end", "title": "" }, { "docid": "9f0d2edc1e7a08b25471d695b24dace6", "score": "0.5334721", "text": "def remove_existing_tasks *names\n Winever::WheneverInterface.remove_existing_tasks *names\n end", "title": "" }, { "docid": "abbe3ed87bbbe4900f21d85ccef6ff70", "score": "0.5333108", "text": "def printNotDone\n @toDoDueListArray = @toDoDueListArray.sort_by do |d|\n d.date\n end\n sortDueList = \"\"\n @toDoDueListArray.each do |e|\n if !e.status\n sortDueList = sortDueList + e.print + \" \"\n end\n end\n sortDueList.rstrip\n end", "title": "" }, { "docid": "f98ad437e3f2be57a07a39d08934a2bd", "score": "0.53305686", "text": "def date_tasks_incompdue\n date_tasks.select do |task|\n if !task.done? && (task.duedate.to_s == Date.today.to_s)\n date_tasks_incompdue << task\n end\n end\n end", "title": "" }, { "docid": "c80f1404726791b236939bdb45acf717", "score": "0.5323127", "text": "def deliver!(places: [], foods: nil)\n\n stop_delivering_to = delivery_places.where.not(place_id: places)\n if stop_delivering_to.count > 0\n raise ArgumentError, \"Cannot stop delivering to #{stop_delivering_to.first.place.name} until your shift ends.\"\n end\n\n if halt? && places.count != delivery_places.count\n raise ArgumentError, \"Your shift is about to end! Can't deliver to more places until the next shift.\"\n end\n\n if foods.blank?\n foods = seller.foods.visible.active.pluck(:id)\n end\n\n sellable_foods = SellableFood.where(id: foods | Food.where(id: foods).pluck(:id))\n sellable_foods.each do |food|\n i = foods.index(food.id)\n foods[i] = food.versions\n .where(\"end_date > ?\", DateTime.now)\n .where(state: [ Food.states[:active], Food.states[:halted] ])\n .order(\"end_date ASC\")\n .first\n .id\n end\n\n if foods.blank?\n raise ArgumentError, \"A run hasn't been scheduled - please contact [email protected] for assistance\"\n end\n\n foods.sort!\n\n transaction do\n places.each do |place_id, index|\n\n dp = delivery_places\n .where(\"delivery_places.place_id = ?\", place_id)\n .first\n\n # Is it already \"in sync\"?\n next if dp.present? && dp.foods.pluck(\"foods.id\").sort == foods\n\n dp ||= DeliveryPlace.new(place_id: place_id, shift_id: id)\n dp.state = DeliveryPlace.states[:pending]\n dp.arrives_at = nil\n dp.save!\n\n foods.each do |food_id| \n dp.deliveries.where(food_id: food_id).first_or_create!\n end\n\n end\n end\n\n end", "title": "" }, { "docid": "4a769cb1165d11b9d4ac489c0c7b39b7", "score": "0.5316692", "text": "def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end", "title": "" }, { "docid": "4a769cb1165d11b9d4ac489c0c7b39b7", "score": "0.5316692", "text": "def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end", "title": "" }, { "docid": "7f15ece43bc593531f700028b53a77ce", "score": "0.5315244", "text": "def schedule\n @schedule ||= {}\n end", "title": "" }, { "docid": "408ae590fc2f535e4ff5c30dd3e2cece", "score": "0.5309834", "text": "def main\n advisories = %w(\n 2016:1900\n 2016:1906\n 2016:1907\n 2016:1932\n 2016:1933\n 2016:1934\n 2016:1935\n 2016:1936\n 2016:1937\n 2016:1938\n 2016:1939\n 2016:1940\n 2016:1941\n 2016:1942\n 2016:1943\n 2016:1944\n 2016:1945\n 2016:1946\n 2016:1947\n 2016:1948\n 2016:1949\n 2016:1950\n 2016:1951\n 2016:1952\n 2016:1953\n 2016:1954\n 2016:1955\n 2016:1956\n 2016:1957\n 2016:1958\n 2016:1959\n 2016:1960\n 2016:1961\n 2016:1962\n 2016:1963\n 2016:1964\n 2016:1965\n 2016:1966\n 2016:1967\n 2016:1968\n 2016:1969\n 2016:1970\n 2016:1971\n 2016:1972\n 2016:1973\n 2016:1974\n 2016:1975\n 2016:1976\n 2016:1979\n )\n\n puts \"Number of advisories: #{advisories.length}\"\n errata = advisories.uniq.map { |a| Errata.find_by_advisory(a) }\n\n errata.each do |e|\n puts \"Fixing: ... Advisory #{e.id} #{e.fulladvisory}\"\n failed_jobs = e.push_jobs.\n where(:status => 'POST_PUSH_FAILED').\n where(\"post_push_tasks LIKE '%move_pushed_errata%'\")\n\n failed_jobs.each do |j|\n puts \" ... failed_job #{j.id}\"\n j.status = 'POST_PUSH_PROCESSING'\n j.send(:append_to_log, 'Manual run for ticket #421460')\n j.save!\n\n j.run_post_push_tasks 'move_pushed_errata'\n j.reload\n puts \" status: #{j.status}\"\n end\n end\nend", "title": "" }, { "docid": "630d7e924b0cfa538a565d9729569263", "score": "0.52984345", "text": "def create_ama_hearing_ready_nonpriority_genpop_cases_ready_15_days_ago\n Timecop.travel(95.days.ago)\n 2.times do\n appeal = create(:appeal,\n :hearing_docket,\n :with_post_intake_tasks,\n :held_hearing_and_ready_to_distribute,\n veteran: create_veteran,\n adding_user: User.first)\n tasks = appeal.tasks\n\n tasks.find_by(type: :TranscriptionTask).update!(created_at: 30.days.from_now,\n assigned_at: 30.days.from_now,\n closed_at: 77.days.from_now,\n updated_at: 77.days.from_now)\n\n tasks.find_by(type: :EvidenceSubmissionWindowTask).update!(created_at: 30.days.from_now,\n assigned_at: 30.days.from_now,\n closed_at: 31.days.from_now,\n updated_at: 31.days.from_now)\n\n tasks.find_by(type: :AssignHearingDispositionTask).update!(created_at: Time.zone.now,\n assigned_at: Time.zone.now,\n closed_at: 77.days.from_now,\n updated_at: 77.days.from_now)\n tasks.find_by(type: :HearingTask).update!(closed_at: 77.days.from_now)\n tasks.find_by(type: :DistributionTask).update!(assigned_at: 77.days.from_now)\n end\n Timecop.return\n end", "title": "" }, { "docid": "2693da95ba2c2dfb3d902bb03e3e59c5", "score": "0.529763", "text": "def schedules\n return @schedules\n end", "title": "" }, { "docid": "ff7ce63d853e818e90060bd531cbea2b", "score": "0.5294517", "text": "def scheduled\n end", "title": "" }, { "docid": "c2a4b8b4e0bfbbf6f7d3f77308c32609", "score": "0.5294016", "text": "def archive\n @shifts = Shift.select { |shift| shift.shift_time < Time.now }.sort_by!{ |shift| shift.shift_time }\n end", "title": "" }, { "docid": "f0eb28ca94e68901c719a9d2dfa70e44", "score": "0.5292807", "text": "def reload_schedule!\n @schedule = get_schedules\n end", "title": "" }, { "docid": "13d6d02516fe108be436e44eab7b0ffd", "score": "0.5292352", "text": "def schedule_items\n return @schedule_items\n end", "title": "" }, { "docid": "c8f4fb048c051c892106351db54842e3", "score": "0.5290862", "text": "def make_overDue(book_ids) \n b = @@currentMember.get_books()\n dueTime = (Time.now - (7*24*60*60)) ##################### CHANGE + to - to check overdue\n print b.size\n for iB in (0..(b.size-1))\n if (b[iB].id() == book_ids)\n b[iB].check_out(dueTime) #set book due @@books[iB].get_due_date()\n end \n end\nend", "title": "" }, { "docid": "8d12e67dbd66a3b26a5f348b18eb0f82", "score": "0.52800184", "text": "def employee_turnover(months)\n # Initialize a waiting list as a queue\n waiting_list = Queue.new\n\n # Fill up the queue with 30 people\n 30.times do |i|\n waiting_list.enqueue(\"person_#{i+1}\")\n end\n\n # Initialize an employee list as a stack\n current_employees = Stack.new\n\n months.times do\n # Hire 6 people from the waiting list\n 6.times do\n new_hire = waiting_list.dequeue\n current_employees.push(new_hire)\n end\n\n # Roll dice to determine # of people fired\n num_to_fire = rand(1..6)\n\n # fire those people last-hired first-fired\n num_to_fire.times do\n new_fire = current_employees.pop\n # put those fired at the end of the waiting list\n waiting_list.enqueue(new_fire)\n end\n end\n\n return [current_employees, waiting_list]\nend", "title": "" }, { "docid": "245cd64666e6376389b5747451bb3c79", "score": "0.52703094", "text": "def lawyer_overdue_matter_tasks\n euid = get_employee_user_id\n overdue_tasks = []\n matters ||= Matter.team_matters(euid, get_company_id)\n matters.each {|e| overdue_tasks << e.overdue_tasks(e.employee_matter_people_id(euid))}\n return overdue_tasks.flatten\n end", "title": "" }, { "docid": "22e8a32ff6dc2e5f38c0febbeee0cdd5", "score": "0.52697223", "text": "def initial_events\n @can_schedule_cache.clear\n time = Time.now\n Schedulers.debug do\n not_executable = self.plan.find_tasks.\n not_executable.\n pending.\n self_owned.\n to_a\n\n if !not_executable.empty?\n Schedulers.debug \"#{not_executable.size} tasks are pending but not executable\"\n for task in not_executable\n Schedulers.debug \" #{task}\"\n end\n end\n break\n end\n\n scheduled_tasks = []\n\t\tfor task in query.reset\n result =\n if @can_schedule_cache.include?(task)\n @can_schedule_cache[task]\n else @can_schedule_cache[task] = can_schedule?(task, time, [])\n end\n\n if result\n Schedulers.debug { \"#{self}: scheduled #{task}\" }\n task.start!\n scheduled_tasks << task\n else\n Schedulers.debug { \"#{self}: cannot schedule #{task}\" }\n end\n\t\tend\n scheduled_tasks\n\t end", "title": "" }, { "docid": "3af0ebbfbe42e8b3ee484b36ed0c0362", "score": "0.52687347", "text": "def schedule\n # For these, we actually want to display all attempts (ie: groups)\n fm_mbf = [\"333fm\", \"333mbf\", \"magic\"]\n @groups = Group.joins(:round).where('rounds.event_id': fm_mbf)\n # Hack for nations cup\n #@groups = @groups.to_a\n #@groups << Group.find(459)\n @rounds = Round.includes(:venue_room).where.not(event_id: fm_mbf)\n @schedule_events = ScheduleEvent.all\n end", "title": "" }, { "docid": "173db83de3ba03dd2dfc69a70c7da9e1", "score": "0.5253255", "text": "def quest_tasks\n @quest_tasks = [] unless @quest_tasks\n @quest_tasks\n end", "title": "" }, { "docid": "553279f277de76977d6136a8b1b2b017", "score": "0.5247496", "text": "def closed\n @entries = Entry.closed.order(\"created_at ASC\")\n end", "title": "" }, { "docid": "1d4fadf4d7a4100464d43e827f87df7b", "score": "0.5246817", "text": "def mark_overdue_undone(scheduled_date)\n \t\t\n completed_dates = EntryStatus.deepcopy(completion_history)\n completed_dates = {}\tif completion_history == nil\n if completed_dates[\"#{TzTime.now.to_date}\"] != \"\"\n completed_dates[scheduled_date] = \"\"\n\n skipped_days = EntryStatus.deepcopy(skipped_on)\n skipped_days = {} if skipped_on == nil \n skipped_days.delete_if {|key,value| key == scheduled_date } \n times_skipped_count = skipped_days.keys.length\n \n #Figure out if this task had previously been marked Done or Skipped\n times_done_count = times_done\n if times_skipped_count == times_skipped\n #Nothing got deleted from the skipped_on hash\n #That means this item had previously been marked Done\n #So decrement the done count\n times_done_count = times_done_count - 1\n end\n update_attributes(:last_marked => TzTime.now.utc,:times_donelate => times_done_count, :completion_history => completed_dates,\n :skipped_on => skipped_days, :times_skipped => times_skipped_count) \n\t\t\t #mark_goal_incomplete Not necessary - A goal that has been ended cannot be undone as a task that has ended cannot be undone either\n end\n end", "title": "" }, { "docid": "fc41eb1d08ac6711872b226156148b0b", "score": "0.5244749", "text": "def send_schedule_notification(entries, start_date)\n if entries.present?\n ScheduleMailer.inform_schedule(user.account, user, entries, start_date).deliver\n end\n end", "title": "" }, { "docid": "413129451b286d44353ec57d84a41f2b", "score": "0.52351516", "text": "def due_today\n due_today = []\n self.cards.each do |card|\n if card.schedule_manager.next_due < (Time.now + 1.day)\n due_today << card\n end\n end\n due_today.length\n end", "title": "" }, { "docid": "768337bb87e530cebe0011af76de6377", "score": "0.5234715", "text": "def prepopulate_existing_tasks\n prefixen = self.class._plugins.map { |klass| klass::PREFIX rescue nil }\n of_tasks = nil\n\n prefix_re = /^(#{Regexp.union prefixen}(?:-[\\p{L}\\d_\\s.-]+)?\\#\\d+)/\n\n if prefixen.all? then\n of_tasks = all_tasks.find_all { |task|\n task.name.get =~ prefix_re\n }\n else\n warn \"WA\"+\"RN: Older plugins installed. Falling back to The Old Ways\"\n\n of_tasks = all_tasks.find_all { |task|\n task.name.get =~ /^([A-Z]+(?:-[\\w-]+)?\\#\\d+)/\n }\n end\n\n of_tasks.each do |of_task|\n ticket_id = of_task.name.get[prefix_re, 1]\n project = of_task.containing_project.name.get\n\n if existing.key? ticket_id\n warn \"Duplicate task! #{ticket_id}\"\n warn \" deleting: #{of_task.id_.get}\"\n self.omnifocus.flattened_projects.tasks.delete of_task\n end\n\n existing[ticket_id] = project\n bug_db[project][ticket_id] = false\n end\n end", "title": "" }, { "docid": "2fdfdbcc624fcf137a74d78eaae8e452", "score": "0.5232401", "text": "def order_pickup_schedules_for_delivery\n\t\torder_pickup_schedules.select {|order_pickup_schedule| !order_pickup_schedule.is_in_sale_period }\n\tend", "title": "" }, { "docid": "d08136488bbd8908d186ad5dee0a8343", "score": "0.52300453", "text": "def scheduled_dequeue\n unless @popq.empty?\n if @drain.empty?\n @drain = @sink\n @sink = []\n end\n until @credits < 1 || @drain.empty? || @popq.empty?\n @credits -= 1\n @popq.shift.call @drain.shift\n end\n end\n self\n end", "title": "" }, { "docid": "bb67e19221950d901f402dbd2968f5f0", "score": "0.52254325", "text": "def refresh_missing_wl_lines\n task_ids = WlLineTask.find(:all, :select=>\"sdp_task_id\").map{ |t| t.sdp_task_id}.uniq\n @tasks = SDPTask.find(:all, :conditions=>\"remaining > 0 and sdp_id not in (#{task_ids.join(',')})\", :order=>\"project_code, remaining desc\")\n render :layout => false\n end", "title": "" }, { "docid": "39bd7dd90fa64cc77b1138ed4cee8715", "score": "0.5224342", "text": "def calendar\n collect_schedule_data\n end", "title": "" }, { "docid": "08073300ff7c3b745747e785a4942603", "score": "0.52207714", "text": "def create_ama_hearing_ready_nonpriority_genpop_cases_ready_61_days_ago\n Timecop.travel(95.days.ago)\n 2.times do\n appeal = create(:appeal,\n :hearing_docket,\n :with_post_intake_tasks,\n :held_hearing_and_ready_to_distribute,\n veteran: create_veteran,\n adding_user: User.first)\n tasks = appeal.tasks\n [:TranscriptionTask, :EvidenceSubmissionWindowTask, :AssignHearingDispositionTask].each do |type|\n date = 30.days.from_now\n tasks.find_by(type: type).update!(\n created_at: date, assigned_at: date, closed_at: date, updated_at: date\n )\n end\n\n tasks.find_by(type: :HearingTask).update!(closed_at: 30.days.from_now)\n tasks.find_by(type: :DistributionTask).update!(assigned_at: 30.days.from_now)\n end\n Timecop.return\n end", "title": "" }, { "docid": "e856f85f6c02687e39f7f4fdc402751e", "score": "0.5216036", "text": "def empty_five_mins\n\t\twhile @five_mins.length > 0\n\t\t\[email protected](@five_mins.pop)\n\t\tend\n\tend", "title": "" }, { "docid": "9da7a0175d5028c2efca80bd9ef9c1a9", "score": "0.5215341", "text": "def upcoming_for(user)\n tasks_due = with_upcoming_deadline + with_upcoming_extension_for(user)\n tasks_due.select(&:released?).uniq\n end", "title": "" }, { "docid": "822c4dd587039e1d2fc0cd5ba97f4928", "score": "0.52132016", "text": "def get_free_times(date, appointment_length)\n @@lock.synchronize do\n @@schedule[date] = Day.new(date) unless @@schedule.has_key?(date)\n return @@schedule[date].get_free_times(appointment_length.to_f).push('END OF MESSAGE')\n end\n end", "title": "" } ]
a61bec6cd0e8503da9d63698e69ca652
Gives log probability of this chain of events.
[ { "docid": "ca8e96a0f8d6aaabf65dc7db8296f9a6", "score": "0.6981964", "text": "def prob_of_events(events)\n @trellis = LogarithmicViterbiTrellis.new(self) unless @trellis\n prob,_ = @trellis.prob_and_bt(events)\n return prob\n end", "title": "" } ]
[ { "docid": "be9518f87bf01b962d3bd9a0bf07e595", "score": "0.7131761", "text": "def probability(event)\n (@p[event] * 100).round\n end", "title": "" }, { "docid": "62010841b5068997afc7f900b3764c5b", "score": "0.6835473", "text": "def log_prob(key)\n if @counter.total == 0 || !key || key == ''\n return Math.log(0, 2.0) # -Infinity\n end\n\n count = @counter.count(key, 0.5)\n Math.log(count, 2.0) - Math.log(counter.total, 2.0)\n end", "title": "" }, { "docid": "132a1496568648fcb0aa70a7b5426285", "score": "0.6273177", "text": "def final_probability(probabilities)\n probabilities.inject(0) { |result, probability| result + Math.log(probability) }\n end", "title": "" }, { "docid": "44747669087b312e6f68a42e1b914fce", "score": "0.62478215", "text": "def prob()\n\t\t''' Returns a probability given its cummulative probability '''\n\n\t\t# Starting variables\n\t\ty = 1; @probability.push(@cum_prob[0])\n\n\t\twhile y < @cum_prob.size\n\t\t\t@probability << (@cum_prob[y] - @cum_prob[y-1]).round(4)\n\t\t\ty+=1\n\t\tend\n\n\t\treturn Eventsims.trimval(@probability)\n\tend", "title": "" }, { "docid": "127d70f82163741a33e07786ec81594e", "score": "0.6108646", "text": "def p(n)\n n * (Math::log(n) + Math::log(Math::log(n))-1 + 1.8*Math::log(Math::log(n))/Math::log(n))\nend", "title": "" }, { "docid": "0ae9e6a2a6777ce9a7594957d2b1766f", "score": "0.61071914", "text": "def calculate_probability\n 1.0 / @value\n end", "title": "" }, { "docid": "6bf5cc74bdff8b2c835f8c4a5fc7794f", "score": "0.6106092", "text": "def probability\n @f_object.probability\n end", "title": "" }, { "docid": "af6029a5666872ede1c41b7d3c41324c", "score": "0.6075085", "text": "def get_emission_probability(event, state)\n if has_state? state\n @emission[state][event]\n else\n log(\"unexpected: state #{state} not found.\")\n 0.0 \n end\n end", "title": "" }, { "docid": "c8c3aac08145644cf680863321970743", "score": "0.6043929", "text": "def probability(example)\n if Node === self.next_node(example)\n self.next_node(example).probability(example)\n else\n self.next_node(example).to_hash\n end\n end", "title": "" }, { "docid": "18a4c591c7b12dbbbd391c81696985c7", "score": "0.60045594", "text": "def prob cum_footprint\n @base ** cum_footprint\n end", "title": "" }, { "docid": "84779efe774a7067d07e4749a1100edd", "score": "0.5985004", "text": "def prob\r\n self.probability(self.k)\r\n end", "title": "" }, { "docid": "d367da6e2baeb6184dc2d797a20cd1af", "score": "0.5967766", "text": "def prob_and_bt(events)\n key = events\n # If we've already computed the probability of seeing this\n # chain of events, we can skip this whole mess and return it.\n unless @memo[key]\n case events.length\n when 1\n # Base case (first word in sentence)\n # Check all start probabilities. Find the max one.\n max_p, max_state = find_max_prob_and_state do |st|\n transform(@model.get_start_probability(st)) +\n transform(@model.get_emission_probability(events[0], st))\n end\n # Store it and done.\n @memo[key] = max_p\n @bt[key] = [max_state]\n else\n # Recursive case.\n *priors, event = *events\n # Find the probability and backtrace of the beginning.\n prob, bt = prob_and_bt(priors)\n if prob.infinite?\n # Impossible to get here. Set probability as infinite\n # and push another nil onto @bt (could probably just\n # leave it alone but we'll stay consistent.)\n @memo[key] = -Float::INFINITY\n @bt[key] = (bt.dup.push nil)\n else\n # Given that, find max likelihood state.\n max_p, max_state = find_max_prob_and_state do |st|\n transform(@model.get_transition_probability(bt.last, st)) +\n transform(@model.get_emission_probability(event, st))\n end\n @memo[key] = prob + max_p\n @bt[key] = (bt.dup.push max_state)\n end\n end\n end\n return @memo[key], @bt[key]\n end", "title": "" }, { "docid": "2383a1006eb8e9031ed882f52ca0f390", "score": "0.59602916", "text": "def get_start_probability(state)\n @start[state]\n end", "title": "" }, { "docid": "de8d47135df556c2841a63ad3993a059", "score": "0.59398687", "text": "def getProbabilities(start)\n return @transition * start\n end", "title": "" }, { "docid": "b27647feb5ddb3d925ab87d711558a9e", "score": "0.5938016", "text": "def prob(x)\r\n return Math.exp(-@lambda) * @lambda ** x / x.factorial\r\n end", "title": "" }, { "docid": "dba3870d8f21d2d02c3c2044af51e032", "score": "0.59267294", "text": "def getprob()\n\t\tprobability = []\n\t\t'''Returns a probability list of all items in its argument'''\n\t\t@@occur.each{|i| probability << (i*1.0/@@outcome.size).round(4)}\n\n\t\treturn probability\n\tend", "title": "" }, { "docid": "96839503f9684b79edd2ca1c40497362", "score": "0.58809805", "text": "def probability_of(value)\n @probability ||= 1.0 / @num_values.to_f\n end", "title": "" }, { "docid": "0ebae96e7c96e4e34b7ecdd00a5b6e31", "score": "0.5873873", "text": "def prob(x)\r\n return @p * (1 - @p) ** x\r\n end", "title": "" }, { "docid": "a0cd9be003d921189de50847916f398b", "score": "0.58516264", "text": "def probability\n -self[5]\n end", "title": "" }, { "docid": "eef29231f029245fc345ecc700c1538a", "score": "0.5847647", "text": "def print_probability\n\t\t\t@probability_distribution.each { |k,v| puts \"p(#{k}) => #{v.round(8).to_f}\"}\n\t\tend", "title": "" }, { "docid": "17f667cec28a7c261739a7b58a09adfd", "score": "0.58448017", "text": "def probabilities\n @probabilities ||= calculate_probabilities\n end", "title": "" }, { "docid": "946d00e06aad5b05b4f95fa83aa87b62", "score": "0.5749534", "text": "def state_probability(state_id)\n return 0\n end", "title": "" }, { "docid": "7b65441f78d2ddd8da0b474b11244a51", "score": "0.57286227", "text": "def get_emission_probability(event, state)\n #log(\"Returning weight for tag #{state} for word #{event}: #{@tag_word_weights[[state,event]]}\")\n @tag_word_weights[[state,event]]\n end", "title": "" }, { "docid": "1050b897a6671a5744bc1deedc82991a", "score": "0.5707089", "text": "def probability_of(val)\n pmf.probability_of(val)\n end", "title": "" }, { "docid": "81648312c8d73859e689b2ea3820cabe", "score": "0.56955427", "text": "def probability(x)\n 0.5 * (1 + erf((x - @mu) / (@sigma * ROOT2)))\n end", "title": "" }, { "docid": "63f2bf0d50cdcc8e8357c4598584de7f", "score": "0.5685155", "text": "def prob(x)\r\n binomial_coef = @n.factorial / (x.factorial * (@n - x).factorial)\r\n return binomial_coef * @p ** x * (1 - @p) ** (@n - x)\r\n end", "title": "" }, { "docid": "286b28a95be75405866f98316585b379", "score": "0.563638", "text": "def prob cum_footprint\n if cum_footprint > 0\n i = 0\n while i < @steps.length\n return @steps[i]['p'] if cum_footprint <= @steps[i]['cum_footprint']\n i += 1\n end\n return 0\n end\n 1.0\n end", "title": "" }, { "docid": "2e4745a410724efc51167b39f5a0d0d7", "score": "0.56139934", "text": "def log\n math :log\n end", "title": "" }, { "docid": "2e4745a410724efc51167b39f5a0d0d7", "score": "0.56139934", "text": "def log\n math :log\n end", "title": "" }, { "docid": "6d6f261cfd3c64c65fd387e2614fccd3", "score": "0.5573273", "text": "def logistic\n mult = @multiplier / 232.0 + 3.57\n num = @num / 100.0\n @num = (mult * num * (1.0 - num)) * 100\n end", "title": "" }, { "docid": "44f8b2a1a81e9e45aa0903b8ce45d615", "score": "0.55732584", "text": "def call\n probability = 1.0\n\n graders.each do |lambda|\n instance = lambda.call(description)\n probability *= instance.call.to_f ** instance.weight\n end\n\n probability\n end", "title": "" }, { "docid": "752630dd40b43941298abbda2046a2bc", "score": "0.55674183", "text": "def repeat_prob\n read_attr :'repeat-prob', :to_f\n end", "title": "" }, { "docid": "d47ec8da9ba3cd02a35ee647ae9f3199", "score": "0.5564227", "text": "def collision_probability(n, e) 1.0 - Math.exp( (-e * (e - 1.0)) / (2 * n) ) end", "title": "" }, { "docid": "d0c94c913c2448774d2272d6ef532c5c", "score": "0.5561908", "text": "def get_probabilty\n if self.probability\n self.probability.to_s\n else\n '0'\n end\n end", "title": "" }, { "docid": "27c2b868bf80cfbd6f35644353d1cb56", "score": "0.5557389", "text": "def set_emission_probability(event, state, p)\n #log(\"Setting emission probability of #{event} in #{state} to #{p}\")\n add_state(state) unless has_state? state\n add_event(event) unless has_event? event\n @emission[state][event] = p\n end", "title": "" }, { "docid": "a2761eb1f658e708a4997d90395153f1", "score": "0.5552999", "text": "def probability(x)\n raise \"Train me first\" unless trained?\n\n singular = !x.first.is_a?(Array)\n x = [x] if singular\n\n y =\n x.map do |xi|\n prob = 0\n @n.times.map do |i|\n pi = normal_pdf(xi[i], @mean[i], @std[i])\n prob += Math.log(pi > 1 ? 1 : pi)\n end\n Math.exp(prob)\n end\n\n singular ? y.first : y\n end", "title": "" }, { "docid": "d353f25dfd3170d8f2546271bafe4cb7", "score": "0.5551375", "text": "def visit_weight visits\n Math::log(visits)\n end", "title": "" }, { "docid": "2be0bc116b8e3caaf8d2f2cddc66418b", "score": "0.55469584", "text": "def entropy\n - @feature_count.reduce(0.0) do |sum, pair|\n value = pair[0]\n count = pair[1]\n prob = count / @total_count.to_f\n sum + prob * Math::log(prob, 2)\n end\n end", "title": "" }, { "docid": "70183a1a5de14cc30162ce5a35582457", "score": "0.554651", "text": "def get_probability\n PROB_FACTOR / (@current * Polygon::SIZE)\n end", "title": "" }, { "docid": "a9b81f958843c52ee9da81dfe45434a4", "score": "0.5544565", "text": "def get_start_probability(state)\n #log(\"Returning weight for starting in tag #{state}: #{@initial_tag_weights[state]}\")\n @initial_tag_weights[state]\n end", "title": "" }, { "docid": "bfa8d3aa4f24aa031b9e2186a17d1dd3", "score": "0.5536093", "text": "def probate(&p)\n if block_given? then event('PROB',&p) else event('PROB') end\n end", "title": "" }, { "docid": "25ba915e49fb748f3c32317771e374ce", "score": "0.553153", "text": "def state_probability(state_id)\n if $data_states[state_id].nonresistance\n return 100\n else\n rank = self.class.state_ranks[state_id]\n return [0,100,80,60,40,20,0][rank]\n end\n end", "title": "" }, { "docid": "f0556333793c9befc475b0a6a87272bb", "score": "0.55285054", "text": "def probability_of(aa)\n @aa_prbs[aa]\n end", "title": "" }, { "docid": "efea74398e9b7b63ec1c07a5498ece09", "score": "0.5508909", "text": "def stay(prob)\n prob\nend", "title": "" }, { "docid": "2fec108998547a9ff606e40cf4882d90", "score": "0.5503059", "text": "def total_probability\n @total_probability ||= @odds.inject(0) { |total, odd| total + odd.implied_probability.value } # Change to #sum when 2.3 support can be dropped\n end", "title": "" }, { "docid": "97c0e5f13753fa9c5de71a298a3d5376", "score": "0.548202", "text": "def prob_more_occurs(lambda, n)\n #res = 1.0 - (0...n).map{|k| lambda**k / fact(k) }.inject(0.0, &:+) * Math.exp(-lambda)\n res = 1.0 - (0...n).map{|k|\n Math.exp(k * Math.log(lambda) - Math.lgamma(k + 1).first)\n }.inject(0.0, &:+) * Math.exp(-lambda)\n [res, 0].max\nend", "title": "" }, { "docid": "22cd238e27a264c7bf695e09e6542663", "score": "0.547097", "text": "def generate\r\n k = 0\r\n p = 1.0\r\n while p >= Math.exp(-@lambda)\r\n k += 1\r\n p *= super.to_f / Dist_precision\r\n end\r\n return k - 1\r\n end", "title": "" }, { "docid": "be715a684189b2e32ecd027cbfa59b59", "score": "0.54380697", "text": "def score\n Math.log(self.notices_count.to_f) * (1 / Math.log(time_since_last_error))\n end", "title": "" }, { "docid": "2e1d039a90f5206249b9b9e1dd9145f8", "score": "0.5430481", "text": "def assumed_probability\n 0.5 / (total_number_of_items.to_f / 2)\n end", "title": "" }, { "docid": "9bc846814e95290af26d221f761838a5", "score": "0.5430295", "text": "def probability(total_docs = 1)\n self.num_docs / total_docs.to_f\n end", "title": "" }, { "docid": "df71781f0243d294b4ef77c9dbad906f", "score": "0.5430127", "text": "def single_event_output\n prob = Random.rand\n if prob < @works_correctly\n 1\n elsif prob < @positive_threshold\n 2\n else\n 0\n end\n end", "title": "" }, { "docid": "cb9fe54626cbcf002a4ab2121f0c2ce8", "score": "0.54277253", "text": "def distribution\n posterior = Array.new(@categories.size, 0.0)\n @categories.each_with_index do |cl, ind|\n posterior[ind] = yield(cl, ind) + Math.log((@prior_count[cl] + 1)/(@documents_count + 1).to_f)\n end\n sum = 0\n posterior.each_with_index { |v, i| posterior[i] = Math.exp(v); sum += posterior[i] }\n posterior.each_with_index { |v, i| posterior[i] /= sum }\n posterior\n end", "title": "" }, { "docid": "9bf8b39a1a714fb79a128aaa4a3303fc", "score": "0.5423318", "text": "def random_level\n \t p = @probability\n \t\tl = 1\n \t\tl += 1 while rand < p\n \t\treturn l\n \tend", "title": "" }, { "docid": "0f69d19e47c08cf7bac866bb16a376f0", "score": "0.542198", "text": "def calc_logistic_pop\n number_of_years = query_year - max_data_year\n\n capital_a = (POPULATION_CAPACITY - max_data_year_pop) / max_data_year_pop\n\n denominator_part2 = Math.exp(-POST_DATA_GROWTH_RATE * number_of_years)\n denominator = 1 + (capital_a * denominator_part2)\n\n result = POPULATION_CAPACITY / denominator\n\n result.to_i\n end", "title": "" }, { "docid": "bea9f1dcc68aadd021241347cf874def", "score": "0.5401283", "text": "def probability(value, dices_count)\n BigDecimal(count(value, dices_count).to_s) / total_count(dices_count)\n end", "title": "" }, { "docid": "62bf87a18e6837e5c5acee3ce6b7997f", "score": "0.5396616", "text": "def calc_entropy(frequency)\n begin\n probability = (frequency.to_f/@parser.number_of_entries.to_f)\n entropy = probability * -1 * Math.log(probability, 2)\n rescue\n #puts probability\n #puts frequency\n end\n return entropy.to_f\n end", "title": "" }, { "docid": "868e83954a0862c222fe11f32050ddb1", "score": "0.5394202", "text": "def multiply_log\n find_all{|e|e>0}.inject(0){|e,r|e+Math.log(r)}\n end", "title": "" }, { "docid": "868e83954a0862c222fe11f32050ddb1", "score": "0.5394202", "text": "def multiply_log\n find_all{|e|e>0}.inject(0){|e,r|e+Math.log(r)}\n end", "title": "" }, { "docid": "4002726bf9f39cade38f7836cacb5e24", "score": "0.5386142", "text": "def relative_probability_of(aa)\n @aa_rel_prbs[aa]\n end", "title": "" }, { "docid": "79ea703cf200ee53719b606948f5471e", "score": "0.53798085", "text": "def log_document_class_prob( features_vector, klass )\n log_sum_of_cond_probs = 0\n features_vector.each{ |e| log_sum_of_cond_probs += Math::log( cond_prob( e, klass ) ) } \n log_val = Math::log( class_prob( klass ) ) + log_sum_of_cond_probs \n end", "title": "" }, { "docid": "653ed5a45add756a14f0881269aaca3e", "score": "0.5359635", "text": "def base_prob\n return (1.0/@sides.to_f)\n end", "title": "" }, { "docid": "d1055a9028523befd7820b21a12449e3", "score": "0.5353084", "text": "def prob(x)\r\n return @p if x == @success\r\n return 1 - @p if x == @failure\r\n return 0\r\n end", "title": "" }, { "docid": "7b6cb63de49e41818c0eae33de175a89", "score": "0.53448474", "text": "def category_probability(category)\r\n Math.log(@categories_documents[category].to_f/@total_documents.to_f)\r\n end", "title": "" }, { "docid": "a621054ee8031b67d3645d5cba5042bb", "score": "0.53445673", "text": "def delay_event_ratio\n return @delay_event_ratio\n end", "title": "" }, { "docid": "bd192a56ea9be1c8e5f12fc5981a6d75", "score": "0.53414", "text": "def language_probability(language)\n Math.log(@languages[language].to_f / @languages_total.to_f)\n end", "title": "" }, { "docid": "bd192a56ea9be1c8e5f12fc5981a6d75", "score": "0.53414", "text": "def language_probability(language)\n Math.log(@languages[language].to_f / @languages_total.to_f)\n end", "title": "" }, { "docid": "bd192a56ea9be1c8e5f12fc5981a6d75", "score": "0.53414", "text": "def language_probability(language)\n Math.log(@languages[language].to_f / @languages_total.to_f)\n end", "title": "" }, { "docid": "71d4def2dfb365f554ab36c4b72768e3", "score": "0.5324811", "text": "def assumed_probability\n 0.5 / (total_items/2)\n end", "title": "" }, { "docid": "2c44dd94a71ca1fdd15780b9f82b2862", "score": "0.53236026", "text": "def probability(arr, n)\n num_count = 0\n num_count = arr.count{|x| x >= n}\n percent = 100 * (num_count) / arr.length.to_f\n percent.round(1)\nend", "title": "" }, { "docid": "c168884839c88ad64f5de99304af0f5f", "score": "0.5318702", "text": "def prob(var_expr, *vals)\n randvars, condvars = parse(var_expr, *vals)\n\n if !randvars.select { |rv| rv.last.nil? }.empty?\n return distribution(randvars, condvars)\n end\n \n denominator = @evidence.count_by(condvars)\n numerator = @evidence.count_by(randvars, condvars)\n \n if (numerator == 0 || denominator == 0)\n return additive_smoothing(randvars, condvars)\n end\n \n return (numerator.to_f / denominator.to_f).tap { |r|\n # puts [\"#{randvars.inspect} | #{condvars.inspect}:\",\n # \"#{numerator} / #{denominator} = #{r}\"].join(\" \")\n }\n end", "title": "" }, { "docid": "9c0981cc8d50153125b9b90683729546", "score": "0.5315545", "text": "def probability_of(value)\n probability_distribution.fetch(value, 0)\n end", "title": "" }, { "docid": "9d9628369be3feee05020279538e991b", "score": "0.5312215", "text": "def probability_distribution\n @probability_distribution ||= @results.group_by(&:value).inject({}) do |probabilites, (value, results)|\n probabilites[value] = results.size.to_f / self.size\n probabilites\n end\n end", "title": "" }, { "docid": "d8fd72b57124581d5b5df518bf764b58", "score": "0.5311844", "text": "def p_n(freq)\n\t\tomega = freq * Math::PI * 2.0\n\t\ttwoomt = @times * 2.0 * omega\n\t\ttau = Math.atan(\n\t\t\ttwoomt.sin.sum / twoomt.cos.sum\n\t\t\t)/ 2.0 / omega\n\t\tomttau = ((@times - tau) * omega)\n\t\tc = omttau.cos\n\t\ts = omttau.sin\n\t\tddmean = @data - @dmean\n\t\tpn = 1 / 2.0 / @dvar * (\n\t\t\t(ddmean * c).sum ** 2.0 / c.square.sum +\n\t\t\t(ddmean * s).sum ** 2.0 / s.square.sum\n\t\t)\n\t\tpn\n\tend", "title": "" }, { "docid": "b0cb3cc7ce8e120f04f6630d52f1214b", "score": "0.530845", "text": "def probability(x)\n if x < 0\n 0.0\n else\n gammaP_regularized(x / 2, @df_half)\n end\n end", "title": "" }, { "docid": "eed23b6263d3c392ee92649aa546445e", "score": "0.5305468", "text": "def probability(x)\n raise \"Train me first\" unless trained?\n raise ArgumentError, \"First argument must have #{@n} elements\" if x.size != @n\n @n.times.map do |i|\n p = normal_pdf(x[i], @mean[i], @std[i])\n (p.nan? || p > 1) ? 1 : p\n end.reduce(1, :*)\n end", "title": "" }, { "docid": "10205785fd327e7931fa99170248733f", "score": "0.5304073", "text": "def cpu_insufficent_event_ratio\n return @cpu_insufficent_event_ratio\n end", "title": "" }, { "docid": "06719a800b6786c7d0f62b6ad2a8dfc1", "score": "0.5295522", "text": "def probTo(ant)\n i = ant.tour[@currentIndex]\n\n denom = 0.0\n (0 ... @n).each do |l|\n if (!ant.visited(l))\n #puts \"#{i}, #{l} = #{@graph[i][l]}\"\n d = ant.distance(i, l)\n denom += pow(@trails[i][l], @alpha) * pow(1.0 / d, @beta)\n end\n end\n\n (0 ... @n).each do |j|\n if (ant.visited(j))\n @probs[j] = 0.0\n else\n d = ant.distance(i, j)\n numerator = pow(@trails[i][j], @alpha) * pow(1.0 / d, @beta)\n @probs[j] = numerator / denom\n end\n end\n end", "title": "" }, { "docid": "acee5a56206da55236d4241484cc72d1", "score": "0.52910715", "text": "def implied_probability\n self\n end", "title": "" }, { "docid": "0139576d73e7a011da84add4711fca44", "score": "0.5275502", "text": "def chance\n self.chance_float.ceil\n end", "title": "" }, { "docid": "5bda85c43298ee1dc6d3d072f9cd6a42", "score": "0.52736396", "text": "def logged\n logs.map(&:duration).sum\n end", "title": "" }, { "docid": "6c297c3bf47fdb73976bb0fa222a5aea", "score": "0.5271016", "text": "def seq\n @log ||= []\n end", "title": "" }, { "docid": "a52ba3f9ce6859a5f02b4d38c6d48f2e", "score": "0.5268782", "text": "def initialize(prob)\n @prob = prob ;\n @nOccur = 0 ;\n @nChance = 0 ;\n end", "title": "" }, { "docid": "267ed51509a96bf4cddad51a4d61a2ae", "score": "0.5267943", "text": "def logged_effort\n logged_effort = 0\n self.effort_logs.each do |log|\n logged_effort = logged_effort + log.logged_effort\n end\n logged_effort\n end", "title": "" }, { "docid": "c8fb9fdafac61a15b5301c8dbff1e7ae", "score": "0.5267", "text": "def probability_of(val)\n distribution_lookup[val] / @total_mass\n end", "title": "" }, { "docid": "3fcedd77fa61a4d526240dff96517180", "score": "0.5263254", "text": "def probability category, item\n return 0.5\n end", "title": "" }, { "docid": "9f4106fec374a2aa2b47d90236cd9ad4", "score": "0.52618897", "text": "def distribution\n @array[0].distribution.power_convolve(roll_count)\n end", "title": "" }, { "docid": "95bfe43d09c24d7342b2c98ce54c390f", "score": "0.52549666", "text": "def set_start_probability(state, p)\n #log(\"Setting start probability of #{state} to #{p}\")\n add_state(state) unless has_state? state\n @start[state] = p\n end", "title": "" }, { "docid": "6fde24a87122e64a1caa722af8c51153", "score": "0.52548474", "text": "def prob(str, p)\n str.\n split('').\n map(&:downcase).\n map{|x| (if ['c','g'].include? x then p else 1-p end)/2}.\n inject(0){|x,y| x + Math::log(y,10)}\nend", "title": "" }, { "docid": "7514bef31487f2767189e33eb2d50966", "score": "0.52499014", "text": "def probability(val)\n @map[val] \n end", "title": "" }, { "docid": "8f7b8a9d323e065e85d91d18a8d3df2d", "score": "0.5246888", "text": "def transition_probability_sums\n prs = []\n states.each do |state|\n actions(state).each do |action|\n pr = next_states(state, action).map do |next_state|\n transition_probability(state, action, next_state)\n end.inject(:+)\n prs << [[state, action], pr]\n end\n end\n Hash[prs]\n end", "title": "" }, { "docid": "54c423da54422b90bec2b2443c3e77fd", "score": "0.52371705", "text": "def log_ratio\n result = Examples.log_ratio\n\n result += words.map{ |word| Words[word].log_ratio }.sum\n\n if respond_to?(:features, true)\n result += present_features.map{ |feature| Features[feature].log_ratio }.sum\n end\n\n result\n end", "title": "" }, { "docid": "a967ee14261fbbbdb13208cc16213501", "score": "0.52337104", "text": "def stat_entropy\n sum = stat_sum.to_f\n -inject(0) { |s,p| p=p/sum; s + p*Math.log(p) }\n end", "title": "" }, { "docid": "4101210ce4e3d893a1a6981a890be755", "score": "0.5229582", "text": "def coinflips(n)\n Math.log(n, 2)\nend", "title": "" }, { "docid": "665b1164101100b5b4e408d3debacbf7", "score": "0.5226198", "text": "def entropy dist\n freq_x = dist.values\n total_freq = freq_x.inject(0.0) {|u,x| u += x}\n return 0.0 if total_freq <= 0.0\n \n prob_x = freq_x.collect {|f| f / total_freq}\n \n -prob_x.inject(0.0) do |u,p| \n u += p > 0 ? p * Math.log(p) : 0.0\n end\nend", "title": "" }, { "docid": "4899647f0adf9a1c7ba2d7fbaaa139ac", "score": "0.52258646", "text": "def compute_benford_prediction(n)\n p=Math.log(1+(1.0/n),10) * 100\n return p.round(2)\n end", "title": "" }, { "docid": "1b45d1b9391f816e5a24a8d84c0306ed", "score": "0.52228177", "text": "def ch(pd)\n -map{|k,v| v * log2(pd[k])}.sum\n end", "title": "" }, { "docid": "8b94f38d524527faf3e305421edb94fb", "score": "0.52199864", "text": "def probability(w, u, v, word = nil)\n return Math.log2(model.q(w, u, v)) unless word\n Math.log2(model.q(w, u, v) * model.e(word, v))\n end", "title": "" }, { "docid": "ef3fbb0321dd0f590056a75c470d5c50", "score": "0.52049124", "text": "def probability(*k)\r\n sum = 0\r\n karr = k.map{ |val| val.respond_to?(:to_a) ? val.to_a : val}\r\n karr.flatten!\r\n karr.each do |k_val| \r\n sum += self.coefficient(k_val) * ((self.p) ** (k_val)) * (1 - self.p) ** (n - k_val)\r\n end\r\n sum.to_f\r\n end", "title": "" }, { "docid": "bb47e2c122841747584f71dec613f70d", "score": "0.52002156", "text": "def ch(pd)\n -map{|k,v| !(pd[k]) ? 0 : (v * log2(pd[k])) }.sum\n end", "title": "" }, { "docid": "33069461f758e80d15b602cbe4af27ff", "score": "0.51940155", "text": "def conditional_probability(*ind_events)\n ind_events.reduce(:*)\nend", "title": "" } ]
6ede72526308d4b0c0e112f5884c06d7
returns all registered nodes
[ { "docid": "b7245bf25985177c6674cf5a7f029748", "score": "0.83479613", "text": "def registered\n @registered_nodes ||= []\n end", "title": "" } ]
[ { "docid": "fad21412c4f205bdbd17399216cc8fae", "score": "0.8078006", "text": "def nodes\n global.nodes\n end", "title": "" }, { "docid": "7a8849062d462369a52c1a63eebd5f14", "score": "0.8071492", "text": "def all\n DCell.registry.nodes\n end", "title": "" }, { "docid": "7a8849062d462369a52c1a63eebd5f14", "score": "0.8071492", "text": "def all\n DCell.registry.nodes\n end", "title": "" }, { "docid": "d7e180432498cad97788dbf99e3b247d", "score": "0.7924737", "text": "def all_nodes\n @all_nodes ||= load_all_nodes\n end", "title": "" }, { "docid": "319bd5efe80cb05300d5eb5efe2a5cc7", "score": "0.7854146", "text": "def get_nodes()\n @nodes\n end", "title": "" }, { "docid": "9a0ca6de1c9f3aedbb47b06bf24237bd", "score": "0.7826393", "text": "def nodes\n Node.nodes\n end", "title": "" }, { "docid": "b36f50f6643597883a58c601774b7712", "score": "0.7760052", "text": "def nodes\n @nodes.keys\n end", "title": "" }, { "docid": "8bb2e5c72a09f3752e3358842d426176", "score": "0.77290696", "text": "def nodes\n @nodes.keys\n end", "title": "" }, { "docid": "c996b9e9ebc8743960327eac66180094", "score": "0.77132607", "text": "def nodes\n @nodes ||= []\n end", "title": "" }, { "docid": "f01c775e9838f4a96796249731572257", "score": "0.7695073", "text": "def get_nodes\n\t\t\t@nodes\n\t\tend", "title": "" }, { "docid": "4e92104f3446afa3d43f066d7bf3ce1c", "score": "0.76945406", "text": "def nodes\n @nodes ||= []\n end", "title": "" }, { "docid": "f822f18358dbb212a91aeaaa5f301c2b", "score": "0.76646155", "text": "def nodes\n @nodes.values\n end", "title": "" }, { "docid": "f822f18358dbb212a91aeaaa5f301c2b", "score": "0.76646155", "text": "def nodes\n @nodes.values\n end", "title": "" }, { "docid": "cba8768b11c80f629d89111bc5b18df8", "score": "0.7654421", "text": "def nodes\n nodes = []\n each { |node| nodes << node }\n nodes\n end", "title": "" }, { "docid": "7170f98f00f0a97e98d08941e5e0d31a", "score": "0.7643756", "text": "def all\n map{|node| node}\n end", "title": "" }, { "docid": "d0acdb4b263df9d6b9a0be47781075fd", "score": "0.7597208", "text": "def nodes\n @nodes ||= {}\n end", "title": "" }, { "docid": "e2a6111282fd6b9d8c9214c010be0b16", "score": "0.7582596", "text": "def nodes\n @nodes ||= {}\n end", "title": "" }, { "docid": "26aa16b14576da86115c85ee1f675149", "score": "0.7567064", "text": "def nodes\n @@nodes ||= []\n end", "title": "" }, { "docid": "cfda7e237850cefee3eb14a78ece07a3", "score": "0.7557836", "text": "def nodes\n evaluate_all unless @nodes.size > 0\n @nodes\n end", "title": "" }, { "docid": "affb3ddd27bb200a86aa65954a47e528", "score": "0.75192374", "text": "def nodes\n @nodes_hash.values\n end", "title": "" }, { "docid": "91641553aa7963f5421ab1bdc26f9148", "score": "0.74935967", "text": "def nodeset\n @nodes.values\n end", "title": "" }, { "docid": "ee6f6d1913423c6501d9d1fb88e95fba", "score": "0.74450856", "text": "def all_nodes\n SheldonClient::Read.all_nodes\n end", "title": "" }, { "docid": "95e69eca657f442d2f5e038441665845", "score": "0.7442507", "text": "def all_nodes_i\n @all_nodes\n end", "title": "" }, { "docid": "30adb4a9d7b4a84a83e03874d3c4c19d", "score": "0.74385864", "text": "def nodes()\n return @nodes.dup\n end", "title": "" }, { "docid": "ab0b724ce766e45af7bb933ec5b2f357", "score": "0.74194556", "text": "def getAllNodes\n nlist = Array.new\n self.each_node { |n|\n nlist.insert(-1, n.getcoord)\n }\n return nlist\n end", "title": "" }, { "docid": "55bb728b72f49d517a96ffb0f23c690b", "score": "0.7417657", "text": "def nodes\n @store.keys\n end", "title": "" }, { "docid": "77be087f217a0cb0e589ae5644eca597", "score": "0.739457", "text": "def nodes\n @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?\n @nodes\n end", "title": "" }, { "docid": "bb0ae7ffa85ee9644a57ee4f8193daa1", "score": "0.7379385", "text": "def nodes\n mapped_hash('node')\n end", "title": "" }, { "docid": "2c908e305cd4566c686c28646b6d10df", "score": "0.73572314", "text": "def nodes\n @nodes ||= Array.new\n end", "title": "" }, { "docid": "2890f997c71b0d93aee79ae7f6ffd1b6", "score": "0.73276466", "text": "def get_node_names\n\t\[email protected]\n\tend", "title": "" }, { "docid": "7d46a74246b1a609cfbe34f67f3c6e31", "score": "0.73271877", "text": "def nodes\n @root.node_list.map{|n| n[0]}\n end", "title": "" }, { "docid": "955ea9d648d1ea3dba9c99cac6635b66", "score": "0.7304155", "text": "def nodes\n nodes = []\n cache 'nodes' do\n connection.send_data(\"nodes\")\n while ( ( line = connection.read_line ) != \".\" )\n nodes << line\n end\n nodes\n end\n end", "title": "" }, { "docid": "a9b378a227f885bd722ccf009ef2f68c", "score": "0.72989833", "text": "def nodes\n info[:nodes]\n end", "title": "" }, { "docid": "21e06392d75145fe3325e6c90ea538c5", "score": "0.72389704", "text": "def nodes\n node_graph.keys\n end", "title": "" }, { "docid": "94f3e45c8acf77322704e841498aa1c1", "score": "0.72146505", "text": "def all_nodes\n all = self.children\n to_search = self.children\n while !to_search.empty?\n n = to_search.pop\n to_search += n.children\n all += n.children\n end\n all\n end", "title": "" }, { "docid": "198f8cfefb272f55b48da00a980efc32", "score": "0.7210607", "text": "def nodes\n EMS.nodes\n end", "title": "" }, { "docid": "198f8cfefb272f55b48da00a980efc32", "score": "0.7210607", "text": "def nodes\n EMS.nodes\n end", "title": "" }, { "docid": "7cb1bb3139e8051dc780965de4170e3a", "score": "0.7172828", "text": "def nodes\n @nodes ||= Hash.new { |h, k| h[k] = [] }\n end", "title": "" }, { "docid": "876c1824eccac19bd2ac25b0819a2b92", "score": "0.7171614", "text": "def nodes\n @graph.keys\n end", "title": "" }, { "docid": "55305020ddb165ae654e10aa645c439e", "score": "0.7121963", "text": "def nodes\n @visited_nodes.values\n end", "title": "" }, { "docid": "6208311731217a3da0cc4f4bc5721df4", "score": "0.7111464", "text": "def nodes\n @nodes.map { |node| { node.id => node.data } }\n end", "title": "" }, { "docid": "b1ba3ecb8d25b7a34b2bd38165b0f99c", "score": "0.7092319", "text": "def nodes()\n STATSD.time('optica.store.get_nodes') do\n return load_instances_from_zk unless @cache_enabled\n @cache_results.clone\n end\n end", "title": "" }, { "docid": "bfbb0b2568f17a5c2149e1f4f6d43c98", "score": "0.7070164", "text": "def nodes()\n STATSD.time('optica.store.get_nodes') do\n unless @cache_enabled\n inst, idx = load_instances_from_zk\n return inst\n end\n\n check_cache_age\n @cache_results\n end\n end", "title": "" }, { "docid": "f6c3cc55f46e48c883de8c92af458f1d", "score": "0.70659786", "text": "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "title": "" }, { "docid": "f6c3cc55f46e48c883de8c92af458f1d", "score": "0.70659786", "text": "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "title": "" }, { "docid": "f1dcddc3b0c9230b6c387a3982ba1072", "score": "0.70403904", "text": "def getAllNodes\n response = RestClient.get \"#{@server_restclient}/api/nodes\"\n\t\t\t#response = Typhoeus.get(\"#{@server}/api/nodes/\")\n nodes = JSON.parse(response)\n\t\t\treturn nodes\n end", "title": "" }, { "docid": "5039ee3684dee9749b6c92f76e34b0c7", "score": "0.70297027", "text": "def nodes\n data.keys\n end", "title": "" }, { "docid": "aacac8c8dd51ca96fcda8833d1465b8b", "score": "0.70281136", "text": "def nodes\n @lock.synchronize do\n ons = @table.to_a\n if block_given?\n ons.each do |on|\n yield on\n end\n else\n return ons\n end\n end\n end", "title": "" }, { "docid": "d5271ccfb1775c09b461b418d0bc3cec", "score": "0.7027756", "text": "def get_all_nodes(xo)\n\t\t\t\tresult = []\n\t\t\t\txo.traverse {|node| result << node }\n\t\t\t\tresult\n\t\t\tend", "title": "" }, { "docid": "64dc58245288026fb4d7823984976b2e", "score": "0.70025253", "text": "def child_nodes\r\n return @nodes\r\n end", "title": "" }, { "docid": "4e79986ed4bc232e7959e517d9fa60d0", "score": "0.69981104", "text": "def nodes; end", "title": "" }, { "docid": "4e79986ed4bc232e7959e517d9fa60d0", "score": "0.69981104", "text": "def nodes; end", "title": "" }, { "docid": "4e79986ed4bc232e7959e517d9fa60d0", "score": "0.69981104", "text": "def nodes; end", "title": "" }, { "docid": "4e79986ed4bc232e7959e517d9fa60d0", "score": "0.69981104", "text": "def nodes; end", "title": "" }, { "docid": "4e79986ed4bc232e7959e517d9fa60d0", "score": "0.69981104", "text": "def nodes; end", "title": "" }, { "docid": "6c70e89277068603f7d1ea4854532998", "score": "0.69971186", "text": "def all_node_names\n @node_configurations.keys\n end", "title": "" }, { "docid": "558c4748fa0925d72b8e0e52ef1b8289", "score": "0.6979263", "text": "def nodes\n @absolute.keys()\n end", "title": "" }, { "docid": "3a5db99c1da67fa25b30af9f0530a8e2", "score": "0.69672215", "text": "def find_all\n masters = Nodes.new(@config.settings[\"master\"][\"agent\"], @config.settings[\"master\"][\"filter\"], @config)\n\n masters.nodes\n end", "title": "" }, { "docid": "beba88f9eeb53ca1d04937da80cbcf3b", "score": "0.69533736", "text": "def _nodes\n @_nodes ||= {}\n end", "title": "" }, { "docid": "a38cfe5a0b587a7b19bd38cc770451b7", "score": "0.6948963", "text": "def all_nodes\n @networks.each do |nw|\n nw.nodes.each do |node|\n yield node, nw\n end\n end\n end", "title": "" }, { "docid": "01454d9b8df3e7a1b8f3e75a04226932", "score": "0.6947987", "text": "def nodes\n get('catalog/nodes')\n end", "title": "" }, { "docid": "7c37443293030c3106d9aca16cea557e", "score": "0.6945813", "text": "def keys\n @nodes.keys\n end", "title": "" }, { "docid": "878865d2fb1e75b3c09c867f7a450d5e", "score": "0.69435513", "text": "def list\n chef_connection.node.all\n end", "title": "" }, { "docid": "e649d5d8c88f985dfd0962a5f51543a6", "score": "0.69389796", "text": "def nodes(&block)\n if block_given?\n instance_eval(&block)\n else\n @nodes\n end\n end", "title": "" }, { "docid": "4cdece0a11edd49e1fb6908dd43e2580", "score": "0.6936139", "text": "def known_nodes\n @nodes_platform.keys\n end", "title": "" }, { "docid": "85f7d6feb767cc6b517cec04aa95ba70", "score": "0.68920594", "text": "def all_nodes\n http_addresses = nodes_info([])[\"nodes\"].collect { |id, node| node[\"http_address\"] }\n http_addresses.collect! do |a|\n if a =~ /inet\\[.*\\/([\\d.:]+)\\]/\n $1\n end\n end.compact!\n http_addresses\n end", "title": "" }, { "docid": "f47913ab098a61a765feae9cf2996dfc", "score": "0.68755466", "text": "def nodes\n terminology.document.root.xpath(xpath, terminology.namespaces)\n end", "title": "" }, { "docid": "8e9e1b8da766adca16151866607d3a48", "score": "0.68674016", "text": "def get_node_names\n l = Chef::Node.list\n nl.keys\n end", "title": "" }, { "docid": "34f6e76dcc4f283e4cdc8361c6029c0d", "score": "0.68589747", "text": "def nodes\n @xml.nodes\n end", "title": "" }, { "docid": "0ffe138ba0cbbcfcb1ce46d9752f05e4", "score": "0.6851588", "text": "def index\n @nodes = Node.all\n @nodes_array = []\n @nodes.each do |n|\n @nodes_array << n\n end\n end", "title": "" }, { "docid": "0cbec86ad2263a719f247ec66632b805", "score": "0.68473333", "text": "def known_nodes\n @inventory.keys\n end", "title": "" }, { "docid": "c8c4fbb8a8aa6fe384425cc47cd25e64", "score": "0.68301404", "text": "def all_ready_nodes\n current_platform_spec.nodes\n end", "title": "" }, { "docid": "83fbff493d2e2a0e93e10fee9c769cad", "score": "0.68286663", "text": "def get_nodes(root = @root)\n recursive_get_nodes(root, l = []) # nodes are stored in this list.\n l\n end", "title": "" }, { "docid": "73b1a253102102284f3cb44062996e4c", "score": "0.6821154", "text": "def nodes_search\n nodes = []\n Chef::Search::Query.new.search(\n :node,\n config[:query],\n filter_result: filter_result\n ) { |n| nodes << n }\n nodes\n end", "title": "" }, { "docid": "51e6efbf1b71b673471b635bce5d092f", "score": "0.6820369", "text": "def get_all_nodes(state)\n rc = []\n machines = state[:machines]\n chef_rest = Chef::REST.new(@server.url)\n nodes = chef_rest.get(\"/nodes\")\n nodes.each_key do |node|\n if (machines.include?(node))\n rc.push(node)\n end\n end\n return rc\n end", "title": "" }, { "docid": "c304e9a37d3258a80dd6f1f333db60d8", "score": "0.6808099", "text": "def nodes\n opts = {}\n query = {}\n response = self.connection.get('/nodes', query, :body => opts.to_json, expects: [200, 406], full_response: true)\n if (response.status == 200)\n hashes = JSON.parse(response.body)\n nodes = []\n hashes.each do |node_hash|\n node = Docker::Swarm::Node.new(self, node_hash)\n nodes << node\n end\n return nodes || []\n else\n return []\n end\n end", "title": "" }, { "docid": "697c04e7eb9858efe72dd1b4e506ef99", "score": "0.68018234", "text": "def get_inflated_node_list\n nl = Chef::Node.list(true)\n end", "title": "" }, { "docid": "a4184c4edab7bf65ccc279a5f1e64c3b", "score": "0.67951035", "text": "def allNodes(&block)\n MObject.warn \"'allNodes()' is deprecated - please use allGroups() instead\"\n allGroups(&block)\nend", "title": "" }, { "docid": "c950d4fdd14ad55948884d1038580b0e", "score": "0.678815", "text": "def nodes\n ( enabled_nodes | disabled_nodes | draining_nodes )\n end", "title": "" }, { "docid": "67b6459d3933451774b0bec39c3c9032", "score": "0.6786227", "text": "def all_nodes\n collection = connection[nodes_collection]\n collection.find.batch_size(999).projection(_id: 1).map { |k| k[:_id] }\n end", "title": "" }, { "docid": "800f7ac99a04a9b888fc2a5248213d26", "score": "0.6786107", "text": "def nodes\n @grpc.serve_nodes\n end", "title": "" }, { "docid": "48aedcc528e640c34c2b653b0c30a42e", "score": "0.6759094", "text": "def nodes\n @body['nodes']\n end", "title": "" }, { "docid": "5f2a94c69ac6f2faf70b8587e3d171e6", "score": "0.6757987", "text": "def nodes(names = [])\n @nodes ||= client.search(:node, \"*:*\")\n\n names = [] if names.nil?\n names = [names] unless names.kind_of?(Array)\n\n names.empty? ? @nodes : @nodes.select { |node| names.include?(node.name) }\n end", "title": "" }, { "docid": "aefc06c4f55d3b7042b13b17bf24d8f5", "score": "0.6752438", "text": "def nodes\n @nodes ||= Collection.new(\n ActiveDocument::ProductionManager.new(Node, @data[:nodes]).all)\n end", "title": "" }, { "docid": "e118f8a9c7ee88703a6667750361bdc5", "score": "0.67403704", "text": "def allNodes!(&block)\n NodeSet.freeze\n ns = RootGroupNodeSet.instance\n return RootNodeSetPath.new(ns, nil, nil, block)\nend", "title": "" }, { "docid": "911a2ffa8995c5d61af6a49b6e407c55", "score": "0.67353106", "text": "def all_nodes\n api_nodes.reject { |data| data['deactivated'] }.map { |data| data['certname'] }\n end", "title": "" }, { "docid": "d39390b2017c704d8b4da244bcfcf985", "score": "0.67278314", "text": "def nodes\n all_impls.map(&:node).uniq\n end", "title": "" }, { "docid": "39f565860b5c6cd446e7573dd9f16868", "score": "0.6722639", "text": "def public_nodes\n @public_nodes ||= []\n end", "title": "" }, { "docid": "5e4d5ece4540932d85581051355b01e5", "score": "0.6721788", "text": "def node_ids; end", "title": "" }, { "docid": "5e4d5ece4540932d85581051355b01e5", "score": "0.6721788", "text": "def node_ids; end", "title": "" }, { "docid": "c98e03f617c3675a0f7587103867c7e0", "score": "0.67201036", "text": "def all\n @registry\n end", "title": "" }, { "docid": "7f923f71757297c3d347c7c66ee448d1", "score": "0.67200524", "text": "def node_services\n node.list\n end", "title": "" }, { "docid": "e959a617693698794deee53830e4c5bb", "score": "0.67124826", "text": "def load_all_nodes\n return @all_nodes if @all_nodes\n return nodes_from_test_cache if $TESTING && @test_node_cache\n\n @all_nodes = search.inject({}) do |accum, org|\n accum[org.deptid] = org if org.deptid != \"Org Units\"\n accum\n end\n\n build_test_node_cache if $TESTING\n calculate_all_child_nodes\n @all_nodes\n end", "title": "" }, { "docid": "7a6e682bf8232a43490b18cddaf2fb80", "score": "0.6706233", "text": "def metros\n return @nodes\n end", "title": "" }, { "docid": "f5282bda93c30fa7a5fe1a44342c3b0c", "score": "0.6705461", "text": "def all_nodes\n get(\"/production/facts_search/search?facts.processorcount.ge=0\",false)\n end", "title": "" }, { "docid": "903574335799b44660e3305244efb6e4", "score": "0.6702525", "text": "def nodes\n (from_nodes + to_nodes).uniq\n end", "title": "" }, { "docid": "85da6467f7f029ab6fa80fd821fcce48", "score": "0.66878355", "text": "def list\n Node.list\n end", "title": "" }, { "docid": "0ec2eb7680bef5b9616162a8625f4b81", "score": "0.66755474", "text": "def to_a\n return @nodes\n end", "title": "" }, { "docid": "f04aa9b5fcd7c678d256e120cb27ad06", "score": "0.6659213", "text": "def known_nodes_lists\n @nodes_list_platform.keys\n end", "title": "" }, { "docid": "9c021f57a559e3ffc583d8830515cfc3", "score": "0.6653159", "text": "def nodes()\n if @filters.empty?\n return nodes_for_empty_filter\n else\n return nodes_for_filter\n end\n end", "title": "" } ]
2d8854df19d01784d35857b5ca1ab4de
property BSTR FieldList BSTR table_name [IN]
[ { "docid": "8ecd4ff665e16cf6abcd2da0b1d9b9db", "score": "0.6646167", "text": "def FieldList\n @_FieldList ||= OLEProperty.new(@ole, 4, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end", "title": "" } ]
[ { "docid": "ebb144e148066e67aaed99e728cf7f49", "score": "0.68481106", "text": "def field_list_command(table, field)\n synchronize do\n reset\n write [COM_FIELD_LIST, table, 0, field].pack(\"Ca*Ca*\")\n fields = []\n until self.class.eof_packet?(data = read)\n fields.push Field.new(FieldPacket.parse(data))\n end\n return fields\n end\n end", "title": "" }, { "docid": "ebb144e148066e67aaed99e728cf7f49", "score": "0.68481106", "text": "def field_list_command(table, field)\n synchronize do\n reset\n write [COM_FIELD_LIST, table, 0, field].pack(\"Ca*Ca*\")\n fields = []\n until self.class.eof_packet?(data = read)\n fields.push Field.new(FieldPacket.parse(data))\n end\n return fields\n end\n end", "title": "" }, { "docid": "70399d19513f3868230e6c0464f48efa", "score": "0.66734546", "text": "def FieldList\n @_FieldList ||= OLEProperty.new(self, 4, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end", "title": "" }, { "docid": "e9185387bacd88458958c2b8f70c039b", "score": "0.6568867", "text": "def list_fields(table, field=nil)\n check_connection\n begin\n fields = @protocol.field_list_command table, field\n return Result.new fields\n rescue ServerError => e\n @last_error = e\n @sqlstate = e.sqlstate\n raise\n end\n end", "title": "" }, { "docid": "7b3cb88fdcaa8a7a5e4819188a91b11b", "score": "0.634304", "text": "def TableRecords\n @_TableRecords ||= OLEProperty.new(self, 4, [VT_BSTR], [VT_BSTR, VT_BYREF|VT_DISPATCH])\n end", "title": "" }, { "docid": "ddd103ed469406db58271cadcfb7304c", "score": "0.63287514", "text": "def TableRecords\n @_TableRecords ||= OLEProperty.new(@ole, 4, [VT_BSTR], [VT_BSTR, VT_BYREF|VT_DISPATCH])\n end", "title": "" }, { "docid": "9d12f7cfc6a93d0a5637949b3e68bc15", "score": "0.6257508", "text": "def set_field_list_from_table(force: nil)\n self.field_list = default_field_list_array.join(' ') if force || field_list.blank?\n end", "title": "" }, { "docid": "aac946af730c7f441edc850f5f095d3d", "score": "0.6142031", "text": "def get_field_lists(dim_table) # return [field_names, field_lengths, question_list]\n sql_names = \"\"\n field_lengths = []\n sql_question_list = \"\"\n sep = \"\"\n i = 1\n DimensionField.select(\"field_name, max_length\").\n where(\"table_name = '#{dim_table}' AND is_primary_key = 'FALSE'\").each do |rec|\n sql_names += sep + '\"' + rec.field_name + '\"'\n field_lengths << rec.max_length.to_i\n sql_question_list += sep + \"$#{i}\"\n sep = \", \"\n i += 1\n end\n \n [sql_names, field_lengths, sql_question_list]\n end", "title": "" }, { "docid": "0fc7ca303b0f680353df72a56feab591", "score": "0.6128262", "text": "def AddTable(table_name, fieldl_list, rev)\n @ole._invoke(3, [table_name, fieldl_list, rev], [VT_BSTR, VT_BSTR, VT_UI8])\n end", "title": "" }, { "docid": "14406f908212193d403f930d951afff7", "score": "0.5996312", "text": "def AddTable(table_name, fieldl_list, rev)\n _invoke(3, [table_name, fieldl_list, rev], [VT_BSTR, VT_BSTR, VT_UI8])\n end", "title": "" }, { "docid": "7b40669de9ce0dd2c439d00131af275b", "score": "0.59113103", "text": "def parse_sap_record_structure(field_list)\n out = Hash.new\n field_list.each do |field|\n if field.value.class.include?(com.sap.conn.jco.JCoTable)\n table = field.get_table\n table_array = []\n begin\n table_array << parse_sap_record_structure(table)\n end while table.next_row\n out[field.name.to_sym] = table_array\n elsif field.value.class.include?(com.sap.conn.jco.JCoRecord)\n out[field.name.to_sym] = parse_sap_record_structure field.value\n else\n out[field.name.to_sym] = field.value\n end\n end unless field_list.nil?\n out\n end", "title": "" }, { "docid": "23a07fc23a96f6f3b49143c775131dda", "score": "0.5888123", "text": "def table_name_fields\n\t\treturn @header['table_name']\n\tend", "title": "" }, { "docid": "2b1db894ef5b30e6868ed8413f9e8f8f", "score": "0.58662045", "text": "def table_info(table); end", "title": "" }, { "docid": "9830573bacd02d5b1aeb4fcf7e3e0b06", "score": "0.5840126", "text": "def fields(table)\n fields = []\n attributes = nil\n mysql(\"use #{@dbName};show columns from #{@dbName}.#{table};\").split(\"\\n\").each do |line|\n# p line\n if line =~ /^\\*+/\n attributes = {}\n fields << attributes\n end\n attributes[$1] = $2 if line =~ /(\\S+)\\:\\s+(\\S+)/\n end\n return fields\n end", "title": "" }, { "docid": "223a229cbf10568ced91cb7cdb8fe57d", "score": "0.5813275", "text": "def table_field_names\n raise NotImplementedError\n end", "title": "" }, { "docid": "a2ca0ae1dbda6f9522f69989c43a5e54", "score": "0.5759204", "text": "def field_list\n self.field_list_raw.split(',')\n end", "title": "" }, { "docid": "df6de3466170e5c0e7e65664e9c316cd", "score": "0.57112926", "text": "def m_tabla_fields(objeto)\n\t\tobjeto.class::TABLA_FIELDS\n\tend", "title": "" }, { "docid": "54a4d6a56f23d3789d78b53c1eb1e774", "score": "0.56775165", "text": "def table_fields\n fields.each.select(&:show_in_table)\n end", "title": "" }, { "docid": "2d84c669b1721c22e8d802f941390cb5", "score": "0.5670124", "text": "def fields\r\n @dbf.fields\r\n end", "title": "" }, { "docid": "2d84c669b1721c22e8d802f941390cb5", "score": "0.5670124", "text": "def fields\r\n @dbf.fields\r\n end", "title": "" }, { "docid": "77985769e44c4ad1b7130caef2d3e13d", "score": "0.566763", "text": "def fields\n @table.keys\n end", "title": "" }, { "docid": "8d3c73281b7a486f48e7b0f597df0d8d", "score": "0.565254", "text": "def sql_get_db_plate_name_arr\r\n fields = Array.new\r\n tables = \"biodatabase, plate\"\r\n fields[0] = \"biodatabase.biodatabase_id as did\"\r\n fields[1] = \"biodatabase.name as dname\"\r\n fields[2] = \"plate_id as pid\"\r\n fields[3] = \"plate.name as pname \"\r\n fstr = @@alib.comb_arr_to_str(\",\", fields)\r\n wstr = \"biodatabase.biodatabase_id = plate.biodatabase_id\"\r\n ostr = \"plate.description, plate.name\"\r\n\r\n platenamearr = sql_get_arr(tables, fstr, wstr, ostr)\r\n platenamearr\r\nend", "title": "" }, { "docid": "8aa66ccd37c539ed14f323da71a66283", "score": "0.56368405", "text": "def table_params(db_table)\n dp_res_id = db_table.name.split(\"_\")[1].to_i\n table_fields_syms = DatapackageResourceField.where(datapackage_resource_id: dp_res_id).map { |e| e.name.to_sym }\n params.require(:data).permit(table_fields_syms)\n end", "title": "" }, { "docid": "a619bd968366531c0eefe7776e191915", "score": "0.5605242", "text": "def field_list\n @field_list if(@field_list)\n @field_list = MtkGrid.grid_to_field_list(file.file_name, grid_name)\n end", "title": "" }, { "docid": "1bd5d521b4fa57a8a17c9f86954954ab", "score": "0.5582944", "text": "def table_list\n Tables.values.flatten\nend", "title": "" }, { "docid": "4542ef20a0aa088861515d199208184c", "score": "0.55787057", "text": "def tables\n from(:MSysObjects).filter(:Type=>1, :Flags=>0).select_map(:Name).map{|x| x.to_sym}\n end", "title": "" }, { "docid": "4542ef20a0aa088861515d199208184c", "score": "0.557792", "text": "def tables\n from(:MSysObjects).filter(:Type=>1, :Flags=>0).select_map(:Name).map{|x| x.to_sym}\n end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.5536631", "text": "def columns(table_name); end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.5536631", "text": "def columns(table_name); end", "title": "" }, { "docid": "3351488a650f61f51d2df7b83bc63677", "score": "0.553658", "text": "def table_name=(value); end", "title": "" }, { "docid": "d4caa2aff00f9a17a8c1c33a5d99ffdf", "score": "0.5500645", "text": "def ole_table\n self.class.ole_table\n\n end", "title": "" }, { "docid": "2bac02fe10a705a3758765ca547c635a", "score": "0.54607147", "text": "def table_values(**opt)\n model_field_values(**opt)\n end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "bba794f68c0ce1dfb52f7205a7f5b00d", "score": "0.54550487", "text": "def tables; end", "title": "" }, { "docid": "1dc7d16aa4ff3436aadf992770130ac4", "score": "0.54421616", "text": "def field_list\n fields.keys\n end", "title": "" }, { "docid": "cedec1619b344a05b146ed33f398298a", "score": "0.54076624", "text": "def field_names; @field_names; end", "title": "" }, { "docid": "11847bb31f36c1baf11eb3b8c825f6ab", "score": "0.54073143", "text": "def set_table(table)\n @table = table\n @table.table_schema.fields.each do |field|\n (@inputs + @outputs + @values).each do |item|\n if field.name == item.name\n item.pos = field.pos\n item.type = @table.types[field.type]\n end\n end\n end\n end", "title": "" }, { "docid": "39215033d174773641549ed48bdea6e3", "score": "0.54019034", "text": "def columns(table_name) end", "title": "" }, { "docid": "57cc7b00cb6db15b2c70d61c3d712494", "score": "0.53921705", "text": "def table\n return @args[:db].tables[@args[:table_name]]\n end", "title": "" }, { "docid": "7b76f2d50099a3c44bd541f21cb653f0", "score": "0.5379087", "text": "def field_class_table\n\t\t\t\t@field_class_name.tableize\n\t\t\tend", "title": "" }, { "docid": "272367ad178a0f6c774ee83cb3690846", "score": "0.5373362", "text": "def table\n @table\n end", "title": "" }, { "docid": "c84f31edaeab0728b7f3208d8a882c55", "score": "0.53722835", "text": "def fields\n @dbf.fields\n end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5370162", "text": "def fields; end", "title": "" }, { "docid": "5bb35a3c49306f3302f5342080459c9b", "score": "0.5369997", "text": "def fields; end", "title": "" }, { "docid": "a24295515f722fffe2785fa7cf49b0ba", "score": "0.5364221", "text": "def table\n return @db.tables[@args[:table_name]]\n end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "dbc0e704f7ddd1336aa4e43172ddd6ef", "score": "0.5350643", "text": "def table; end", "title": "" }, { "docid": "a8f3c0bbbd52915b802f43fd08f73f02", "score": "0.5348067", "text": "def table\n @table\n end", "title": "" }, { "docid": "a8f3c0bbbd52915b802f43fd08f73f02", "score": "0.5348067", "text": "def table\n @table\n end", "title": "" }, { "docid": "6b760c6598908811f0630552b8de031a", "score": "0.53468126", "text": "def tables\n [\n ]\n end", "title": "" }, { "docid": "a70eb4c0194e956aa87fa4396055dd27", "score": "0.5336958", "text": "def data_table; end", "title": "" }, { "docid": "a70eb4c0194e956aa87fa4396055dd27", "score": "0.5336958", "text": "def data_table; end", "title": "" }, { "docid": "a70eb4c0194e956aa87fa4396055dd27", "score": "0.5336958", "text": "def data_table; end", "title": "" }, { "docid": "a70eb4c0194e956aa87fa4396055dd27", "score": "0.5336958", "text": "def data_table; end", "title": "" }, { "docid": "534728f036e648b2aaa9f22a8a82e79f", "score": "0.533622", "text": "def table\n @db.tables[table_name]\n end", "title": "" }, { "docid": "5735676f4e1e454d3c5a5f9750af5eb6", "score": "0.5324074", "text": "def getFieldsInfo(prefix='')\n colsInfo = []\n idx = 0\n while idx < @aliases.length do\n colsInfo.push({\n name: \"#{prefix}#{@aliases[idx]}\",\n type: @types[idx]\n })\n idx += 1\n end\n return colsInfo\n end", "title": "" }, { "docid": "db79ad81b3284761c89001161248f8ef", "score": "0.5309277", "text": "def returning_fields\n return [] unless table_name\n s = Datoki.db.schema(table_name)\n return [] unless s\n s.map { |pair|\n name, meta = pair\n field = fields[name]\n if !field || !field[:secret]\n name\n else\n nil\n end\n }.compact\n end", "title": "" }, { "docid": "b794759fbc5231cca1cf6275722e298e", "score": "0.53080624", "text": "def table_params\n params[:table]\n end", "title": "" }, { "docid": "5594243d58ea2a379a8e3ddecb2f2232", "score": "0.52995014", "text": "def set_Table(value)\n set_input(\"Table\", value)\n end", "title": "" }, { "docid": "0436fa72b2a5ed49ecba04476306a160", "score": "0.5280585", "text": "def database_field_names\n [\"name\", \"assignment_id\", \"description\", \"where_stored\"]\n end", "title": "" }, { "docid": "64140dcdf89fb0aa2f61f1f947e10c36", "score": "0.52701664", "text": "def fields=(_arg0); end", "title": "" }, { "docid": "64140dcdf89fb0aa2f61f1f947e10c36", "score": "0.52701664", "text": "def fields=(_arg0); end", "title": "" }, { "docid": "64140dcdf89fb0aa2f61f1f947e10c36", "score": "0.52701664", "text": "def fields=(_arg0); end", "title": "" }, { "docid": "64140dcdf89fb0aa2f61f1f947e10c36", "score": "0.52701664", "text": "def fields=(_arg0); end", "title": "" }, { "docid": "1bc90fc941d1b46a0cd2cdf82dcd6105", "score": "0.52678925", "text": "def get_table_fields(node, table, dictionary)\r\n node.children.each do |field_node|\r\n raise \"Expected 'Field' tag in Table\" unless field_node.name=='Field'\r\n field = Field.new() {\r\n definition_name = field_node.attributes['Name']\r\n @definition = dictionary[definition_name]\r\n raise \"#{definition_name} is not defined in the dictionary. Please add it.\" unless definition\r\n @allow_null = field_node.attributes['AllowNull'] if field_node.attributes['AllowNull']\r\n }\r\n table.add_field(field)\r\n end\r\n\r\n nil\r\n end", "title": "" }, { "docid": "babae20cdfefa4c1706424fd241fbad0", "score": "0.52530086", "text": "def from_table=(_); end", "title": "" }, { "docid": "b5c69f471534e948847dc18b54e65cdc", "score": "0.5246259", "text": "def read_table(name, fields = [], clauses = [], _row_skip = 0, _row_count = 0)\n if name.is_a?(Hash)\n fields = name[:fields]\n clauses = name[:clauses]\n _row_skip = name[:row_skip]\n _row_count = name[:row_count]\n name = name[:name]\n end\n klass_name = name.capitalize\n fields_up = []\n fields_down = []\n fields.each do |field|\n fields_up << field.upcase\n fields_down << field.downcase\n end\n\n base_obj = get_class_instance(klass_name, fields_down)\n\n #-- Read Table\n # dump_instance_variables(conn)\n fn_read_table = @conn.get_function('RFC_READ_TABLE')\n fc_read_table = fn_read_table.get_function_call\n\n fc_read_table[:QUERY_TABLE] = name.upcase\n fc_read_table[:ROWSKIPS] = _row_skip\n fc_read_table[:ROWCOUNT] = _row_count\n fc_read_table[:DELIMITER] = '|'\n fields_up.each do |field|\n row = fc_read_table[:FIELDS].new_row\n row[:FIELDNAME] = field\n end\n\n clauses.each do |clause|\n row = fc_read_table[:OPTIONS].new_row\n row[:TEXT] = clause\n end\n\n fc_read_table.invoke\n\n columns_hash = {}\n fc_read_table[:FIELDS].each do |row|\n column = TableColumn.new\n column.field_name = row[:FIELDNAME]\n column.offset = row[:OFFSET]\n column.length = row[:LENGTH]\n column.type = row[:TYPE]\n column.description = row[:FIELDTEXT]\n columns_hash[column.field_name] = column\n end\n\n list = []\n\n fc_read_table[:DATA].each do |row|\n obj = base_obj.class.new\n wa = row[:WA].split('|')\n pos = -1\n fields_down.each do |field|\n pos = pos + 1\n column = columns_hash[field.upcase]\n # value = wa[column.offset.to_i, column.length.to_i]\n if INT_TYPES.include?(column.type)\n value = wa[pos].to_i\n eval(\"obj.#{field} = #{value}\")\n elsif FLOAT_TYPES.include?(column.type)\n value = wa[pos].to_f\n eval(\"obj.#{field} = #{value}\")\n elsif DATE_TYPES.include?(column.type)\n value = wa[pos]\n if value.nil? || value == '00000000'\n eval(\"obj.#{field} = nil\")\n else\n year = value[0..3].to_i\n month = value[4..5].to_i\n day = value[6..7].to_i\n # value = Date.new(year, month, day)\n eval(\"obj.#{field} = Date.new(#{year}, #{month}, #{day}) \")\n end \n else\n begin\n value = wa[pos].strip\n rescue\n value = ''\n end\n eval(\"obj.#{field} = '#{value}'\")\n end\n\n end\n list << obj\n end\n\n list\n end", "title": "" }, { "docid": "a17cffdc48e5edcb601b4247def67248", "score": "0.5245483", "text": "def initialize_fields\r\n if self.metadata_table_name\r\n @fields = Schema.get_table_fields(@metadata_table_name)\r\n end\r\n end", "title": "" }, { "docid": "61760aab18d52d7fa3945fb061cf38d3", "score": "0.5206855", "text": "def fields(list_name)\n get \"#{base_url}/lists/#{list_name}/fields\"\n end", "title": "" }, { "docid": "df9da2646037936b27aefdf436b05541", "score": "0.52014124", "text": "def initialize( table_name )\n @table_name = table_name\n # see if this table name matches the shadow table name pattern\n @shadow_match = $shadow_pattern.match( table_name )\n if @shadow_match\n # then this is a shadow table\n # base_name is name of the table the shadow table is following\n @base_name = @shadow_match[1]\n # shadow name is the name of the shadow table - there is none for a shadow\n @shadow_name = nil\n else\n @base_name = table_name\n # this is not a shadow table\n end\n # - get the description of this table from the database\n @desc = $dbh.query( \"describe #{table_name}\" )\n if @desc.nil?\n @column_count = 0\n # somehow this table has no columns\n else\n @column_count = @desc.num_rows\n end\n # the 6 description keys available are:\n # Field - value is the name of the field\n # Type - value is the field data type, and (size) when used\n # Null - whether NULL is allowed as a field value\n # - for shadow tables we do not need a non-null constraint\n # Default - the default value when a value is not given\n # - for shadow tables we do not need a default value\n # Key - information about use of the field in an index\n # - for shadow tables we do not need a primary key for now\n # Extra - other properties, e.g. autoincrement\n # - for shadow tables we do not need autoincrement fields\n #\n # - analyze the properties of this table\n # we only get one scan of desc, so do it all now\n @has_id = false\n @has_update = false\n @create_fields = ''\n @field_list = ''\n @new_list = ''\n @fields = {}\n @desc.each_hash do |info|\n if !shadow?\n # for a non-shadow table we need to know if it can have a shadow\n # to have a shadow it must have these two fields\n case info[\"Field\"]\n when ID_NAME\n @has_id = true\n when UPDATE_NAME\n @has_update = true\n end\n # these strings are only used if this is not a shadow table\n # it seems easier to create them here than to derive them later\n @create_fields += \" #{info[\"Field\"]} #{info[\"Type\"]},\"\n @field_list += \" #{info[\"Field\"]},\"\n @new_list += \" new.#{info[\"Field\"]},\"\n end\n # we need the fields hash for all tables\n @fields[info[\"Field\"]] = info[\"Type\"]\n end\n if ! @create_fields.empty?\n # if this is non-empty then the others are too\n # remove the final commas\n @create_fields.chop!\n @field_list.chop!\n @new_list.chop!\n end\n # we now know enough to create the shadow name (or not)\n if can_shadow?\n @shadow_name = @base_name + $options.shadow_suffix\n else\n # there will not be a shadow table\n @shadow_name = nil\n end\n @desc.free\n end", "title": "" }, { "docid": "48a904e40be3b7d9eaacbece964da342", "score": "0.5198899", "text": "def tables\n []\n end", "title": "" }, { "docid": "177628eb58ae4bf0be63a213eff00df2", "score": "0.5196787", "text": "def table; @options[:table]; end", "title": "" }, { "docid": "1041dd9a7f1adc3bcb20a3ab3548b208", "score": "0.5194329", "text": "def table_info(table, key = nil)\n key ||= properties.key1\n response = table_response(key, nil, \"Tables('#{table}')\")\n Table.new(response.body)\n end", "title": "" }, { "docid": "f11068d7bb762658b2da14fcd6fc81f8", "score": "0.5179597", "text": "def bind_table(db,table)\n tablefields = []\n @@_table = table\n \n if db.schema(table).empty?\n raise ArgumentError, \"Table [#{table}] was not found. Unable to bind object\", caller(1)\n end\n \n db.schema(table).each do |fields|\n tablefields << fields[0] \n end\n bind(tablefields)\n end", "title": "" }, { "docid": "eff82a2901dad48c86d2567b878c453a", "score": "0.51793754", "text": "def get_fields\n DatasetService.get_fields self.dataset_id, self.api_table_name\n end", "title": "" }, { "docid": "c08640dde73406c5f7dcbc0ef777fbed", "score": "0.5178416", "text": "def schema_and_table(table_name)\n sch = db.default_schema if db\n case table_name\n when Symbol\n s, t, a = split_symbol(table_name)\n [s||sch, t]\n when SQL::QualifiedIdentifier\n [table_name.table, table_name.column]\n when SQL::Identifier\n [sch, table_name.value]\n when String\n [sch, table_name]\n else\n raise Error, 'table_name should be a Symbol, SQL::QualifiedIdentifier, SQL::Identifier, or String'\n end\n end", "title": "" }, { "docid": "a1cb1f2320ef93951a96b158a97b36f4", "score": "0.5171648", "text": "def table= value\n @gapi.configuration.query.destination_table = table_ref_from value\n end", "title": "" }, { "docid": "f02b5e56b0a0678e00e445d4459d4800", "score": "0.5160115", "text": "def student_table\n table = frm.table(:class=>\"listHier lines nolines\").to_a\n end", "title": "" }, { "docid": "3227c2e35ba5d7ce97475fc29e1ab8b9", "score": "0.5155707", "text": "def attrtable_record() @records.get(GRT_ATTRTABLE); end", "title": "" }, { "docid": "806a14df4ebaa8e21d28dac6970d4510", "score": "0.515151", "text": "def table; self.class.table; end", "title": "" }, { "docid": "cbf7c947e93da67c85e6be4955ffb65b", "score": "0.51504326", "text": "def fields\n (self.field_descriptors + (self.system_formalism.field_descriptors || [])).partition{|field| field.section == 'interface'}\n end", "title": "" } ]
89b95f75e00e82c92c1f359c19eaaf2c
Delete an event +id+ of the event to delete
[ { "docid": "28380dea2adb76d63898028d6e79e69c", "score": "0.8572565", "text": "def delete_event(id)\n @event_svc.delete(id)\n end", "title": "" } ]
[ { "docid": "4bd782c74f6f0b12c9da67d0a737b65a", "score": "0.85929364", "text": "def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end", "title": "" }, { "docid": "8fe9dba03465c66e05ebd6fde9501df8", "score": "0.8154532", "text": "def delete_event(event)\n @connection.send(Addressable::URI.parse(events_url + \"/#{event.id}\"), :delete)\n end", "title": "" }, { "docid": "13fc13a68cd3cfe39e5b03a6345a7edd", "score": "0.80264866", "text": "def delete_event(event_id)\n\t\tself.event_list.delete(event_id)\n\t\tself.update_attribute(:event_list, self.event_list)\n\t\tself.notification_list.delete_if do |notif|\n\t\t\tnotif.has_key?(:event) && notif[:event] == event_id\n\t\tend\n\tend", "title": "" }, { "docid": "fa6cac7e553703a115a5184e3a00fb15", "score": "0.7651887", "text": "def delete_event(event)\n notifications = \"sendNotifications=#{event.send_notifications?}\"\n send_events_request(\"/#{event.id}?#{notifications}\", :delete)\n end", "title": "" }, { "docid": "d61d4b61d13535fc9a5e1c90004a63fc", "score": "0.76064646", "text": "def delete_event(token, id, user = nil)\n request_url = user_context(user) << \"/Events/\" << id\n\n delete_response = make_api_call \"DELETE\", request_url, token\n\n return nil if delete_response.nil? || delete_response.empty?\n\n parse_response(delete_response)\n end", "title": "" }, { "docid": "a1db281a09d15afb856c76bdbdfa7395", "score": "0.7596657", "text": "def destroy\n event = Event.find(params[:id])\n event.destroy!\n end", "title": "" }, { "docid": "bf62f66c3a5894fa13c78df31064d0e9", "score": "0.7578625", "text": "def delete\n params = { calendarId: Calendar.id, eventId: id }\n request(Calendar.api.events.delete, params)\n self\n end", "title": "" }, { "docid": "6dd5e8235664cf2d7ac0dadb6a7846ea", "score": "0.75725704", "text": "def remove_one_event(event)\n client.execute(\n :api_method => calendar.events.delete,\n :parameters => {:calendarId => calendar_id, :eventId => event['id']})\n end", "title": "" }, { "docid": "4bf00ea4ec230e99442b40f5b6598bc8", "score": "0.7563408", "text": "def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end", "title": "" }, { "docid": "f955252f902c753816feb5fc1cc0c7e3", "score": "0.7545407", "text": "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "title": "" }, { "docid": "05be0d96913fc92a6637a2131ef4662c", "score": "0.7536894", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end", "title": "" }, { "docid": "05be0d96913fc92a6637a2131ef4662c", "score": "0.7536894", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end", "title": "" }, { "docid": "b803b6fc0fa4e23e08df2e65277ceb48", "score": "0.74717116", "text": "def destroy\n @event = Event.find(params[:id])\n if @event.present?\n @event.destroy\n flash[:notice] = \"Successfully deleted event!\"\n redirect_to events_path\n else\n flash[:alert] = \"Error updating event!\"\n end\n end", "title": "" }, { "docid": "8be4a60e6c3e87f96945d3b173684ce8", "score": "0.74498564", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n redirect_to root_path, :notice => \"Successfully deleted event\"\n end", "title": "" }, { "docid": "162ad18d10a2cf196179cb4e09f8cc0c", "score": "0.7401538", "text": "def destroy\n\n flash[:notice] = \"Event #{@event.name} removed.\"\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to(events_path)\n end", "title": "" }, { "docid": "608485d3d35a1b05064af0ab6edbbedd", "score": "0.7398329", "text": "def delete_org_unit_calendar_event(org_unit_id, event_id)\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\"\n _delete(path)\nend", "title": "" }, { "docid": "992b52652dac84b64bee865f46e17bac", "score": "0.73438436", "text": "def destroy\n\t\t@event = Event.find(params[:id])\n\t\[email protected]\n\t\tredirect_to root_path\n\tend", "title": "" }, { "docid": "5aea154f6640a0e8ea16d78f7e6d41e9", "score": "0.73106724", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to events_path\n end", "title": "" }, { "docid": "ddaa0533bd29eb97aec3f42547937396", "score": "0.72994614", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n flash[:notice] = \"Evento apagado.\"\n redirect_to events_path\n end", "title": "" }, { "docid": "b39d27008de613177fd44428c0c41830", "score": "0.729784", "text": "def deleteForEvent\n deleteEventNotifications(current_user.id, params[:eid])\n end", "title": "" }, { "docid": "f240d49a9ffffcd880fea673f17535bb", "score": "0.7283997", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n redirect_to events_url\n end", "title": "" }, { "docid": "26254cababbf38dee84e607c7576c963", "score": "0.71754444", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "f21014fdd9e00776ec5b0201708df09c", "score": "0.7170333", "text": "def destroy\n\t @event = Event.find(params[:id])\n\t @event.destroy\n\t redirect_to '/events'\n\tend", "title": "" }, { "docid": "d6fbf2953732f8f94dcf188028be3418", "score": "0.7158767", "text": "def delete_calendar_event(id,opts={})\n query_param_keys = [\n :cancel_reason\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/calendar_events/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end", "title": "" }, { "docid": "2a7dda49bd978f0e7b9a5713335b7d49", "score": "0.71354705", "text": "def destroy\n @event.delay.call_notification(I18n.t('Notification.event_deleted'), I18n.t('Email.event_deleted'))\n @event.destroy\n head :no_content\n end", "title": "" }, { "docid": "b6c572a9e78f7368f741c0242794942a", "score": "0.71014935", "text": "def delete\n # @group_event.destroy\n @group_event = GroupEvent.find params[:id]\n\n @group_event.deleted = true\n @group_event.save!\n\n respond_to do |format|\n format.html { redirect_to group_events_url, notice: 'Group event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5055bcd352d092415ba3f0f0308218d9", "score": "0.7064101", "text": "def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "11f7138ce2d6d84fa0d9949fbd14cb07", "score": "0.7063858", "text": "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1183bcd36215bd3a4c50e5e6687f1c48", "score": "0.70600367", "text": "def delete_event(args)\n this_event = get_event_object(args)\n remove_event(this_event)\n end", "title": "" }, { "docid": "cadfc927752efb1acb5f9f08619b3950", "score": "0.7055975", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "cadfc927752efb1acb5f9f08619b3950", "score": "0.7055975", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8d9f0410de1be2123ca195594ddded3d", "score": "0.7052312", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9fbe1865432814e6e751641965a7ff90", "score": "0.70485455", "text": "def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "63b3301ebac0782c3953a3aee009ed39", "score": "0.70423615", "text": "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted event: #{@event.name}\")\n end", "title": "" }, { "docid": "e02087931dc85c2d0b4dbebb71241174", "score": "0.7032039", "text": "def delete(calendar_id = Base.calendar_id)\n # delete instance of event\n # update event instance\n @event = service.delete_event(calendar_id, id)\n return true\n end", "title": "" }, { "docid": "7c98a7d8552c19734553b1ada3567eab", "score": "0.70108384", "text": "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d9c1bbd96cc608683d01166017000b40", "score": "0.7000453", "text": "def destroy\n\t\t@event = Event.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to events_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "c9dc570cfc6845ab934e421dcf013fa2", "score": "0.69875175", "text": "def destroy\n if current_user.user_role.can_delete\n @event = Event.find(params[:id])\n @event.destroy\n\n @events = Event.all\n redirect_to root_path\n else\n redirect_to event_path(@event)\n end\n end", "title": "" }, { "docid": "afaef3360cc93da895a97eee7a6894c2", "score": "0.6984604", "text": "def delete\n @event = Event.find(params[:id])\n @user = current_user\n @event.users.delete(@user) \n \tredirect_to reminders_path(:id => current_user.id), :notice => I18n.t(:reminders_delete)\n end", "title": "" }, { "docid": "545e942dfc3673afeee8689543f4ccac", "score": "0.6983981", "text": "def destroy\n @event=Event.find_by(params[:id])\n @event.delete\n redirect_to \"/\"\n end", "title": "" }, { "docid": "fa954c666b3b09ddee63a90f048c0e9e", "score": "0.6962773", "text": "def destroy\n @event = Event.find(params[:id])\n\t\n\tif [email protected]_modify?(current_user)\n\t\traise Exceptions::AccessDeniedException\n\tend\n name = @event.name\n\[email protected]\n\n\tflash[:notice] = \"Successfully deleted event #{name}.\"\n\t\n respond_to do |format|\n format.html { redirect_to events_my_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "bd33b6073d88da718b1cca2764f64537", "score": "0.6961664", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end", "title": "" }, { "docid": "abd8481e30396307432ef256413271c6", "score": "0.6960454", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3723e53902cc2b4ae7d9197bc0b06e81", "score": "0.69476384", "text": "def destroy\n\t\t@event = Event.find(params[:id])\n\t\tAttend.where(event:@event, user:current_user).first.destroy\n\t\tredirect_to \"/events\"\n\tend", "title": "" }, { "docid": "9b7a413a49fc5d85fd547f9d1c4b9f7f", "score": "0.69436973", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e9559905ca6b7f88c47a657d01d782c3", "score": "0.69358206", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.6929205", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "40165e4f3c89f4a603f70acf884713f7", "score": "0.6928279", "text": "def destroy\n @event = @current_user.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4a59ed95d145dc38f1e91719829b5af7", "score": "0.69282717", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8140b3296f0133c092508af7ec58a95", "score": "0.69241273", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "12e378a2d4b03dbe8a0be4efa03d0d4c", "score": "0.6907333", "text": "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "title": "" }, { "docid": "c53d56d42f99f099b2f8db82ed4e6b97", "score": "0.6901665", "text": "def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc00e510b6c5fd6d67feca6a083e6c44", "score": "0.6894006", "text": "def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31588465fe6ca19cc4b94adccfd71949", "score": "0.6893731", "text": "def destroy\n @event = IndrelEvent.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(indrel_events_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ad357cc9d1033f88711366e23180ae78", "score": "0.6890429", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "41cc3d8f2375bd989c570c6e639bc91f", "score": "0.688268", "text": "def destroy\r\n @event.destroy\r\n end", "title": "" }, { "docid": "6e473044faa930dd37135abafcd17679", "score": "0.6879966", "text": "def remove_event(event)\n @events.delete(event)\n end", "title": "" }, { "docid": "28319ec0517e43e920aee0a8a6270c58", "score": "0.68754774", "text": "def destroy\n#\t\t@event = Event.find(params[:id])\n\t\[email protected]\n\t\tflash[:alert] = \"event was successfully deleted\"\t\t\n#\t\tredirect_to :action => :index\n\t\tredirect_to events_path #RESTful\t\n\tend", "title": "" }, { "docid": "91e57ebc7eeb84058a43132315ed59d0", "score": "0.6869552", "text": "def destroy\n @event.destroy\n end", "title": "" }, { "docid": "91e57ebc7eeb84058a43132315ed59d0", "score": "0.6869552", "text": "def destroy\n @event.destroy\n end", "title": "" }, { "docid": "91e57ebc7eeb84058a43132315ed59d0", "score": "0.6869552", "text": "def destroy\n @event.destroy\n end", "title": "" }, { "docid": "764813fd46cfa96391554b362c16ff9b", "score": "0.6868991", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "764813fd46cfa96391554b362c16ff9b", "score": "0.6868991", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "764813fd46cfa96391554b362c16ff9b", "score": "0.6868991", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "764813fd46cfa96391554b362c16ff9b", "score": "0.6868991", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "764813fd46cfa96391554b362c16ff9b", "score": "0.6868991", "text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
5ac9777a0903873e7a5a92d4ed7cf125
Draw an outline of a quad.
[ { "docid": "f432a0201643f21fe6afe6ce370a67fd", "score": "0.71387076", "text": "def draw_quad(x1:, y1:, x2:, y2:, x3:, y3:, x4:, y4:, stroke_width: 1, color: nil, colour: nil)\n draw_polyline closed: true,\n coordinates: [x1, y1, x2, y2, x3, y3, x4, y4],\n color: color, colour: colour, stroke_width: stroke_width\n end", "title": "" } ]
[ { "docid": "98b33b61100634957a12bef2ff363334", "score": "0.68635476", "text": "def make_quad(tl, tr, bl, br, fill_color = BLUE, opacity = 255, z = 0)\n fill_color.alpha = opacity\n Gosu.draw_quad(tl[:x], tl[:y], fill_color,\n tr[:x], tr[:y], fill_color,\n bl[:x], bl[:y], fill_color,\n br[:x], br[:y], fill_color, z)\n end", "title": "" }, { "docid": "8acf832ad1bdda1f84f1feac6f4fe012", "score": "0.6734351", "text": "def draw_outline color: 'red'\n @canvas.rect(\n x: @left,\n y: @top,\n width: width,\n height: height,\n style: \"stroke: #{color}; fill: none\"\n )\n end", "title": "" }, { "docid": "cc2f31fe9766c5a63ce5c167a4b0d559", "score": "0.6512394", "text": "def highlight_quad(quad:, color: nil, outline_color: nil)\n {\n method: \"Overlay.highlightQuad\",\n params: { quad: quad, color: color, outlineColor: outline_color }.compact\n }\n end", "title": "" }, { "docid": "ee8bcf1d30ea246df29d909069d6dcfa", "score": "0.64704424", "text": "def draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z=0, mode=:default)\n @graphics.draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, AM_MODES[mode])\n end", "title": "" }, { "docid": "498a3dde3582820710cdbe444f262695", "score": "0.64027953", "text": "def draw_rect_outline(x, y, w, h, colour)\n # Horizontal Lines\n contents.fill_rect(x, y, w, 2, colour)\n contents.fill_rect(x, y + h - 2, w, 2, colour)\n # Vertical Lines\n contents.fill_rect(x, y, 2, h, colour)\n contents.fill_rect(x + w - 2, y, 2, h, colour)\n end", "title": "" }, { "docid": "1e27efd20afff620e71891eaa0e1de49", "score": "0.5910091", "text": "def draw(window)\n window.draw_quad(top_left_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, bottom_right_y_view, 0x33ffffff,\n top_left_x_view, bottom_right_y_view, 0x33ffffff, 100)\n end", "title": "" }, { "docid": "9a15fa428e68f0f20581aeb91b05524d", "score": "0.58562547", "text": "def drawbox(pt, offset, color)\n @draw.stroke 'transparent'\n @draw.fill(color)\n @draw.rectangle(pt[0]-offset, pt[1]-offset, pt[0]+offset, pt[1]+offset)\n end", "title": "" }, { "docid": "c582d4896d37535c6d0bb72fd0182b2d", "score": "0.5844919", "text": "def draw(window)\n color = Gosu::Color::WHITE\n\n window.draw_quad(\n x1, y1, color,\n x1, y2, color,\n x2, y2, color,\n x2, y1, color\n )\n end", "title": "" }, { "docid": "cb289985999df778ccedbc681e2df662", "score": "0.58299506", "text": "def draw_rect(x,y,w,h,c)\n self.draw_quad(x,y,c,x+w,y,c,x,y+h,c,x+w,y+h,c)\n end", "title": "" }, { "docid": "e8bd55fcbfcff61805647f492e02f104", "score": "0.5773665", "text": "def draw_background\n draw_quad( 0, 0, TOP_COLOR,\n @width, 0, TOP_COLOR,\n 0, @height, BOTTOM_COLOR,\n @width, @height, BOTTOM_COLOR,\n -1 )\n end", "title": "" }, { "docid": "d7427ed9f4beebdbf2478e59b53fe375", "score": "0.5750405", "text": "def draw_box(x, y, width, height, colour, z_order = 0.0)\n self.draw_line(x, y, colour, x + width, y, colour, z_order)\n self.draw_line(x + width, y, colour, x + width, y + height, colour, z_order)\n self.draw_line(x, y, colour, x, y + height, colour, z_order)\n self.draw_line(x, y + height, colour, x + width, y + height, colour, z_order)\n end", "title": "" }, { "docid": "2595f35629d02bffb02030b66b6143d1", "score": "0.5749203", "text": "def outline!(d, im, dpi, text, x, y)\n dr = d.clone\n\n outline = @field['outline']\n if (outline && outline['stroke'] > 0)\n dr.stroke_width(outline['stroke'] * dpi) if outline['stroke']\n dr.stroke(get_color(outline['color'])) if outline['color']\n dr.text(x, y, text)\n\n dr.draw(im)\n end\n\n d.text(x, y, text)\n\n d.draw(im)\n end", "title": "" }, { "docid": "ff780a00ab5d0102d85f0d6b08faf2b3", "score": "0.5649121", "text": "def draw_box(x, y, width, height, color, z = 0.0)\n draw_line(x, y, color, x + width, y, color, z)\n draw_line(x + width, y, color, x + width, y + height, color, z)\n draw_line(x, y, color, x, y + height, color, z)\n draw_line(x, y + height, color, x + width, y + height, color, z)\n end", "title": "" }, { "docid": "c23b31260bf0a1b8eaab3a37be85fcc9", "score": "0.56434834", "text": "def create_outline(color, thickness = 2)\n return false if !self.bitmap\n drawBitmapOutline(self.bitmap, color, thickness)\n end", "title": "" }, { "docid": "b7fe0a6d3620656daa192011e28f09f3", "score": "0.5640838", "text": "def draw_rect_outline_with_shadow(x, y, w, h)\n draw_rect_outline(x + 1, y + 1, w, h, text_color(QuestData::COLOURS[:line_shadow]))\n draw_rect_outline(x, y, w, h, text_color(QuestData::COLOURS[:line]))\n end", "title": "" }, { "docid": "58af23b5a229f4873414a2cc3d3c8831", "score": "0.55582094", "text": "def bottom_border_stroke\n line_stroke(\n settings.border.style.bottom_left,\n settings.border.style.bottom_junc,\n settings.border.style.bottom_right\n ) do\n settings.border.style.bottom_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "title": "" }, { "docid": "544832bc38c7ce4549e7715acd9ddcf3", "score": "0.5448803", "text": "def fill_border(loc, fill_color = GREEN, opacity = 255, thickness: 4)\n fill_color.alpha = opacity\n tl, tr, bl, br = pixel_top_left(loc[:x], loc[:y]), pixel_top_right(loc[:x], loc[:y]),\n pixel_bottom_left(loc[:x], loc[:y]), pixel_bottom_right(loc[:x], loc[:y])\n\n make_quad( tl, tr.left(thickness), tl.down(thickness),\n tr.left(thickness).down(thickness), fill_color, opacity, loc[:z] )\n\n make_quad( tr.left(thickness), tr, br.left(thickness).up(thickness),\n br.up(thickness), fill_color, opacity, loc[:z] )\n\n make_quad( bl.right(thickness).up(thickness), br.up(thickness),\n bl.right(thickness), br, fill_color, opacity, loc[:z] )\n\n make_quad( tl.down(thickness), tl.right(thickness).down(thickness),\n bl, bl.right(thickness), fill_color, opacity, loc[:z])\n end", "title": "" }, { "docid": "c4227e28941faeae4e8e2ad5f9b57e7c", "score": "0.54220366", "text": "def stroke_paint(paint)\n end", "title": "" }, { "docid": "da5af47cdadf885c36388c073c52bfa3", "score": "0.53765774", "text": "def draw_box(x, y, w, h, options = {})\n options[:border] ||= 1\n options[:border_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:border_width] ||= 0.5\n options[:fill] ||= 1\n options[:fill_color] ||= RFPDF::COLOR_PALETTE[:white]\n options[:fill_colorspace] ||= :rgb\n SetLineWidth(options[:border_width])\n set_draw_color_a(options[:border_color])\n set_fill_color_a(options[:fill_color], options[:fill_colorspace])\n fd = \"\"\n fd = \"D\" if options[:border] == 1\n fd += \"F\" if options[:fill] == 1\n Rect(x, y, w, h, fd)\n end", "title": "" }, { "docid": "4865cddc2aa6d7fb51b6c7f4eca7645e", "score": "0.53335136", "text": "def draw(surface, z_order, colour)\n surface.draw_rectangle(position, size, z_order, colour)\n end", "title": "" }, { "docid": "02599254a8c866e9aed7b64c7f318951", "score": "0.5314875", "text": "def drawRectangle(x,y,w,h,fillp=false,color=\"black\")\n @device.drawRectangle(x,y,w,h,fillp,color) ;\n end", "title": "" }, { "docid": "ff241ecf71c11119953bdadfd95efaeb", "score": "0.5286566", "text": "def draw_rectangle(x:, y:, width:, height:, stroke_width: 1, color: nil, colour: nil)\n clr = color || colour\n clr = Color.new(clr) unless clr.is_a? Color\n ext_draw_rectangle([\n x, y, width, height, stroke_width,\n clr.r, clr.g, clr.b, clr.a\n ])\n update_texture if @update\n end", "title": "" }, { "docid": "fb359875bbb862e34f9177b27e8fe628", "score": "0.5232648", "text": "def draw_rect(rect, color, zorder)\r\n $window.draw_line(rect.x, rect.y, color, rect.right, rect.y, color, zorder)\r\n $window.draw_line(rect.right, rect.y, color, rect.right, rect.bottom, color, zorder)\r\n $window.draw_line(rect.right, rect.bottom, color, rect.x, rect.bottom, color, zorder)\r\n $window.draw_line(rect.x, rect.bottom, color, rect.x, rect.y, color, zorder)\r\n end", "title": "" }, { "docid": "f0e8ab4de9eb6d8513f0bd269665547c", "score": "0.5223453", "text": "def fill_quad(x1:, y1:, x2:, y2:, x3:, y3:, x4:, y4:, color: nil, colour: nil)\n fill_polygon coordinates: [x1, y1, x2, y2, x3, y3, x4, y4], color: color || colour\n end", "title": "" }, { "docid": "f2152cbbc16dd547041fa684d1ad6905", "score": "0.52177703", "text": "def draw_border(x1, y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n end \r\n end", "title": "" }, { "docid": "328eefe2be53a3994e39602c82c6428b", "score": "0.52037483", "text": "def create_outline(color, thickness = 2)\n return false if !self.bitmap\n # creates temp outline bmp\n out = Bitmap.new(self.bitmap.width, self.bitmap.height)\n for i in 0...4 # corners\n x = (i/2 == 0) ? -r : r\n y = (i%2 == 0) ? -r : r\n out.blt(x, y, self.bitmap, self.bitmap.rect)\n end\n for i in 0...4 # edges\n x = (i < 2) ? 0 : ((i%2 == 0) ? -r : r)\n y = (i >= 2) ? 0 : ((i%2 == 0) ? -r : r)\n out.blt(x, y, self.bitmap, self.bitmap.rect)\n end\n # analyzes the pixel contents of both bitmaps\n # iterates through each X coordinate\n for x in 0...self.bitmap.width\n # iterates through each Y coordinate\n for y in 0...self.bitmap.height\n c1 = self.bitmap.get_pixel(x,y) # target bitmap\n c2 = out.get_pixel(x,y) # outline fill\n # compares the pixel values of the original bitmap and outline bitmap\n self.bitmap.set_pixel(x, y, color) if c1.alpha <= 0 && c2.alpha > 0\n end\n end\n # disposes temp outline bitmap\n out.dispose\n end", "title": "" }, { "docid": "5e82bc1e6b3708f8b36af0c5c26064fb", "score": "0.5179912", "text": "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend", "title": "" }, { "docid": "a36f296453274de0f388d2117f88bef8", "score": "0.51787025", "text": "def drawRect(rect)\n super\n context = UIGraphicsGetCurrentContext()\n\n # Draw outline circle\n CGContextAddEllipseInRect(context, rect)\n CGContextSetFillColor(context, CGColorGetComponents(@stroke_color || \"#3c4e90\".to_color.CGColor))\n CGContextFillPath(context)\n\n # Draw inner circle\n rect = CGRectMake(rect.origin.x + 2, rect.origin.y + 2, rect.size.width - 4, rect.size.height - 4)\n CGContextAddEllipseInRect(context, rect)\n CGContextSetFillColor(context, CGColorGetComponents(@fill_color || \"#EAEAEA\".to_color.CGColor))\n CGContextFillPath(context)\n end", "title": "" }, { "docid": "c15925c0348687cb9fba8a1432258e8c", "score": "0.5150805", "text": "def drawSolidLine(x0,y0,x1,y1,thickness=1,color=\"black\") ;\n @device.drawSolidLine(x0,y0,x1,y1,thickness,color) ;\n end", "title": "" }, { "docid": "42dd8942710f331aee9911f7f4a4747c", "score": "0.5142234", "text": "def pdf_bracket(pdf, x, y, w, h)\n r = 5\n\n pdf.stroke_style( PDF::Writer::StrokeStyle.new(1) )\n pdf.stroke_color( Color::RGB::Grey )\n pdf.rounded_rectangle(x, y, w, h, r).stroke # x, y, w, h, r\n \n pdf.stroke_style( PDF::Writer::StrokeStyle.new(8) )\n pdf.stroke_color( Color::RGB::White )\n pdf.rectangle(x + r + 6, y + 2, w - (2 * (r + 6)), -(h + 2) ).stroke\n end", "title": "" }, { "docid": "9ea789864470163ad8476de940109779", "score": "0.51264143", "text": "def draw_rect x, y, w, h, c\n @screen.fill_rect x, y, w, h, c\n @screen.fill_rect x + 1, y + 1, w - 2, h - 2, 0x000000\n end", "title": "" }, { "docid": "f3e19cbfcfec56878b5d94f5012c693b", "score": "0.5114005", "text": "def render_half(args,out,top_x,top_y, side_x,side_y,bottom_y,offx,offslope, tile)\n\n tilew = args.state.tilew\n\n # Combined slope of the top and bottom lines of the triangle formed\n # by this half of the quad. Effectively the amount of\n # *shear* we apply to the triangle.\n\n slope = (top_y+bottom_y-2*side_y)/(2*side_x-2*top_x)*tilew/64\n a = (0.5-slope) * 255 + 64\n a = 128 if a < 128\n\n # For each x positin in the triangle....\n xr = [top_x,side_x]\n (xr.min .. xr.max).each do |stripx|\n dx = (stripx-xr.min)*64/tilew\n h = (top_y-bottom_y)\n\n # ... render a 1 pixel wide strip of the tile texture.\n # \"offslope\" is an offset to account for rendering direction.\n out.sprites << {\n x: stripx,\n y: top_y-h-dx*slope+offslope*slope,\n w: 1,\n h: h,\n a: a,\n tile_x: offx+dx,\n tile_w: 1,\n path: \"sprites/#{tile}.png\"\n }\n end\nend", "title": "" }, { "docid": "257434292b31c5b65b207947e4381564", "score": "0.51100653", "text": "def outline=(outline)\n set_outline(outline)\n generate_buffers\n end", "title": "" }, { "docid": "250529964e1183cdd40ba27449b46d04", "score": "0.51073736", "text": "def stroke_bottom(stroke_width = 0.5)\n stored_line_width = line_width\n self.line_width = stroke_width\n horizontal_line 0, bounds.width, at: 0\n self.line_width = stored_line_width\n end", "title": "" }, { "docid": "eb8751ac784085c33beb92d9a36aa799", "score": "0.51036006", "text": "def box(x: 0, y: @pdf.cursor, w: @pdf.bounds.width, h:, border: false)\n @pdf.bounding_box [x, y], width: w, height: h do\n @pdf.stroke_bounds if border\n yield\n end\n end", "title": "" }, { "docid": "78b02b4eacad33ff07167bc8969fc0a2", "score": "0.50859463", "text": "def draw_circle_filled(cx,cy,r,color, z)\n c_color = convert_color(color)\n\n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color,\n cx - x2, cy + y2, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color,\n cx + x2, cy - y2, c_color, cx + x1, cy - y1, c_color, z\n @screen.draw_quad \\\n cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color,\n cx - y2, cy + x2, c_color, cx - y1, cy + x1, c_color, z\n @screen.draw_quad \\\n cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color,\n cx + y2, cy - x2, c_color, cx + y1, cy - x1, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color,\n cx + y1, cy - x1, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color,\n cx - y1, cy + x1, c_color, cx + x1, cy - y1, c_color, z\n end", "title": "" }, { "docid": "78b02b4eacad33ff07167bc8969fc0a2", "score": "0.50859463", "text": "def draw_circle_filled(cx,cy,r,color, z)\n c_color = convert_color(color)\n\n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color,\n cx - x2, cy + y2, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color,\n cx + x2, cy - y2, c_color, cx + x1, cy - y1, c_color, z\n @screen.draw_quad \\\n cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color,\n cx - y2, cy + x2, c_color, cx - y1, cy + x1, c_color, z\n @screen.draw_quad \\\n cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color,\n cx + y2, cy - x2, c_color, cx + y1, cy - x1, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color,\n cx + y1, cy - x1, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color,\n cx - y1, cy + x1, c_color, cx + x1, cy - y1, c_color, z\n end", "title": "" }, { "docid": "9de7ad96272bf8c4cef1e31eedafc9a6", "score": "0.5055746", "text": "def ease_out_quad(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d\n -c * t * (t - 2) + b\n end", "title": "" }, { "docid": "282846ea1e993fbd22f179df3e0290b8", "score": "0.50524396", "text": "def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end", "title": "" }, { "docid": "21eb7da2731c373953b0c9a004443385", "score": "0.5039203", "text": "def fill_rect(rect, color, zorder = 0)\r\n rect = Rect.new(rect) # Make sure it's a rect\r\n $window.draw_quad( rect.x, rect.y, color,\r\n rect.right, rect.y, color,\r\n rect.right, rect.bottom, color,\r\n rect.x, rect.bottom, color,\r\n zorder, :default)\r\n end", "title": "" }, { "docid": "801543d2d9047528a2770fc435053517", "score": "0.5027994", "text": "def draw_border(x1, y, mouse_x, mouse_y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n end \r\n end", "title": "" }, { "docid": "7a54f6fc55598f6ccaaa54736400f7d7", "score": "0.50259566", "text": "def border_as_solid_and_solid_as_border args\n border = [0, 0, 50, 50]\n args.outputs.borders << border\n args.outputs.solids << border\n\n # Red, green, blue saturations (last three parameters) can be any number between 0 and 255\n border_with_color = [0, 100, 50, 50, 255, 0, 0]\n args.outputs.borders << border_with_color\n args.outputs.solids << border_with_color\n\n border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color\n args.outputs.borders << border_with_nested_color\n args.outputs.solids << border_with_nested_color\n\n border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect\n args.outputs.borders << border_with_nested_rect\n args.outputs.solids << border_with_nested_rect\n\n border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color\n args.outputs.borders << border_with_nested_color_and_rect\n args.outputs.solids << border_with_nested_color_and_rect\nend", "title": "" }, { "docid": "be4564f297380c654af0a90ebc5c2557", "score": "0.50181586", "text": "def drawRectangle _obj, _args\n \"_obj drawRectangle _args;\" \n end", "title": "" }, { "docid": "2755ad57dc12eca3a72076e48a029713", "score": "0.50166035", "text": "def draw_graph_area(r,g,b,stripe=false)\r\n self.draw_filled_rectangle(@garea_x1,@garea_y1,@garea_x2,@garea_y2,r,g,b,false)\r\n self.draw_rectangle(@garea_x1,@garea_y1,@garea_x2,@garea_y2,r-40,g-40,b-40)\r\n if stripe\r\n r2 = r-15 \n r2 = 0 if r2<0\r\n g2 = r-15 \n g2 = 0 if g2 < 0\r\n b2 = r-15 \n b2 = 0 if b2 < 0\r\n line_color = allocate_color(r2,g2,b2)\r\n skew_width = @garea_y2-@garea_y1-1\r\n i = @garea_x1-skew_width\n while i<= @greax2\r\n x1 = i\n y1 = @garea_y2\n x2 = i+skew_width\n y2 = @garea_y1\r\n if ( x1 < @garea_x1 )\r\n x1 = @garea_x1\n y1 = @garea_y1 + x2 - @garea_x1 + 1\n end\r\n if ( x2 >= @garea_x2 )\r\n y2 = @garea_y1 + x2 - @garea_x2 +1\n x2 = @garea_x2 - 1 \n end\n image_line(@picture,x1,y1,x2,y2+1,line_color)\n i = i+4\r\n end\r\n end\r\n end", "title": "" }, { "docid": "6e9ec54526dad9209731d8ac364b7b72", "score": "0.5013346", "text": "def draw_edge\n print \"|\"\n end", "title": "" }, { "docid": "a479d963373f8c60a308b4e4c03cd652", "score": "0.5008444", "text": "def paint_border!(style, d)\n case style\n when :round_rect then d.roundrectangle(0, 0, width, height, 10, 10)\n # default is :round_rect, but treat anything unrecognized as :rectangle (use entire image)\n else d.rectangle(0, 0, width, height)\n end\n end", "title": "" }, { "docid": "a62e1f990e3ab8c5da1ff10e26c029fa", "score": "0.5005212", "text": "def draw_box(line_num)\n return if line_num < 1\n x = (line_height / 2) - 1\n y = @draw_y + (line_height / 2) - 1\n w = contents_width - 2*x\n h = (1 + line_num)*line_height\n draw_rect_outline_with_shadow(x, y, w, h) \n end", "title": "" }, { "docid": "e4692891819cdc046be919c9b32a4c45", "score": "0.49954194", "text": "def print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL\n if att.nil? \n att = Ncurses::A_NORMAL\n else\n att = get_attrib att\n end\n wattron(Ncurses.COLOR_PAIR(color) | att)\n mvwaddch row, col, Ncurses::ACS_ULCORNER\n mvwhline( row, col+1, Ncurses::ACS_HLINE, width-2)\n mvwaddch row, col+width-1, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, Ncurses::ACS_VLINE, height-1)\n\n mvwaddch row+height-0, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-0, col+1, Ncurses::ACS_HLINE, width-2)\n mvwaddch row+height-0, col+width-1, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-1, Ncurses::ACS_VLINE, height-1)\n wattroff(Ncurses.COLOR_PAIR(color) | att)\n end", "title": "" }, { "docid": "37d880b9449ee7440dfdb655956ddad6", "score": "0.4994074", "text": "def draw_triangle(depth, r, p1, p2, p3)\n if (depth == 1)\n p1.to_vertex(renderer)\n p2.to_vertex(renderer)\n p3.to_vertex(renderer)\n else\n # Calculate the mid points of this triangle.\n v1 = (p1 + p2) * 0.5\n v2 = (p2 + p3) * 0.5\n v3 = (p3 + p1) * 0.5\n unless (r == 0.0)\n # Project the verticies out onto the sphere with radius r.\n v1.normalize!\n v1 *= r\n v2.normalize!\n v2 *= r\n v3.normalize!\n v3 *= r\n end\n ## Generate the next level of detail\n depth -= 1\n draw_triangle(depth, r, p1, v1, v3)\n draw_triangle(depth, r, v1, p2, v2)\n draw_triangle(depth, r, v2, p3, v3)\n # Uncomment out the next line to include the central part of the triangle.\n # draw_triangle(depth, r, v1, v2, v3)\n end\nend", "title": "" }, { "docid": "0e552f1aa4dfc17b9e5e7084860ac05f", "score": "0.497061", "text": "def draw_vertex(x,y)\n self.draw_point(offx(x),offy(y),VERTICES)\n end", "title": "" }, { "docid": "072f1964caa8499634dfed1b5f36a14c", "score": "0.49668998", "text": "def fill_and_stroke\n cur_page.fill_and_stroke\n end", "title": "" }, { "docid": "bcafb1fb7075be173bef8f40cc4d55f5", "score": "0.49642402", "text": "def stroke(colorspec)\n primitive \"stroke #{enquote(colorspec)}\"\n end", "title": "" }, { "docid": "e192227f3a5aff49a6bfe82833b6d829", "score": "0.49587896", "text": "def top_border_stroke\n line_stroke(\n settings.border.style.top_left,\n settings.border.style.top_junc,\n settings.border.style.top_right\n ) do\n settings.border.style.top_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "title": "" }, { "docid": "c72617152b1402d7c67e553262d83435", "score": "0.49512678", "text": "def bezier x1, y1, cx1, cy1, cx2, cy2, x2, y2, c, l = 7\n h = self.h\n screen.draw_bezier x1, h-y1, cx1, h-cy1, cx2, h-cy2, x2, h-y2, l, color[c], :antialiased\n end", "title": "" }, { "docid": "edd5e6c5b6aff978c4e232624bbf7535", "score": "0.4950797", "text": "def stroke\n cur_page.stroke\n end", "title": "" }, { "docid": "227a421f84eee9a12febb6dda888b4fd", "score": "0.4936026", "text": "def sharkteeth(c,h)\n polygon([[0,0],[(h*0.02).to_i,(h*0.015).to_i],[0,(h*0.03).to_i]],:stroke=>\"none\",:fill=>c) # sharktooth from left to right\n end", "title": "" }, { "docid": "084f4aebc87a2bce64689a26fa927612", "score": "0.4931756", "text": "def render_point_big(x, y, color)\n @app.stroke color\n @app.strokewidth 2\n @app.nofill\n @app.oval x-1,y-1, 2\n end", "title": "" }, { "docid": "08117e45d8433ac256cfc21118e7d43f", "score": "0.49304748", "text": "def draw_graph_area(r,g,b,stripe=false)\n self.draw_filled_rectangle(@g_areax1,@g_area_y1,@g_area_x2,@g_area_y2,r,g,b,false)\n self.draw_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r-40,g-40,b-40)\n i=0\n if stripe\n r2 = r-15\n r2 = 0 if r2<0\n g2 = r-15\n g2 = 0 if g2 < 0\n b2 = r-15\n b2 = 0 if b2 < 0\n line_color = allocate_color(@picture,r2,g2,b2)\n skew_width = @g_area_y2-@g_area_y1-1\n \n i = @g_area_x1-skew_width\n \n while i.to_f<=@g_area_x2.to_f\n x1 = i\n y1 = @g_area_y2\n x2 = i+skew_width\n y2 = @g_area_y1\n if ( x1 < @g_area_x1 )\n x1 = @g_area_x1\n y1 = @g_area_y1 + x2 - @g_area_x1 + 1\n end\n if ( x2 >= @g_area_x2 )\n y2 = @g_area_y1 + x2 - @g_area_x2 +1\n x2 = @g_area_x2 - 1\n end\n image_line(@picture,x1,y1,x2,y2+1,r2,g2,b2)\n i = i+4\n end\n\n end\n end", "title": "" }, { "docid": "561c3c47cf9788938aface2be5fcc00b", "score": "0.4929606", "text": "def render\n # Every cell is an individual quad\n # using the propane grid convenience function instead of a nested loop\n grid(z.size - 1, z[0].size - 1) do |x, y|\n # one quad at a time\n # each quad's color is determined by the height value at each vertex\n # (clean this part up)\n no_stroke\n push_matrix\n begin_shape(PConstant::QUADS)\n translate(x * scl - w * 0.5, y * scl - h * 0.5, 0)\n fill(z[x][y] + 127, 220)\n vertex(0, 0, z[x][y])\n fill(z[x + 1][y] + 127, 220)\n vertex(scl, 0, z[x + 1][y])\n fill(z[x + 1][y + 1] + 127, 220)\n vertex(scl, scl, z[x + 1][y + 1])\n fill(z[x][y + 1] + 127, 220)\n vertex(0, scl, z[x][y + 1])\n end_shape\n pop_matrix\n end\n end", "title": "" }, { "docid": "e1a93b9ef710523cc987aefd7a07db24", "score": "0.49266702", "text": "def draw_triangle(x1:, y1:, x2:, y2:, x3:, y3:, stroke_width: 1, color: nil, colour: nil)\n draw_polyline closed: true,\n coordinates: [x1, y1, x2, y2, x3, y3],\n color: color, colour: colour, stroke_width: stroke_width\n end", "title": "" }, { "docid": "b1e866778046b468625bac5ba8ecec69", "score": "0.49130803", "text": "def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend", "title": "" }, { "docid": "7e7c171079e99566df33c4647ebd484f", "score": "0.4905014", "text": "def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end", "title": "" }, { "docid": "fa53bf370c1720894789d6ad14e211a6", "score": "0.49049795", "text": "def draw_cube(cube, cube_size)\n\n\t\t# Drawing the faces :\n\t\tglBegin(GL_QUADS)\n\n\t\tglColor3f(1.0, 0.5, 0.0)\n\t\tcube.faces_number.times do |f|\n\t\t\t4.times do |i|\n\t\t\t\tglColor3f(\tcube.vertex_colors[cube.faces[f][i]][0],\n\t\t\t\t\t\t\tcube.vertex_colors[cube.faces[f][i]][1],\n\t\t\t\t\t\t\tcube.vertex_colors[cube.faces[f][i]][2] )\n\t\t\t\tglVertex3f(\tcube.vertices[cube.faces[f][i]][0] * cube_size,\n\t\t\t\t\t\t\tcube.vertices[cube.faces[f][i]][1] * cube_size,\n\t\t\t\t\t\t\tcube.vertices[cube.faces[f][i]][2] * cube_size )\n\t\t\tend\n\t\tend\n\n\t\tglEnd\n\n\n\t\t# Drawing the lines :\n\t\tglColor3f(0.0, 0.0, 0.0)\n\t\tcube.faces_number.times do |f|\n\n\t\t\tglBegin(GL_LINE_LOOP)\n\n\t\t\t4.times do |i|\n\t\t\t\tglVertex3f(\tcube.vertices[cube.faces[f][i]][0] * cube_size,\n\t\t\t\t\t\t\tcube.vertices[cube.faces[f][i]][1] * cube_size,\n\t\t\t\t\t\t\tcube.vertices[cube.faces[f][i]][2] * cube_size )\n\t\t\tend\n\n\t\t\tglEnd\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "9a79bd0853f54ff82c6fcd3a05f01a3e", "score": "0.49040487", "text": "def draw\n lines = []\n\n indent = @height - 1\n draw_braches(lines, indent)\n\n lines\n end", "title": "" }, { "docid": "84c61fd7b5e001019200bbdd4af00871", "score": "0.48886907", "text": "def bezier x1, y1, cx1, cy1, cx2, cy2, x2, y2, c, l = 7\n screen.draw_bezier x1, y1, cx1, cy1, cx2, cy2, x2, y2, l, color[c], :antialiased\n end", "title": "" }, { "docid": "73ebbf7778774454ac03affa7e85b433", "score": "0.48883477", "text": "def add_quad( *args )\r\n entities = parent\r\n # Array Argument\r\n if args.size == 1 && args.is_a?( Enumerable )\r\n args = args[0]\r\n end\r\n if args.size == 1 && args.is_a?( Sketchup::Curve )\r\n # Curve\r\n curve = args[0]\r\n points = curve.vertices.map { |v| v.position }\r\n if points.size != 4\r\n raise( ArgumentError, 'Too many vertices in curve. Cannot create Quad.' )\r\n end\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Sketchup::Edge ) }\r\n # Edges\r\n loop = TT::Edges.sort( args )\r\n vertices = TT::Edges.sort_vertices( loop )\r\n points = vertices.map { |v| v.position }\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Points\r\n points = args\r\n elsif args.size == 3 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Triangle\r\n return parent.add_face( args )\r\n else\r\n raise( ArgumentError, 'Invalid arguments. Cannot create Quad.' )\r\n end\r\n # Create triangulated Quad if the quad is not planar.\r\n if TT::Geom3d.planar_points?( points )\r\n face = entities.add_face( points )\r\n QuadFace.new( face )\r\n else\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n QuadFace.new( face1 )\r\n end\r\n end", "title": "" }, { "docid": "44ed5e7bdbb4387cc65634e5de37aeb4", "score": "0.48791772", "text": "def ellipse_filled(x, y, rx, ry)\n\t\[email protected] x, y, rx, ry, @color_fg\n\tend", "title": "" }, { "docid": "a3426f8905fb88c32ba6e369b4ab7f1f", "score": "0.48783356", "text": "def drawRect(rect)\n #p \"draw Rect\"\n context = UIGraphicsGetCurrentContext()\n\n # Change Alpha of background if it hasnt been set\n if @alpha_view\n CGContextSetAlpha(context, @alpha_view)\n end\n\n # now draw the added toys\n CGContextBeginTransparencyLayer(context, nil)\n #@toys_in_scene.each { |toy| toy.update_image }\n @toys_in_scene.each { |toy| toy.draw(context) if toy != @selected }\n # Drawing Edges\n @strokes.each { |stroke| stroke.draw(context) if stroke != @selected }\n CGContextEndTransparencyLayer(context)\n\n # Restores Alpha\n if @alpha_view\n CGContextSetAlpha(context, 1.0)\n end\n\n if @secondary_selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @secondary_selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Draws what is selected on top\n if @selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Item currently being drawn\n if @points\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context)\n draw_partial_thing(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # If an effect needs a visual representation when applying, perform that here\n case @mode\n\n # Displays an arrow from selected to touched position\n when :force\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n @current_point = snap_to_45(@current_point, @selected.position)\n draw_force_arrow(context, @selected.position, @current_point)\n end\n\n # Explosion size with radius between selected and finger\n when :explosion\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n #draw_force_arrow(context, @selected.position, @current_point)\n length = Math.hypot(@selected.position.x - @current_point.x, @selected.position.y - @current_point.y)\n draw_force_circle(context, @selected.position, length)\n end\n\n # Rotation starting from left side, top implies clockwise, bottom anti-clockwise\n when :rotation\n if @current_point && @selected\n draw_rotate_circle(context, @selected.position, @current_point)\n else\n draw_static_rotate_circle(context, @selected.position)\n end\n\n when :create_new_toy\n if @current_point and @drag\n @selected.position = @current_point\n end\n end\n end", "title": "" }, { "docid": "8d431e0f8e529f1fe819adf41a132ccb", "score": "0.48660854", "text": "def create_pathdrawelement(line_width: 16.0, stroke_color: nil)\n strokeColor = stroke_color unless stroke_color.nil?\n strokeColor = MIColor.make_rgbacolor(0.2, 0.2, 0.2) if stroke_color.nil?\n arcBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n startX = $theWidth * 0.5 + $radius * Math.sin(-0.75 * Math::PI)\n startY = $theHeight * 0.5 + $radius * Math.cos(-0.75 * Math::PI)\n startPoint = MIShapes.make_point(startX, startY)\n arcBBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n thePath = make_arcpath(inBox: arcBBox, radius: $radius)\n pathDrawElement = MIDrawElement.new(:strokepath)\n pathDrawElement.arrayofpathelements = thePath\n pathDrawElement.startpoint = startPoint\n pathDrawElement.linewidth = line_width\n pathDrawElement.linecap = :kCGLineCapRound\n pathDrawElement.strokecolor = strokeColor\n pathDrawElement\nend", "title": "" }, { "docid": "825df45efb07e350c99a4aa5c4a72fdf", "score": "0.48533246", "text": "def draw(graphics)\n graphics.set_color @color.native_color\n graphics.draw @line\n end", "title": "" }, { "docid": "a96c274751527957aef58ffce2d5556b", "score": "0.48446453", "text": "def draw_graph_area(r,g,b,stripe=false)\n draw_filled_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r,g,b,false)\n draw_rectangle(@g_area_x1,@g_area_y1,@g_area_x2,@g_area_y2,r-40,g-40,b-40)\n i=0\n if stripe\n r2 = r-15\n r2 = 0 if r2<0\n g2 = r-15\n g2 = 0 if g2 < 0\n b2 = r-15\n b2 = 0 if b2 < 0\n line_color = allocate_color(@picture,r2,g2,b2)\n skew_width = @g_area_y2-@g_area_y1-1\n\n i = @g_area_x1-skew_width\n\n while i.to_f<=@g_area_x2.to_f\n x1 = i\n y1 = @g_area_y2\n x2 = i+skew_width\n y2 = @g_area_y1\n if ( x1 < @g_area_x1 )\n x1 = @g_area_x1\n y1 = @g_area_y1 + x2 - @g_area_x1 + 1\n end\n if ( x2 >= @g_area_x2 )\n y2 = @g_area_y1 + x2 - @g_area_x2 +1\n x2 = @g_area_x2 - 1\n end\n image_line(@picture,x1,y1,x2,y2+1,r2,g2,b2)\n i = i+4\n end\n\n end\n end", "title": "" }, { "docid": "88ec9ba0122eb4329e031650f10cdc0b", "score": "0.48435998", "text": "def ease_in_out_quad(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n\n t /= d / 2\n return c / 2 * t * t + b if t < 1\n t -= 1\n -c / 2 * (t * (t - 2) - 1) + b\n end", "title": "" }, { "docid": "db662140ea7a52c1c0f84a91a6b4802c", "score": "0.48432893", "text": "def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end", "title": "" }, { "docid": "13b14780bc2bd700a29cc728ae60de2e", "score": "0.48401806", "text": "def draw_rectangle(dpi, drawing)\n drawing.rectangle(\n 0,\n 0,\n (@field['sizex']*dpi).floor,\n (@field['sizey']*dpi).floor\n )\n end", "title": "" }, { "docid": "20e31e250ea1e42ad8dabd0d2b0bcd33", "score": "0.48398203", "text": "def print_employee_graphics_box(box)\n\n # Horizontal lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n self.line_width = 0.01.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n self.line_width = 0.02.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.125.in\n stroke_line([x, y], [x + 1.25.in, y])\n y -= 0.125.in\n self.line_width = 0.01.in\n stroke_line([x + 1.25.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.75.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 1.in, y])\n stroke_line([x + 2.5.in, y], [x + 3.75.in, y])\n y -= 0.25.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n y -= 0.375.in\n stroke_line([x, y], [x + 3.75.in, y])\n\n # Vertical lines (top to bottom, left to right).\n x = box[:x].in\n y = box[:y].in\n stroke_line([x, y], [x, y - 4.75.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 4.75.in])\n self.line_width = 0.02.in\n y -= 0.25.in\n stroke_line([x, y], [x, y - 0.375.in])\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n stroke_line([x + 3.75.in, y], [x + 3.75.in, y - 0.25.in])\n y -= 0.25.in\n self.line_width = 0.01.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 0.125.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n y -= 0.125.in\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.25.in])\n y -= 2.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.5.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 1.25.in])\n y -= 0.5.in\n stroke_line([x + 1.in, y], [x + 1.in, y - 0.75.in])\n y -= 0.75.in\n stroke_line([x + 0.3.in, y], [x + 0.3.in, y - 0.25.in])\n stroke_line([x + 1.4.in, y], [x + 1.4.in, y - 0.375.in])\n stroke_line([x + 2.6.in, y], [x + 2.6.in, y - 0.375.in])\n y -= 0.375.in\n stroke_line([x + 1.25.in, y], [x + 1.25.in, y - 0.375.in])\n stroke_line([x + 2.5.in, y], [x + 2.5.in, y - 0.375.in])\n\n # Text (top to bottom, left to right).\n x = box[:x]\n y = box[:y]\n self.vms_text_box(box[:title], x + 0.1, y, 2.4, 0.25, 7, :bold, :left, :center, nil, 'ff0000')\n self.vms_text_box(\"41-0852411\\nOMB No. 1545-0008\", x + 2.6, y, 1.15, 0.25, 6, :normal, :center, :center)\n y -= 0.25\n self.vms_text_box(\"<strong>a</strong> Employee's soc. sec. no.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>1</strong> Wages, tips, other comp.\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>2</strong> Federal income tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>3</strong> Social security wages\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>4</strong> Social security tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>b</strong> Employer ID number (EIN)\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>5</strong> Medicare wages and tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>6</strong> Medicare tax withheld\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>c</strong> Employer's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>d</strong> Control number\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>e</strong> Employee's name, address, and ZIP code\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"Suff.\", x + 0.05, y - 0.02, 3.65, _p(6), 6, :normal, :right, :top)\n y -= 0.75\n self.vms_text_box(\"<strong>7</strong> Social security tips\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>8</strong> Allocated tips\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>9</strong> Verification code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>10</strong> Dependent care benefits\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>11</strong> Nonqualified plans\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12a</strong> Code (See inst. for box 12)\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"<strong>13</strong> Statutory employee\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>14</strong> Other\", x + 1.05, y - 0.02, 1.4, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>12b</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Retirement plan\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12c</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.25\n self.vms_text_box(\"Third-party sick pay\", x + 0.05, y - 0.02, 0.9, _p(6), 6, :normal, :center, :top)\n self.vms_text_box(\"<strong>12d</strong> Code\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.5\n self.vms_text_box(\"<strong>15</strong> State Employer's ID Number\", x + 0.05, y - 0.02, 1.3, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>16</strong> State wages, tips, etc.\", x + 1.45, y - 0.02, 1.1, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>17</strong> State income tax\", x + 2.65, y - 0.02, 1.05, _p(6), 6, :normal, :left, :top)\n y -= 0.125\n self.vms_text_box(\"<strong>18</strong> Local wages, tips, etc.\", x + 0.05, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>19</strong> Local income tax\", x + 1.3, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n self.vms_text_box(\"<strong>20</strong> Locality name\", x + 2.55, y - 0.02, 1.15, _p(6), 6, :normal, :left, :top)\n y -= 0.375\n self.vms_text_box(\"2018\", x, y - 0.02, 3.75, 0.25, 8, :bold, :center, :top, nil, 'ff0000')\n self.vms_text_box(\"Form W-2 Wage and Tax Statement\", x, y - 0.04, 3.75, 0.125, 6, :bold, :left, :top, nil, 'ff0000')\n self.vms_text_box(\"Dept. of the Treasury -- IRS\", x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n y -= box[:bottom_left_offset]\n self.vms_text_box(box[:bottom_left], x, y - 0.04, 3.75, box[:bottom_left_height], 6, :normal, :left, :top)\n y -= box[:bottom_right_offset]\n self.vms_text_box(box[:bottom_right], x, y - 0.04, 3.75, 0.125, 6, :normal, :right, :top)\n\n end", "title": "" }, { "docid": "19a4b81aa2c671d9d2e7d93ea320bb5b", "score": "0.48320815", "text": "def paint_border(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:border] if theme[:border]\n options[:style] = :none if options[:style].nil?\n return if options[:style] == :none\n\n # first we need a stencil\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(\"white\")\n d.stroke(\"transparent\")\n paint_border!(options[:style], d)\n stencil = Magick::Image.new(width, height)\n stencil.matte_reset!\n d.draw(stencil)\n\n # now we place the graphics context over the stencil, causing any areas blocked (transparent pixels) by the stencil\n # to be blocked in the graphics context\n stencil.composite!(graphics_context, 0, 0, AtopCompositeOp)\n\n # then we need to retrace the border, this time using the colors we want\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(theme[:background][:color]) if theme[:background] and theme[:background][:color]\n d.stroke(options[:color] || theme[:stroke][:color]) if options[:color] || (theme[:stroke] && theme[:stroke][:color])\n paint_border!(options[:style], d)\n\n # finally, we can composite the stencil (which is now the actual image) back into the graphics context (which is\n # useless), and then commit the border to the finished product.\n graphics_context.composite!(stencil, 0, 0, CopyCompositeOp)\n d.draw(graphics_context)\n end", "title": "" }, { "docid": "c901201af260c0def7a600fb451e3093", "score": "0.48257303", "text": "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "title": "" }, { "docid": "bb3c125978a63f02e9b8cd1e917b3a23", "score": "0.482233", "text": "def drawrect(*)\n super\n end", "title": "" }, { "docid": "9e5f1c330261645bc0b2b477f4b310ed", "score": "0.4821141", "text": "def prv_print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL\n att ||= Ncurses::A_NORMAL\n case att.to_s.downcase\n when 'normal'\n att = Ncurses::A_NORMAL\n when 'underline'\n att = Ncurses::A_UNDERLINE\n when 'bold'\n att = Ncurses::A_BOLD\n when 'blink'\n att = Ncurses::A_BLINK # unlikely to work\n when 'reverse'\n att = Ncurses::A_REVERSE \n end\n attron(Ncurses.COLOR_PAIR(color) | att)\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-2)\n mvwaddch row, col+width-1, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-1)\n\n mvwaddch row+height-0, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-0, col+1, ACS_HLINE, width-2)\n mvwaddch row+height-0, col+width-1, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-1, ACS_VLINE, height-1)\n attroff(Ncurses.COLOR_PAIR(color) | att)\n end", "title": "" }, { "docid": "d1dc9d7277223512df8098365511460c", "score": "0.4819556", "text": "def draw_borders\n if borders.top > 0 # TODO: :none\n options = translate( x: margins.left, y: margins.top ).merge( width: width + margins.width, height: borders.top, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n \n if borders.bottom > 0 # TODO: :none\n options = translate( x: margins.left, y: offsets.top + padding.bottom ).merge( width: width + margins.width, height: borders.bottom, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n end", "title": "" }, { "docid": "4919ac97a18973bd2e5b85370c8ad7c3", "score": "0.4817597", "text": "def draw_shade_rect(rect, shade=active_shade, state=active_state)\n draw_fill_rect(rect, main_palette[\"#{shade}_ui_#{state}\"])\n end", "title": "" }, { "docid": "6c1654e8c687c622327a37f879dbfc21", "score": "0.48151952", "text": "def draw\n\t\tx, y, w, h = @position.x, @position.y, @size.x, @size.y\n\n\t\tl = x - w\n\t\tb = y - h\n\t\tr = x + w\n\t\tt = y + h\n\n\t\t@vertex_buffer.data = [\n\t\t# \tX\tY \tU \tV\n\n\t\t\tl,\tt,\t0, 0,\n\t\t\tr,\tt,\t1,\t0,\n\t\t\tl,\tb,\t0,\t1,\n\n\t\t\tr, \tt, \t1,\t0,\n\t\t\tr,\tb,\t1,\t1,\n\t\t\tl,\tb, \t0,\t1\n\t\t]\n\n\t\tGraphics.sprite_shader_program.use\n\t\[email protected]\n\n\t\tglBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA\n\t\tglDisable GL_POLYGON_SMOOTH\n\n\t\t@vertex_buffer.draw\n\t\tglBlendFunc GL_SRC_ALPHA, GL_ONE\n\t\tglEnable GL_POLYGON_SMOOTH if ANTIALIASING\n\tend", "title": "" }, { "docid": "99c207ab6aef0a65474a4c33cda7ef97", "score": "0.4811372", "text": "def line_stroke(left_border, junc_border, right_border, &block)\n stroke = ''\n stroke += left_border if settings.border.left?\n dimensions.num_cols.times do |col_num|\n stroke += junc_border if col_num > 0 && settings.border.inner_vert?\n stroke += yield\n end\n stroke += right_border if settings.border.right?\n stroke\n end", "title": "" }, { "docid": "ac3aaf8e8930f1f43445fbe349b0b671", "score": "0.48038134", "text": "def draw_win\n draw_quad( 0, 0, WTOP_COLOR,\n @width, 0, WTOP_COLOR,\n 0, @height, WBOTTOM_COLOR,\n @width, @height, WBOTTOM_COLOR,\n -1 )\n @endFont.draw(\"You win!\", @width/2 - 150, @height/2, 0, 4, 4, 0xFFFFFFFF)\n end", "title": "" }, { "docid": "36a555618a1f1cd307cbecf0e75872b2", "score": "0.47864372", "text": "def down_stroke(col: 0, top: 0, bot: 0, asc: 0, dsc: 0, left: 1, right: 1)\n\n x1 = xp + col*nw - (top*2*dx)*left\n x2 = xp + col*nw\n x3 = xp + col*nw + (bot*2*dx)*right\n\n y1 = yp + dy - asc*2*dy\n y2 = yp + dy + top*2*dy - asc*2*dy\n y3 = yp + 4*nib - dy - bot*2*dy + dsc*2*dy\n y4 = yp + 4*nib - dy + dsc*2*dy\n\n output = \"\"\n output += penline(x1, y1, x2, y2) if top > 0\n output += penline(x2, y2, x2, y3)\n output += penline(x2, y3, x3, y4) if bot > 0\n output\n end", "title": "" }, { "docid": "29d7c19966adc0c55899036550647b45", "score": "0.47811842", "text": "def stroke_antialias(bool)\n bool = bool ? '1' : '0'\n primitive \"stroke-antialias #{bool}\"\n end", "title": "" }, { "docid": "e265e2b69fb735069e6c157341bb6c73", "score": "0.47770593", "text": "def draw_turtle turtle\n last_x = last_y = 0\n Turtle.each_coord(turtle, false) do |x, y|\n x, y = x * StrokeLength, y * StrokeLength\n line last_x, last_y, x, y\n last_x, last_y = x, y\n end\n end", "title": "" }, { "docid": "a21322e8f2fefd8b67c3753935ce490d", "score": "0.47692624", "text": "def rect x, y, w, h, c, fill = false\n screen.draw_rect x, self.h-y-h, w, h, color[c], fill\n end", "title": "" }, { "docid": "2862b584edcffba91cb4e05796a64ec2", "score": "0.47573563", "text": "def draw(view)\r\n # show the wall base outline\r\n\r\n # draw the outline of the wall\r\n @corners = [] if not defined?(@corners)\r\n @corners[0] = @pts[0]\r\n @corners[1] = @pts[1]\r\n (a, b) = MM_HouseBuilder.draw_outline(view, @pts[0], @pts[1], @wall.width, @wall.justify, \"gray\")\r\n # puts \"a = \" + a.inspect\r\n @corners[2] = b\r\n @corners[3] = a\r\n @corners[4] = @pts[0]\r\n vec = @pts[1] - @pts[0]\r\n @wall.objects.each do |obj|\r\n vec.length = obj.center_offset - obj.width/2\r\n obj_start = @wall.origin + vec\r\n vec.length = obj.width\r\n obj_end = obj_start + vec\r\n if (defined?(@selected_obj) && (obj == @selected_obj))\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"red\", 3)\r\n else\r\n MM_HouseBuilder.draw_outline(view, obj_start, obj_end, @wall.width, @wall.justify, \"gray\")\r\n end\r\n end\r\n \r\n if ((@state == STATE_PICK) || (@state == STATE_MOVING))\r\n if (@pt_to_move)\r\n view.draw_points(@pt_to_move, 10, 1, \"red\");\r\n end\r\n if (@state == STATE_MOVING)\r\n view.set_color_from_line(@start_input_point.position, @pt_to_move)\r\n view.line_stipple = \".\" # dotted line\r\n view.draw(GL_LINE_STRIP, @start_input_point.position, @pt_to_move)\r\n end\r\n end\r\n \r\n @drawn = true\r\nend", "title": "" }, { "docid": "04e59d53c83e754516566f29a6478c8e", "score": "0.4756297", "text": "def stroke_alpha\n dsl.stroke.alpha if dsl.stroke\n end", "title": "" }, { "docid": "fc71633409d3bc7e3d0d2b59b6135a50", "score": "0.4752501", "text": "def display\n fill(50, 200, 200, 150)\n stroke(50, 200, 200)\n stroke_weight(2)\n ellipse(x, y, 16, 16)\n end", "title": "" }, { "docid": "e27bd3195916c30f0371f63eb21db811", "score": "0.4750996", "text": "def texture_fill_to_border(x, y, texture)\n texture_flood_fill(border_color, texture, x, y, FillToBorderMethod)\n end", "title": "" }, { "docid": "8e17a6a0d243fcfb75d1ac637b43e3e0", "score": "0.47411764", "text": "def draw(sx, sy, color=0xffffffff)\n if @type != \"vine_growth\"\n \t @invObj[milliseconds / 60.0 % @invObj.size].draw_rot(@x - sx, @y - sy, @z, (@angle/30).to_i*30, 0.5, 0.5, @size, 1, color)\n \t @glow.draw_rot(@x - sx, @y - 23 - sy, @z + 0.1, 0, 0.5, 0.5, 1, 1, 0xaaff6600, :additive) if @type==\"fire_pickup\"\n \telse\n \t #APICAL MERISTEM...\n \t @invObj[milliseconds / 200 % @invObj.size].draw_rot(@x - sx, @y - @growth_height - sy, @z+0.1, @angle, 0.5, 0.5, @size, 1, color)\n \t \n \t #ZONE OF ELONGATION\n \t @stems.each do |stem|\n \t stem[milliseconds / @speeds[@stems.index(stem)] % stem.size].draw_rot(@x - sx, @y - (@stems.index(stem)*92) - sy, @z, 0, 0.5, 0.5, 1, 1, color)\n end\n \tend\n end", "title": "" }, { "docid": "db9f8d8cd3d01a2e3c3323c143b6b745", "score": "0.47298595", "text": "def draw_squares()\n 0.upto(@w / 2) { |x|\n 0.upto(@h / 2) { |y|\n (0..1).each { |i|\n rect = [x * @bw * 2 + @bw * i, y * @bh * 2 + @bh * i, @bw, @bh]\n @im.fill_rect rect, @fg\n }\n }\n }\n end", "title": "" }, { "docid": "8ffea3a09088b5ace6a9658c6a50201a", "score": "0.47220206", "text": "def draw(interface)\n output \" | | \"\n output \" #{@squares[interface[:top_left]]} | #{@squares[interface[:top]]} | #{@squares[interface[:top_right]]} \"\n output \" | | \"\n output \"-----+-----+-----\"\n output \" | | \"\n output \" #{@squares[interface[:left]]} | #{@squares[interface[:middle]]} | #{@squares[interface[:right]]} \"\n output \" | | \"\n output \"-----+-----+-----\"\n output \" | | \"\n output \" #{@squares[interface[:bottom_left]]} | #{@squares[interface[:bottom]]} | #{@squares[interface[:bottom_right]]} \"\n output \" | | \"\n end", "title": "" }, { "docid": "06d0364b89d97a3ccebd7b576c6fa50b", "score": "0.47175622", "text": "def clear(color)\n color |= 0xff000000\n draw_quad 0, 0, color,\n width, 0, color,\n width, height, color,\n 0, height, color, 0\n end", "title": "" }, { "docid": "f657fcbe9c83ef8aa3fa947240d2bffc", "score": "0.47064984", "text": "def draw cairo, width, height\n cairo.save\n cairo.set_source_rgba 1, 1, 1, 1;\n cairo.operator = Cairo::OPERATOR_SOURCE\n cairo.paint\n cairo.restore\n\n HANDLES.each do |x, y|\n cairo.arc(x * width, y * height, 4, 0, Math::PI * 2)\n cairo.stroke\n end\n \n 0.step(1, 0.001) do |x|\n cairo.line_to(x * width, get_amplitude(x) * height)\n end\n cairo.stroke\n \n return cairo\n end", "title": "" }, { "docid": "048413971eab6cdb36c423a5b12999ae", "score": "0.47043678", "text": "def stroke(r=0, g=0, b=0, a=1.0)\n case r\n when Color\n g = r.g\n b = r.b\n a = r.a\n r = r.r\n end\n CGContextSetRGBStrokeColor(@ctx, r, g, b, a) # RGBA\n @stroke = true\n end", "title": "" }, { "docid": "513d67729b62a562d521c694b5e0fc84", "score": "0.46825686", "text": "def draw_rectangle(x1, y1, x2, y2, stroke = {}, fill = {})\n @svg_dp.draw_rectangle(x1, y1, x2, y2, stroke, fill)\n\n # Return self to support the builder pattern\n self\n end", "title": "" }, { "docid": "94f0c1b0a382caed8197e969e860acdd", "score": "0.46770778", "text": "def content_line_stroke(row_within_cell, vert_scrollbar)\n line_stroke(\n settings.border.style.left_vert,\n settings.border.style.middle_vert,\n settings.border.style.right_vert,\n ) do\n if settings.scrollbar.vert?\n PADDING * dimensions.inner_grid_width + vert_scrollbar[row_within_cell]\n else\n PADDING * dimensions.inner_grid_width\n end\n end\n end", "title": "" } ]
b057e7514b88aef3d533214caee199c8
PUT /chinabanks/1 PUT /chinabanks/1.xml
[ { "docid": "37e0f6e11a82088d532539e14ee15747", "score": "0.67562056", "text": "def update\n @chinabank = Chinabank.find(params[:id])\n\n respond_to do |format|\n if @chinabank.update_attributes(params[:chinabank])\n flash[:notice] = 'Chinabank was successfully updated.'\n format.html { redirect_to(@chinabank) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @chinabank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "3dcf86585efc3ff5d39f6326a1b80381", "score": "0.5709022", "text": "def create\n @chinabank = Chinabank.new(params[:chinabank])\n\n respond_to do |format|\n if @chinabank.save\n flash[:notice] = 'Chinabank was successfully created.'\n format.html { redirect_to(@chinabank) }\n format.xml { render :xml => @chinabank, :status => :created, :location => @chinabank }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chinabank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0494f4edb9129d63aa969e71e68cc3a4", "score": "0.5685956", "text": "def update\n @components_crank = Components::Crank.find(params[:id])\n\n respond_to do |format|\n if @components_crank.update_attributes(params[:components_crank])\n format.html { redirect_to(@components_crank, :notice => 'Crank was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_crank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03ec96376b10c9437125bce4f5f93b47", "score": "0.5456997", "text": "def set_contabank\n @contabank = Contabank.find(params[:id])\n end", "title": "" }, { "docid": "b4bb27e1379dd28e05b3605baeb6036a", "score": "0.54520077", "text": "def change(name, newname, new_home_phone = nil, new_office_phone = nil)\r\n id = name_to_id(name)\r\n options = { :name => newname }\r\n options[:home_phone] = new_home_phone unless new_home_phone.nil?\r\n options[:office_phone] = new_office_phone unless new_office_phone.nil?\r\n options = { :body => {:card => options} }\r\n self.class.put(\"/cards/#{id}.xml\", options)\r\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.5405391", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "58881f24dccfb2ef7f9c09dd106aa2f6", "score": "0.5391603", "text": "def update\n @wasabbi_rank = WasabbiRank.find(params[:id])\n\n respond_to do |format|\n if @wasabbi_rank.update_attributes(params[:wasabbi_rank])\n flash[:notice] = 'WasabbiRank was successfully updated.'\n format.html { redirect_to(@wasabbi_rank) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wasabbi_rank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ae2c71f6de8f314e295f29ac2676373", "score": "0.5381084", "text": "def set_hank\n @hank = Hank.find(params[:id])\n end", "title": "" }, { "docid": "dcebdacde2e8c4d19419d0590440b841", "score": "0.5379531", "text": "def test_AAH_put\n Help.empty\n rdf = Help.handle\n rdf.post( \"http://jackrdf/test/urn/1\", Help.root( \"sample/cite/urn_02.json\" ))\n rdf.put( \"http://jackrdf/test/urn/1\", Help.root( \"sample/cite/urn_03.json\" ))\n assert( true )\n end", "title": "" }, { "docid": "d61a25d69ed10b03601d4f17ba7d9ef3", "score": "0.5371999", "text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end", "title": "" }, { "docid": "d7a567914496c3830ab03a095171c00b", "score": "0.5362751", "text": "def destroy\n @chinabank = Chinabank.find(params[:id])\n @chinabank.destroy\n\n respond_to do |format|\n format.html { redirect_to(chinabanks_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "eab77c24707f0cc4cb885e96d7d36991", "score": "0.53417045", "text": "def update\n respond_to do |format|\n if @contabank.update(contabank_params)\n format.html { redirect_to @contabank, notice: 'Registro alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @contabank }\n else\n format.html { render :edit }\n format.json { render json: @contabank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da879d895a2237c9fe2d0586cd4b5149", "score": "0.5319333", "text": "def update\n respond_to do |format|\n if @hank.update(hank_params)\n format.html { redirect_to @hank, notice: 'Hank was successfully updated.' }\n format.json { render :show, status: :ok, location: @hank }\n else\n format.html { render :edit }\n format.json { render json: @hank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c1cf41ae3a0e0832108fa291a6e79c8", "score": "0.53141814", "text": "def test_should_update_group_via_API_XML\r\n get \"/logout\"\r\n put \"/groups/1.xml\", :group => { :name=>'renamed unit test group',\r\n :description=>'my new desc',\r\n :featured=>false }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "72df2710c0d82716f017abb27076ba7a", "score": "0.5238416", "text": "def update\n @companium = Companium.find(params[:id])\n\n respond_to do |format|\n if @companium.update_attributes(params[:companium])\n format.html { redirect_to(@companium, :notice => 'Companium was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @companium.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abbc225d6bbf7de862fede509873e874", "score": "0.5220429", "text": "def update\n @anketum = Anketum.find(params[:id])\n\n respond_to do |format|\n if @anketum.update_attributes(params[:anketum])\n format.html { redirect_to @anketum, notice: 'Anketum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @anketum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "713161fe04801b44f5b9cdb91a95fe89", "score": "0.5219217", "text": "def test_put\n request = Http::Request.new('PUT', '/file2', {}, 'hello')\n\n response = self.request(request)\n\n assert_equal(201, response.status, \"Incorrect status code received. Full response body: #{response.body_as_string}\")\n\n assert_equal(\n 'hello',\n @server.tree.node_for_path('file2').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.51910454", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "a48b3229e830876ae619b936301400b2", "score": "0.5172157", "text": "def put(url, xml, version = nil)\n req = Net::HTTP::Put.new(url)\n req.content_type = 'application/x-ssds+xml'\n \n if(!version.nil?)\n req['if-match'] = version;\n end\n \n req.content_length = xml.to_s.size.to_s\n req.basic_auth @username, @password\n req.body = xml.to_s\n execute_request(req)\n end", "title": "" }, { "docid": "a6174ef5c57f0350802d9d10f71b4a2e", "score": "0.51542366", "text": "def test_finder_put_success\n request = Http::Request.new(\n 'PUT',\n '/file2',\n { 'X-Expected-Entity-Length' => '5' },\n 'hello'\n )\n response = self.request(request)\n\n assert_equal(201, response.status)\n\n assert_equal(\n 'hello',\n @server.tree.node_for_path('file2').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "91ef9726aa4677a8178a4e31a11a713c", "score": "0.5143927", "text": "def update\n @jackrabbit = Jackrabbit.find(params[:id])\n\n respond_to do |format|\n if @jackrabbit.update_attributes(params[:jackrabbit])\n format.html { redirect_to @jackrabbit, notice: 'Jackrabbit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jackrabbit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f43d79cb8ce757f5e82d8476fd01962", "score": "0.51390433", "text": "def test_should_update_topic_via_API_XML\r\n get \"/logout\"\r\n put \"/forum_topics/1.xml\", :forum_topic => {:title=>'Updated API Test Topic',\r\n :description=>'Updated Test topic desc',\r\n :user_id=>1}\r\n assert_response 401\r\n end", "title": "" }, { "docid": "4d597ec4ae1f1f28bc82841bce42b7bc", "score": "0.51339304", "text": "def show\n @chinabank = Chinabank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chinabank }\n end\n end", "title": "" }, { "docid": "75257bcacbc16f7963754f7d8ca9fb70", "score": "0.5133453", "text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n \n \n format.xml \n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "014e3ebc15fd73b9356ac16dfe94e4a7", "score": "0.51063854", "text": "def update\n respond_to do |format|\n if @chib.update(chib_params)\n format.html { redirect_to @chib, notice: 'Chib was successfully updated.' }\n format.json { render :show, status: :ok, location: @chib }\n else\n format.html { render :edit }\n format.json { render json: @chib.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ee16c7f55e2d17dd5872a37270b9aaf", "score": "0.5101058", "text": "def update\n @canchitum = Canchitum.find(params[:id])\n\n respond_to do |format|\n if @canchitum.update_attributes(params[:canchitum])\n format.html { redirect_to @canchitum, notice: 'Canchitum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @canchitum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e75a9f394d09816594fb5c64ce328690", "score": "0.5085945", "text": "def update\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n if @rank.update_attributes(rank_params)\n format.html { redirect_to(@rank, :notice => 'Rank was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a1f73dc9f612a4186e02af2632d3757", "score": "0.50799876", "text": "def update\n @upstream_channel = UpstreamChannel.find(params[:id])\n\n respond_to do |format|\n if @upstream_channel.update_attributes(params[:upstream_channel])\n flash[:notice] = 'UpstreamChannel was successfully updated.'\n format.html { redirect_to(upstream_channels_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @upstream_channel.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4c62c471bf9037693b2a5cefc531e1d", "score": "0.50739694", "text": "def update\n @hub = Hub.find(params[:id])\n\n respond_to do |format|\n if @hub.update_attributes(params[:hub])\n flash[:notice] = 'Hub was successfully updated.'\n format.html { redirect_to(@hub) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hub.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf249f1e13a03d44876af3f5f78dd5d0", "score": "0.50695527", "text": "def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n format.html { redirect_to(@bank) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\", message: \"成功更新银行!\"}'}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank.errors, :status => :unprocessable_entity }\n format.json { render :text => \"{status: 'failed', error:#{@bank.errors.full_messages.to_json}}\"}\n end\n end\n end", "title": "" }, { "docid": "7e5333ea5caf7f1c94f47f4d6b9e68a2", "score": "0.50646645", "text": "def update\n @bank_info = BankInfo.find(params[:id])\n\n respond_to do |format|\n if @bank_info.update_attributes(params[:bank_info])\n format.html { redirect_to(@bank_info, :notice => 'Bank info was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f673a7a533288445259993d1adeeb4e", "score": "0.5061113", "text": "def update\n @club = Club.find_by_web_name(params[:id], :include => :tags)\n respond_to do |format|\n if @club.update_attributes(params[:club])\n\t\t\t @club.set_settings(!params[:home_page][:page].blank? && params[:home_page][:page] != '0', 'HomePage', 'pages', params[:home_page][:page], true)\n flash[:notice] = 'Club was successfully updated.'\n format.html { redirect_to(club_admin_index_path(@club)) }\n format.xml { head :ok }\n else\n\t\t\t\t@homePage = @club.settings.new\n\t\t\t\[email protected] = params[:home_page][:page]\n @pagelist = @club.all_pages\n @page_title = \"Editing \"[email protected]\n @site_section = \"admin\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a7f5faf6fd5c136c01f2fec73305097", "score": "0.5058815", "text": "def set_chib\n @chib = Chib.find(params[:id])\n end", "title": "" }, { "docid": "421c43af99bc43cbba604c42bdf2ca34", "score": "0.5058404", "text": "def update\n @habit = Habit.find(params[:id])\n\n if @habit.update(habit_params)\n head :no_content\n else\n render json: @habit.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "745fd7b8c1ca9439fe0b33bd40487043", "score": "0.5053986", "text": "def update(name, newname, new_home_phone = nil, new_office_phone = nil)\n id = name_to_id(name)\n card_opts = { :name => newname }\n card_opts[:home_phone] = new_home_phone unless new_home_phone.nil?\n card_opts[:office_phone] = new_office_phone unless new_office_phone.nil?\n\n options = { :body => {:card => card_opts} }\n self.class.put(\"/cards/#{id}.xml\", options)\n end", "title": "" }, { "docid": "cc4d059bb5e3745d00519b51ceafa0b0", "score": "0.5051007", "text": "def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n flash[:notice] = 'Bank was successfully updated.'\n format.html { redirect_to(@bank) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc4d059bb5e3745d00519b51ceafa0b0", "score": "0.5051007", "text": "def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n flash[:notice] = 'Bank was successfully updated.'\n format.html { redirect_to(@bank) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55f41b1fa794bc4915bf6505779341ad", "score": "0.50507295", "text": "def update_bank_details\n @employee = Employee.shod(params[:format])\n params[:banks].each_pair do |k, v|\n @bank_info = EmployeeBankDetail.up(@employee, k)\n @bank_info.update(bank_info: v[:bank_info])\n end\n update_bank_details2\n authorize! :read, @employee\n end", "title": "" }, { "docid": "fca13511f141003e35f89ef5c9cec7f0", "score": "0.50501984", "text": "def update\n @hub = Hub.find(params[:id])\n\n respond_to do |format|\n if @hub.update_attributes(params[:hub])\n format.html { redirect_to(@hub, :notice => 'Hub was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hub.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22515268023f586d3e0b815518aa9bc1", "score": "0.5049274", "text": "def update\n @channel_index = ChannelIndex.find(params[:id])\n\n respond_to do |format|\n if @channel_index.update_attributes(params[:channel_index])\n format.html { redirect_to(@channel_index, :notice => 'Channel index was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @channel_index.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2db8510634a8588feaf130b0ace4c384", "score": "0.5044385", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :api_key => 'testapikey',\r\n :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "6be19646a1c7b2bae970008f4e3204d6", "score": "0.50441384", "text": "def update\n @draft_company_category = DraftCompanyCategory.find(params[:id])\n\n respond_to do |format|\n if @draft_company_category.update_attributes(params[:draft_company_category])\n\n format.xml \n else\n \n format.xml \n end\n end\n end", "title": "" }, { "docid": "545dadbe32aa3d9d0edf1d22293783fc", "score": "0.50434244", "text": "def test_put_existing\n request = Http::Request.new('PUT', '/file1', {}, 'bar')\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'bar',\n @server.tree.node_for_path('file1').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "99d24a74bc96db3bd84b0451ef3afb5f", "score": "0.5040049", "text": "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", "title": "" }, { "docid": "1be28d2beade0981caee67d3294ed63c", "score": "0.50400096", "text": "def update\n @cash_register = CashRegister.scopied.find(params[:id])\n\n respond_to do |format|\n if @cash_register.update_attributes(params[:cash_register])\n format.html { render :action => 'edit', :notice => 'Cash register was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_register.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "238fd956be713471aa406c76bf19254a", "score": "0.50399995", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :status_post => {:body => 'API Status Post 1' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "c16e8da224c52c856a9283b7f7c163e0", "score": "0.50352186", "text": "def update\n @comptype = Comptype.find(params[:comptype][:id])\n\n respond_to do |format|\n if @comptype.update_attributes(params[:comptype])\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "ad54471b285e5e357d9be959c8ade2d8", "score": "0.5029484", "text": "def update\n path = \"/workflow/#{repo}/objects/druid:#{druid}/workflows/#{workflow}/#{step}\"\n conn = Faraday.new(url: config['host'])\n conn.basic_auth(config['user'], config['password'])\n conn.headers['content-type'] = 'application/xml'\n\n conn.put path, payload\n end", "title": "" }, { "docid": "e73e00a895505e346523d09b72e76a9d", "score": "0.50227714", "text": "def index\n @cash_registers = CashRegister.scopied.page(params[:page])\n CashRegister.update_all_devicenodes\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cash_registers }\n end\n end", "title": "" }, { "docid": "1b15e877239bad57f84db4bdadf25b80", "score": "0.5022286", "text": "def set_ot_jinzai_bank\n @ot_jinzai_bank = OtJinzaiBank.find(params[:id])\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.50210464", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "6ffe968ef267ece35b0e8b67615451d6", "score": "0.50177455", "text": "def update\n @company_branch = CompanyBranch.find(params[:id])\n\n respond_to do |format|\n if @company_branch.update_attributes(params[:company_branch])\n format.html { redirect_to(@company_branch, :notice => 'Company branch was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_branch.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b84bcac0c439e1c44e74099f311dbf0", "score": "0.50083965", "text": "def create\n @chib = Chib.new(chib_params)\n @cLevel = Level.find(@chib.level_id)\n @cLevel.chib_count = @cLevel.chib_count + 1\n @cLevel.save\n\n respond_to do |format|\n if @chib.save\n format.html { redirect_to @chib, notice: 'Chib was successfully created.' }\n format.json { render :show, status: :created, location: @chib }\n else\n format.html { render :new }\n format.json { render json: @chib.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72ab3f2643692ca995ef5bf6ffac7007", "score": "0.50023234", "text": "def input(input)\n RestClient.post(request_url, '<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>'+input+'</Input_Sel></Input></Main_Zone></YAMAHA_AV>', :content_type => \"text/xml\")\n end", "title": "" }, { "docid": "7b69e5f2961c42213ec8432bfc8e70b1", "score": "0.4993015", "text": "def update\n @microhood = Microhood.find(params[:id])\n\n respond_to do |format|\n if @microhood.update_attributes(params[:microhood])\n format.html { redirect_to(@microhood, :notice => 'Microhood was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @microhood.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85cdc250ba85d36106660986c95d1cf9", "score": "0.49929154", "text": "def update\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n if @climb.update_attributes(params[:climb])\n flash[:notice] = 'Climb was successfully updated.'\n format.html { redirect_to(@climb) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @climb.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "329df16eeb909ff8683c05fb85f07ea0", "score": "0.49918756", "text": "def update\n @subrack_name = SubrackName.find(params[:id])\n\n respond_to do |format|\n if @subrack_name.update_attributes(params[:subrack_name])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subrack_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "579055959b16b387fe94c4a4e647937a", "score": "0.49884412", "text": "def update\n \n @bank_account = BankAccount.find(params[:id])\n\n respond_to do |format|\n if @bank_account.update_attributes(params[:bank_account])\n format.html { redirect_to admin_organism_bank_accounts_url(@organism), notice: 'Le compte bancaire a été mis à jour.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bank_account.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4dc40d9cc02d28599a75d6e2e9b4e92", "score": "0.498582", "text": "def update\n @king = King.find(params[:id])\n\n respond_to do |format|\n if @king.update_attributes(params[:king])\n format.html { redirect_to(@king, :notice => 'King was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @king.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c8f03a2633f8f9d583c3fe73716aafc", "score": "0.49789706", "text": "def update_xml(xml, value)\r\n xml\r\n end", "title": "" }, { "docid": "c4dce06a5c474d1953b89e3a42ba1b23", "score": "0.49781165", "text": "def update\n @bank_account = BankAccount.find(params[:id])\n\n respond_to do |format|\n if @bank_account.update_attributes(params[:bank_account])\n format.html { redirect_to(@bank_account, :notice => 'Bank account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank_account.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e2a5831197faf97e4ad37dde0d9c6e0", "score": "0.4974943", "text": "def update\n @netzkenaic = Netzkenaic.find(params[:id])\n\n respond_to do |format|\n if @netzkenaic.update_attributes(params[:netzkenaic])\n format.html { redirect_to(@netzkenaic, :notice => 'Netzkenaic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @netzkenaic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a70151d1b548969f237388e7429b150", "score": "0.4973516", "text": "def update_rest\n @v1_page_usage = V1PageUsage.find(params[:id])\n\n respond_to do |format|\n if @v1_page_usage.update_attributes(params[:v1_page_usage])\n flash[:notice] = 'V1PageUsage was successfully updated.'\n format.html { redirect_to(@v1_page_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @v1_page_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbde8b28053c2929f864d7a6163d1db3", "score": "0.4969492", "text": "def update\n @crumb = Crumb.find(params[:id])\n\n respond_to do |format|\n if @crumb.update_attributes(params[:crumb])\n format.html { redirect_to @crumb, notice: 'Crumb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crumb.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbde8b28053c2929f864d7a6163d1db3", "score": "0.49689087", "text": "def update\n @crumb = Crumb.find(params[:id])\n\n respond_to do |format|\n if @crumb.update_attributes(params[:crumb])\n format.html { redirect_to @crumb, notice: 'Crumb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crumb.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62f5eb12d8174e1ff9983a9757a44239", "score": "0.49630237", "text": "def update\n @knack = Knack.find(params[:id])\n \n respond_to do |format|\n if @knack.update_attributes(params[:knack])\n format.html { redirect_to :action => \"edit\" }\n format.json { render json: @knack }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @knack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "294067006cdaaf31ffa6e13d1a2ef6a6", "score": "0.4958437", "text": "def set_anketum\n @anketum = Anketum.find(params[:id])\n end", "title": "" }, { "docid": "264dddfdaf22cfc10e42e61d9a5c7f0d", "score": "0.49567932", "text": "def update\n respond_to do |format|\n if @hz_bank.update(hz_bank_params)\n format.html { redirect_to @hz_bank, notice: 'Bank was successfully updated.' }\n format.json { render :show, status: :ok, location: @hz_bank }\n else\n format.html { render :edit }\n format.json { render json: @hz_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e28e53cc6a046657398add19da32118", "score": "0.4955222", "text": "def put(path, arguments = {})\n Mavenlink.logger.note \"Started PUT /#{path} with #{arguments.inspect}\"\n parse_request(connection.put(path, arguments))\n end", "title": "" }, { "docid": "fe3f97a24e4f378adae0d759b11f809b", "score": "0.4952449", "text": "def update\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n if @rank.update_attributes(params[:rank])\n format.html { redirect_to @rank, notice: 'Rank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c1840686bdd6821da6fea24a334adbc", "score": "0.49457455", "text": "def update\n @member = Band.find(params[:band_id]).members.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(member_params)\n format.html { redirect_to([@member.band, @member], :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b6e8ef310d170e4cb30996f59ef341e", "score": "0.49437007", "text": "def update_nexus(companyId, id, model) path = \"/api/v2/companies/#{companyId}/nexus/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "fa86b3fa6e59e04ff28b64a79d201c56", "score": "0.49431622", "text": "def update_crumbs\n\t\t\t@crumb = JSON.parse(get_json('/crumbIssuer').body)\n\t\tend", "title": "" }, { "docid": "ae1c2fbc4d659056b7d7a492e6722d9a", "score": "0.49407166", "text": "def update\n @aankoop = Aankoop.find(params[:id])\n\n respond_to do |format|\n if @aankoop.update_attributes(params[:aankoop])\n flash[:notice] = 'Aankoop was successfully updated.'\n format.html { redirect_to(@aankoop) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aankoop.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae1c2fbc4d659056b7d7a492e6722d9a", "score": "0.49407166", "text": "def update\n @aankoop = Aankoop.find(params[:id])\n\n respond_to do |format|\n if @aankoop.update_attributes(params[:aankoop])\n flash[:notice] = 'Aankoop was successfully updated.'\n format.html { redirect_to(@aankoop) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aankoop.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0057ad2c462122322e6e67cbec98a3eb", "score": "0.49368247", "text": "def update\n @bank_account = BankAccount.find(params[:id])\n\n respond_to do |format|\n if @bank_account.update_attributes(params[:bank_account])\n flash[:notice] = 'BankAccount was successfully updated.'\n format.html { redirect_to(@bank_account) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bank_account.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f69e4b8c58a60dfd2cf2d6baa45b662", "score": "0.49322817", "text": "def update\n @bracket_node = BracketNode.find(params[:id])\n\n respond_to do |format|\n if @bracket_node.update_attributes(params[:bracket_node])\n format.html { redirect_to(@bracket_node, :notice => 'BracketNode was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bracket_node.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "301983cce9f804adbe61406ebdbd47c8", "score": "0.49322262", "text": "def update\n @branch = Branch.find(params[:id])\n\n respond_to do |format|\n if @branch.update_attributes(params[:branch])\n format.html { redirect_to(\"/settings/show#branch\", :notice => 'Branch was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c2de72af2ee33f0fdf16be6025147e0", "score": "0.49243677", "text": "def update\n if @bank_card_bin.update(bank_card_bin_params)\n record_activities('修改', '卡bin', @bank_card_bin.bank_bin)\n flash[:success] = '修改卡bin成功'\n redirect_to bank_card_bins_path\n else\n flash[:error] = \"修改失败: #{@bank_card_bin.errors.full_message}\"\n render :edit\n end\n end", "title": "" }, { "docid": "91e222f5e4ec3e3bdb488c250d77c6dd", "score": "0.4920595", "text": "def update\n @component = Component.find(params[:component][:id])\n\n respond_to do |format|\n if @component.update_attributes(params[:component])\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "a1180b85a98a5e652f2c5f2f1e253ca7", "score": "0.4920425", "text": "def put\n end", "title": "" }, { "docid": "d0fba1bf3c5e1dc0008c27994e1dabe4", "score": "0.49198478", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "46bd58534d5df9c3f84d3d989571b87a", "score": "0.49195862", "text": "def api_update(xml = false)\n # First, delete all old implants\n begin\n api = set_api\n xml = api.get(\"char/CharacterSheet\")\n rescue Exception => e\n logger.warn e.inspect\n else\n a = [\"memory\", \"intelligence\", \"willpower\", \"perception\", \"charisma\"]\n a.each do |attribute|\n attribute_xpath = \"/eveapi/result/attributeEnhancers/\" + attribute + \"Bonus/augmentator\"\n send(:\"#{attribute}_name=\", xml.xpath(attribute_xpath + \"Name\").text)\n send(:\"#{attribute}_value=\", xml.xpath(attribute_xpath + \"Value\").text.to_i)\n end\n end\n self.save\n end", "title": "" }, { "docid": "9fad2e74a9e742c0a48a92f6ecd90e17", "score": "0.4914943", "text": "def update\n respond_to do |format|\n if @ot_jinzai_bank.update(ot_jinzai_bank_params)\n format.html { redirect_to @ot_jinzai_bank, notice: 'Ot jinzai bank was successfully updated.' }\n format.json { render :show, status: :ok, location: @ot_jinzai_bank }\n else\n format.html { render :edit }\n format.json { render json: @ot_jinzai_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b58dcb674745e5d70f3957b6c801fb4a", "score": "0.49141592", "text": "def update\n id = params[:id]\n p = {:servernode => {:name => params[:servernode][:name],\n :status=>params[:servernode][:status]}}\n @servernode = Servernode.find(params[:id])\n @servernode.update(servernode_params)\n RestClient.put(\"http://localhost:3000/servernodes/#{id}\",p)\n render :nothing => :true\n end", "title": "" }, { "docid": "de98cec4c7458772a9efd2f435fd2bc5", "score": "0.49117404", "text": "def update_account(id, model) path = \"/api/v2/accounts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "a2abaea7eb23530e64c3f72049a5c3cb", "score": "0.49111152", "text": "def update_xml(xml, value)\n xml\n end", "title": "" }, { "docid": "c2dd23823439ade588d0cbb46b35b722", "score": "0.49086285", "text": "def update\n respond_to do |format|\n if @anketum.update(anketum_params)\n format.html { redirect_to @anketum, notice: 'Anketum was successfully updated.' }\n format.json { render :show, status: :ok, location: @anketum }\n else\n format.html { render :edit }\n format.json { render json: @anketum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c31ec49a0d8d0c8c8f29ab417257c99", "score": "0.48980242", "text": "def update\n @question_bank = QuestionBank.find(params[:id])\n\n respond_to do |format|\n if @question_bank.update_attributes(params[:question_bank])\n format.html { redirect_to @question_bank, notice: 'Question bank was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2752d857d53f4c5454f55b3a7f2aa54c", "score": "0.48969707", "text": "def test_update_stat\n\t\tput '/stats/8', {json: '{\"statkey\":\"m\", \"statvalue\": \"i\"}'}\n\t\tassert_equal 'm', @j[:name]\n\t\tassert_equal 'i', @j[:value]\n\t\tput '/stats/99', {json: '{\"statkey\":\"m\"}'}\n\t\tassert_equal 'Not Found', @j[:title]\n\t\tput '/stats/8', {json: '{\"person_id\":\"boop\"}'}\n\t\tassert @j[:title].include? 'invalid input syntax'\n\tend", "title": "" }, { "docid": "660b5f01211ffbcde806e569a07717cc", "score": "0.48957986", "text": "def create\n @components_crank = Components::Crank.new(params[:components_crank])\n\n respond_to do |format|\n if @components_crank.save\n format.html { redirect_to(@components_crank, :notice => 'Crank was successfully created.') }\n format.xml { render :xml => @components_crank, :status => :created, :location => @components_crank }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @components_crank.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93f05af19a686727c881c1e9ae235b0e", "score": "0.48947397", "text": "def update\n @hero_con = HeroCon.find(params[:id])\n\n respond_to do |format|\n if @hero_con.update_attributes(params[:hero_con])\n format.html { redirect_to(@hero_con, :notice => 'Hero con was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hero_con.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb2b8c5df8f8574eb7d10990f8d83c02", "score": "0.48946652", "text": "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n flash[:notice] = 'Club was successfully updated.'\n format.html { redirect_to('/clubs') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "266d354d792aaacc5eaeb6a2d7e6ea47", "score": "0.4894247", "text": "def update\n @branch = Branch.find(params[:id])\n\n respond_to do |format|\n if @branch.update_attributes(params[:branch])\n flash[:notice] = 'Branch was successfully updated.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c99238efa98a6e05678c5d303dd5515d", "score": "0.48820877", "text": "def update_ticket(ticket_num)\n \n url = ['/tickets/',ticket_num,'.xml'].join\n result = @connection.put url, \n (\n xml = Builder::XmlMarkup.new( :indent => 2 )\n xml.instruct! :xml, :encoding => \"UTF-8\"\n xml.ticket do |t|\n t.tag! \"solved-at\", Time.now\n t.tag! \"status-id\", \"3\"\n end\n )\n end", "title": "" }, { "docid": "e819887e3b12aa89e5e7607764a5f61a", "score": "0.48791894", "text": "def update\n @tank = Tank.find(params[:id])\n\n respond_to do |format|\n if @tank.update_attributes(params[:tank])\n format.html { redirect_to @tank, notice: 'Tank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "742e4ad7aa628b4453c3db170d3bdcaa", "score": "0.48737362", "text": "def edit_xml_node(arg=nil)\n #select the needed node which index is given.\n node = @launch_xml.selectSingleNode(\"/Launch/Testcase[@index=#{arg[0]}]\")\n if node.haschildnodes then\n for i in (0..node.childNodes.length-1)\n node.childnodes.item(i).text = arg[i+1]\n #puts node.childnodes.item(i).nodename\n #puts node.childnodes.item(i).text\n end\n end\n #save xml file\n @launch_xml.save(@path)\n return @launch_xml\n end", "title": "" }, { "docid": "2dea35905fc3536e6f803a4f2e3321d0", "score": "0.48721206", "text": "def update\n @club = Club.find(params[:id])\n \n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n format.html { redirect_to(@club, :notice => 'Club was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb2d6b4f1aa87c4afb74094ce02f3c26", "score": "0.48704955", "text": "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n flash[:notice] = 'Club was successfully updated.'\n format.html { redirect_to(@club) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb2d6b4f1aa87c4afb74094ce02f3c26", "score": "0.48704955", "text": "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n flash[:notice] = 'Club was successfully updated.'\n format.html { redirect_to(@club) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04358e5d3400d8055a8561707f1f8f13", "score": "0.4867282", "text": "def update\n @bank.update(bank_params)\n @banks = Bank.all\n @bank = Bank.new\n end", "title": "" } ]
d6a031ca79a835e3ffdb16bf0e875d82
Returns the string value of the token.
[ { "docid": "b0d4227caf5b51c7199379ed7edaf4d1", "score": "0.76658654", "text": "def to_s\n @token\n end", "title": "" } ]
[ { "docid": "fcdef87c0e9e8f4e4fecf3fdc73d59ff", "score": "0.82070637", "text": "def token_string\n @token\n end", "title": "" }, { "docid": "c1b935889dce759ae4da4210113a4700", "score": "0.81460303", "text": "def string_value(token); end", "title": "" }, { "docid": "c1b935889dce759ae4da4210113a4700", "score": "0.81460303", "text": "def string_value(token); end", "title": "" }, { "docid": "2b7d0d51062e59f7f160c7641666cacf", "score": "0.79417634", "text": "def to_str\n @token\n end", "title": "" }, { "docid": "ddd9428a44e841924bfceeb759ac893b", "score": "0.7916983", "text": "def value\n @token\n end", "title": "" }, { "docid": "6d995b80e16e4cdf1c734e873fa94d53", "score": "0.7751597", "text": "def value\n if atomic?\n @tokens[0]\n else\n @tokens.map { |v| v.is_a?(::String) ? v.inspect : v }.join(' # ')\n end\n end", "title": "" }, { "docid": "59c2c3a29c7ccc3f983eeaa76c1950e5", "score": "0.7744346", "text": "def to_s\n token\n end", "title": "" }, { "docid": "59c2c3a29c7ccc3f983eeaa76c1950e5", "score": "0.7744346", "text": "def to_s\n token\n end", "title": "" }, { "docid": "1e51a08ab98e41c0d3649399445f556a", "score": "0.7652403", "text": "def to_s\n @token\n end", "title": "" }, { "docid": "1e51a08ab98e41c0d3649399445f556a", "score": "0.7652403", "text": "def to_s\n @token\n end", "title": "" }, { "docid": "498c6aae9983213acf691c899da651f0", "score": "0.7448782", "text": "def token_to_s(token)\n token\n end", "title": "" }, { "docid": "80a2d9d95e8c4f626f2ada5bab79c191", "score": "0.7369008", "text": "def get_token_text\n thing = @tokens[@position]\n return thing[0].text\n\n end", "title": "" }, { "docid": "ee828adc7395eca1a7ceaca5ff2bf048", "score": "0.7365455", "text": "def to_s\n self.token\n end", "title": "" }, { "docid": "5dc8cfa4f4d83330c237cecc4a97ca23", "score": "0.7260027", "text": "def token_literal\n @token.literal\n end", "title": "" }, { "docid": "5dc8cfa4f4d83330c237cecc4a97ca23", "score": "0.7260027", "text": "def token_literal\n @token.literal\n end", "title": "" }, { "docid": "5dc8cfa4f4d83330c237cecc4a97ca23", "score": "0.7260027", "text": "def token_literal\n @token.literal\n end", "title": "" }, { "docid": "baca167289dda1324ca0bf835f00e13c", "score": "0.7246949", "text": "def get_token\n return @token\n end", "title": "" }, { "docid": "77dae6fd66df087ed5f2773c024e3147", "score": "0.722926", "text": "def text()\n @token.text\n end", "title": "" }, { "docid": "106f071e0583f07a99304ff083b2875c", "score": "0.72187173", "text": "def token()\n @token\n end", "title": "" }, { "docid": "d009c36e5100da39418428a634dcd8f3", "score": "0.71913004", "text": "def token\n return @token\n end", "title": "" }, { "docid": "28171a54fb8ce4c2af7fed9ed1298784", "score": "0.6956403", "text": "def token\n value = _token.text_value\n value == '' ? nil : value.to_i\n end", "title": "" }, { "docid": "9f681499296737a6e41f6a60733e438e", "score": "0.69291764", "text": "def token\n @token\n end", "title": "" }, { "docid": "9f681499296737a6e41f6a60733e438e", "score": "0.69291764", "text": "def token\n @token\n end", "title": "" }, { "docid": "791cfae0e7d356f8c87110388aa4f920", "score": "0.6911554", "text": "def token_text t\n return t if t.nil?\n t = t.current if t.respond_to?(:current)\n return t.value if t.is_a? Model::QualifiedName\n\n # else it is a lexer token\n t[:value]\n end", "title": "" }, { "docid": "af8c217aef5f91a249a0150855b33d40", "score": "0.69070774", "text": "def get_token\n @_token\n end", "title": "" }, { "docid": "5fda56f5753c1bd56e24975a01166b7c", "score": "0.6885622", "text": "def token\n @token\n end", "title": "" }, { "docid": "375a51ac7f4d94a9a15bed045e784a28", "score": "0.6829753", "text": "def idstr\n t = TOKEN_TYPES[ @type ]\n if t\n return t[:token].call( self )\n else\n raise RuntimeError\n end\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.6806202", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" }, { "docid": "5fe4f383c49b099f354eab73375a5fff", "score": "0.67962104", "text": "def token\n item[:token][0]\n end", "title": "" }, { "docid": "cd40cacb5445164819aafb95f0743bf3", "score": "0.67831606", "text": "def get_token\n token\n end", "title": "" }, { "docid": "ea92e7bd080bd629d222fa1563fe64ce", "score": "0.6774075", "text": "def text\n return value.to_s\n end", "title": "" }, { "docid": "1549d390c935f97e167f53c7a554899d", "score": "0.6770498", "text": "def value\n node.string\n end", "title": "" }, { "docid": "2e4b52e125b062ec4c8f3f3f765b4b99", "score": "0.67414534", "text": "def token\n attributes.fetch(:token)\n end", "title": "" }, { "docid": "2e4b52e125b062ec4c8f3f3f765b4b99", "score": "0.67414534", "text": "def token\n attributes.fetch(:token)\n end", "title": "" }, { "docid": "862b4cf0d70021dfe8c22ec8362c3426", "score": "0.6732189", "text": "def token\n @data['token']\n end", "title": "" }, { "docid": "384da154cad879430d4df2b003fc6ed6", "score": "0.67214096", "text": "def token\n rslt = super\n rslt.to_s == '' ? nil : rslt\n end", "title": "" }, { "docid": "384da154cad879430d4df2b003fc6ed6", "score": "0.67214096", "text": "def token\n rslt = super\n rslt.to_s == '' ? nil : rslt\n end", "title": "" }, { "docid": "15e02b00bc75611f8459066ab1fef4ec", "score": "0.67133564", "text": "def to_s\n self.token_type\n end", "title": "" }, { "docid": "80a80dcd848edbc726d8a470bcc147f6", "score": "0.6690171", "text": "def token; token_data[:token]; end", "title": "" }, { "docid": "be6bb50c2fb3597770dea21e5c5b6be3", "score": "0.66577125", "text": "def getTokenText()\n return @tokens[@index]\n end", "title": "" }, { "docid": "95ce5c5eab86e7210a37f129b0195322", "score": "0.662765", "text": "def token\n attributes[:token]\n end", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.6623943", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "f492a284c7d2f3955d7df1d567cd6fec", "score": "0.66126066", "text": "def token\n @Token\n end", "title": "" }, { "docid": "713770481111113d9e4b1a3eb4b180ac", "score": "0.6596207", "text": "def token\r\n\t\t@i_token\r\n\tend", "title": "" }, { "docid": "1a1a6e4e1d4bce02ee8f7eec91fa869f", "score": "0.65859824", "text": "def token\n self[:token]\n end", "title": "" }, { "docid": "1e9e61fcb3e13837f35e05e65596ea41", "score": "0.6585668", "text": "def message\n @token.message.dup.force_encoding(Encoding::UTF_8)\n end", "title": "" }, { "docid": "1fe94ef16e65b17c22b129bfdf6932bd", "score": "0.6560261", "text": "def token\n @attributes[:token]\n end", "title": "" }, { "docid": "311b7a43ee9abb440b52c73d0f9d5842", "score": "0.6541595", "text": "def getToken\n @@token\n end", "title": "" }, { "docid": "a26fe060d6fb6eea585343f10cd329ea", "score": "0.6529181", "text": "def token\n @msg['Token']\n end", "title": "" }, { "docid": "a26fe060d6fb6eea585343f10cd329ea", "score": "0.6529181", "text": "def token\n @msg['Token']\n end", "title": "" }, { "docid": "310657690a9dd2b3efd8bc8fe1d6b935", "score": "0.6525608", "text": "def value()\n get_literal_value()\n end", "title": "" }, { "docid": "c2443024e3ee5d9311a87b9c6ea388ee", "score": "0.650865", "text": "def value\n instance_variable_defined?(:@string) && @string || to_s\n end", "title": "" }, { "docid": "196dcc47f4180b323e5df31b194ad6c0", "score": "0.6456556", "text": "def token\n ensure_token\n @token\n end", "title": "" }, { "docid": "196dcc47f4180b323e5df31b194ad6c0", "score": "0.6456556", "text": "def token\n ensure_token\n @token\n end", "title": "" }, { "docid": "5528b1bcd079d9c36aa1a9ee166bb66b", "score": "0.6450276", "text": "def to_s\n token + \":\" + encode\n end", "title": "" }, { "docid": "d93ca4365450d352e5b2b402d8a28683", "score": "0.6438189", "text": "def get_token\n return Token.new(@value)\n end", "title": "" }, { "docid": "95f149d599e5533aefea1d7836268129", "score": "0.643434", "text": "def on_string_literal(token)\n if token and token[1]\n return token[1]\n else\n return Token::Token.new(\n :name => '',\n :value => '',\n :line => lineno,\n :column => column,\n :type => :string\n )\n end\n end", "title": "" }, { "docid": "f8f1f1484ca9f12d5ec72faa00a094ec", "score": "0.63955694", "text": "def string_value\n self[:value]\n end", "title": "" }, { "docid": "2f6a0b97e9b391ece2d1e67ae3b1692e", "score": "0.6395419", "text": "def token(value)\n merge(wltoken: value.to_s)\n end", "title": "" }, { "docid": "3bcf6b93a6e1045db41489bafdf27f0f", "score": "0.6392907", "text": "def convert_to_value(token)\n case token[:type]\n when :on_int\n token[:token].to_i\n when :on_tstring_content\n token[:token]\n when :on_ident\n eval(\"#{token[:token]}\")\n end\nend", "title": "" }, { "docid": "68c8e3d795543cfeb75cae3e34ffdbb8", "score": "0.63877434", "text": "def value\n @header.input.value.to_s.strip\n end", "title": "" }, { "docid": "06337791e2a6df506cac0bf670052d3e", "score": "0.6368036", "text": "def to_param\n token\n end", "title": "" }, { "docid": "a80d32dd07e28183ca1b506ebefc9a78", "score": "0.6361972", "text": "def token\n read_token\n end", "title": "" }, { "docid": "8545fa21fd1f86ecf45c7e160a8faf65", "score": "0.63372195", "text": "def get_token\n\t\treturn [@type, @value]\n\tend", "title": "" }, { "docid": "0064cae2f039eaea48939b942debd948", "score": "0.6328315", "text": "def token t\n #return nil if checkEnd\n @string.strip!\n raiseEnd\n if starts_with? t\n @current_value=t.strip\n @string=@string[t.length..-1].strip\n return @current_value\n else\n verbose \"expected \"+t.to_s # if @throwing\n raise NotMatching.new(t)\n end\n end", "title": "" }, { "docid": "b181cffee396cbefdf3ed142f5bd3e81", "score": "0.63238865", "text": "def to_param\n token\n end", "title": "" }, { "docid": "00b9be5b186eb20e96629f4a31a58510", "score": "0.63236094", "text": "def identifier\n return @token[:identifier]\n end", "title": "" }, { "docid": "51c31745221fdec24b4ae5c144bda192", "score": "0.6297039", "text": "def inspect\n \"<Token #{@type.inspect} (#{@value}) @#{@line}:#{@column}>\"\n end", "title": "" } ]
a526487af4068608d9f81bdb31604c9b
an now lets dry up the mocking and route building
[ { "docid": "a0d1c94962bbb269e6a27849b45da530", "score": "0.56692797", "text": "def fancyroutes(&blk)\n FancyRoutes(@map,&blk)\n end", "title": "" } ]
[ { "docid": "04b574985fadc91df45fa0a1b3277c42", "score": "0.6971899", "text": "def test_route_with_params_to_block_returning_router_routing_to_resource_with_more_params\n root_router do\n route('/foo/{x}') do |router1, uri1, params1|\n\n Class.new do\n include Doze::Router\n route(\"/{y}\") do |router2, uri2, params2|\n Doze::MockResource.new(uri2, [uri1, params1, uri2, params2].inspect)\n end\n end.new\n end\n end\n\n get('/foo/abc/123')\n\n assert_equal STATUS_OK, last_response.status\n # bit of a messy way to test it but this was getting fiddly to mock nicely\n # expecting [uri1, params1, uri2, params2].inspect from above\n assert_equal(['/foo/abc', {:x => 'abc'}, '/foo/abc/123', {:y => '123'}].inspect, last_response.body)\n end", "title": "" }, { "docid": "b141e318e437235b07a8f5498447ab9b", "score": "0.68958634", "text": "def test_route\n driver = Minitest::Mock.new(\"Driver\")\n current_location = Minitest::Mock.new(\"Current Location\")\n def driver.name; \"Driver 1\"; end\n def current_location.name; \"Museum\"; end\n def current_location.get_next_road(random)\n next_road = Minitest::Mock.new(\"Next Road\")\n def next_road.name; \"Bar St.\"; end\n def next_road.to_location(from)\n next_location = Minitest::Mock.new(\"Next Location\")\n def next_location.name; \"Cathedral\"; end\n next_location\n end\n next_road\n end\n assert_output(\"Driver 1 heading from Museum to Cathedral via Bar St.\\n\") { @c.route(driver, current_location) }\n end", "title": "" }, { "docid": "c2a222197a48cca8d0f1cb837c49a51a", "score": "0.6630183", "text": "def routes(&block); end", "title": "" }, { "docid": "92fb634d04d7df9c3fb632a6b0b122b7", "score": "0.66072845", "text": "def test_route\r\n ran = Random.new(5)\r\n run = Driver.new(ran, 1)\r\n\r\n run.stub :good_route, [['Foo St.', 'Far Ave.']] do\r\n run.stub :locate, 'Hospital' do\r\n assert_output('Driver 1 heading from Hospital to Far Ave. via Foo St.'){\r\n place = run.drive_route\r\n assert_equal 'Far Ave.', place\r\n }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "b82ebd2b8f1f7d47bcd9ba00cd5617a5", "score": "0.64647067", "text": "def route_def(pattern)\n mock_app { get(pattern) { } }\nend", "title": "" }, { "docid": "b49d408078aa2312dfd3d2ef9d46265c", "score": "0.644166", "text": "def define_routes; end", "title": "" }, { "docid": "170d30473ee4d56aba4b83f85a104481", "score": "0.6339672", "text": "def setup_router(scope); end", "title": "" }, { "docid": "170d30473ee4d56aba4b83f85a104481", "score": "0.6339672", "text": "def setup_router(scope); end", "title": "" }, { "docid": "deb60ad0dd42a1e7c47c0cae4ed25344", "score": "0.6332659", "text": "def routes=(_arg0); end", "title": "" }, { "docid": "deb60ad0dd42a1e7c47c0cae4ed25344", "score": "0.6332659", "text": "def routes=(_arg0); end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "5009e6a63c5f078e6eaed80f83908692", "score": "0.63164216", "text": "def routes; end", "title": "" }, { "docid": "76c9e3d4fee23cb04de224671cf116fa", "score": "0.63049304", "text": "def test_routes\n assert_routing(\n { :path => \"/api/0.6/notes\", :method => :post },\n { :controller => \"notes\", :action => \"create\", :format => \"xml\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1\", :method => :get },\n { :controller => \"notes\", :action => \"show\", :id => \"1\", :format => \"xml\" }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"show\", :id => \"1\", :format => \"xml\" },\n { :path => \"/api/0.6/notes/1.xml\", :method => :get }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1.rss\", :method => :get },\n { :controller => \"notes\", :action => \"show\", :id => \"1\", :format => \"rss\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1.json\", :method => :get },\n { :controller => \"notes\", :action => \"show\", :id => \"1\", :format => \"json\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1.gpx\", :method => :get },\n { :controller => \"notes\", :action => \"show\", :id => \"1\", :format => \"gpx\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1/comment\", :method => :post },\n { :controller => \"notes\", :action => \"comment\", :id => \"1\", :format => \"xml\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1/close\", :method => :post },\n { :controller => \"notes\", :action => \"close\", :id => \"1\", :format => \"xml\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1/reopen\", :method => :post },\n { :controller => \"notes\", :action => \"reopen\", :id => \"1\", :format => \"xml\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/1\", :method => :delete },\n { :controller => \"notes\", :action => \"destroy\", :id => \"1\", :format => \"xml\" }\n )\n\n assert_routing(\n { :path => \"/api/0.6/notes\", :method => :get },\n { :controller => \"notes\", :action => \"index\", :format => \"xml\" }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"index\", :format => \"xml\" },\n { :path => \"/api/0.6/notes.xml\", :method => :get }\n )\n assert_routing(\n { :path => \"/api/0.6/notes.rss\", :method => :get },\n { :controller => \"notes\", :action => \"index\", :format => \"rss\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes.json\", :method => :get },\n { :controller => \"notes\", :action => \"index\", :format => \"json\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes.gpx\", :method => :get },\n { :controller => \"notes\", :action => \"index\", :format => \"gpx\" }\n )\n\n assert_routing(\n { :path => \"/api/0.6/notes/search\", :method => :get },\n { :controller => \"notes\", :action => \"search\", :format => \"xml\" }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"search\", :format => \"xml\" },\n { :path => \"/api/0.6/notes/search.xml\", :method => :get }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/search.rss\", :method => :get },\n { :controller => \"notes\", :action => \"search\", :format => \"rss\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/search.json\", :method => :get },\n { :controller => \"notes\", :action => \"search\", :format => \"json\" }\n )\n assert_routing(\n { :path => \"/api/0.6/notes/search.gpx\", :method => :get },\n { :controller => \"notes\", :action => \"search\", :format => \"gpx\" }\n )\n\n assert_routing(\n { :path => \"/api/0.6/notes/feed\", :method => :get },\n { :controller => \"notes\", :action => \"feed\", :format => \"rss\" }\n )\n\n assert_recognizes(\n { :controller => \"notes\", :action => \"create\" },\n { :path => \"/api/0.6/notes/addPOIexec\", :method => :post }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"close\" },\n { :path => \"/api/0.6/notes/closePOIexec\", :method => :post }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"comment\" },\n { :path => \"/api/0.6/notes/editPOIexec\", :method => :post }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"index\", :format => \"gpx\" },\n { :path => \"/api/0.6/notes/getGPX\", :method => :get }\n )\n assert_recognizes(\n { :controller => \"notes\", :action => \"feed\", :format => \"rss\" },\n { :path => \"/api/0.6/notes/getRSSfeed\", :method => :get }\n )\n\n assert_routing(\n { :path => \"/user/username/notes\", :method => :get },\n { :controller => \"notes\", :action => \"mine\", :display_name => \"username\" }\n )\n end", "title": "" }, { "docid": "6d52ea6138184c6d49908bf4199aa82a", "score": "0.63024426", "text": "def setup\n mount_test_route\n mount_root_route\n end", "title": "" }, { "docid": "e150ba51d16502d98166547308645977", "score": "0.6287625", "text": "def test_routes\n assert_routing(\n { :path => \"/\", :method => :get },\n { :controller => \"site\", :action => \"index\" }\n )\n assert_routing(\n { :path => \"/\", :method => :post },\n { :controller => \"site\", :action => \"index\" }\n )\n assert_routing(\n { :path => \"/edit\", :method => :get },\n { :controller => \"site\", :action => \"edit\" }\n )\n assert_recognizes(\n { :controller => \"site\", :action => \"edit\", :format => \"html\" },\n { :path => \"/edit.html\", :method => :get }\n )\n assert_routing(\n { :path => \"/copyright\", :method => :get },\n { :controller => \"site\", :action => \"copyright\" }\n )\n assert_routing(\n { :path => \"/copyright/locale\", :method => :get },\n { :controller => \"site\", :action => \"copyright\", :copyright_locale => \"locale\" }\n )\n assert_routing(\n { :path => \"/welcome\", :method => :get },\n { :controller => \"site\", :action => \"welcome\" }\n )\n assert_routing(\n { :path => \"/fixthemap\", :method => :get },\n { :controller => \"site\", :action => \"fixthemap\" }\n )\n assert_routing(\n { :path => \"/export\", :method => :get },\n { :controller => \"site\", :action => \"export\" }\n )\n assert_recognizes(\n { :controller => \"site\", :action => \"export\", :format => \"html\" },\n { :path => \"/export.html\", :method => :get }\n )\n assert_routing(\n { :path => \"/offline\", :method => :get },\n { :controller => \"site\", :action => \"offline\" }\n )\n assert_routing(\n { :path => \"/key\", :method => :get },\n { :controller => \"site\", :action => \"key\" }\n )\n assert_routing(\n { :path => \"/go/shortcode\", :method => :get },\n { :controller => \"site\", :action => \"permalink\", :code => \"shortcode\" }\n )\n assert_routing(\n { :path => \"/preview/typename\", :method => :post },\n { :controller => \"site\", :action => \"preview\", :type => \"typename\" }\n )\n assert_routing(\n { :path => \"/id\", :method => :get },\n { :controller => \"site\", :action => \"id\" }\n )\n end", "title": "" }, { "docid": "eec810b2e76663875572d5ef49b979dd", "score": "0.6283023", "text": "def test_routes\n assert_routing(\n { :path => \"/api/0.6/gpx/create\", :method => :post },\n { :controller => \"traces\", :action => \"api_create\" }\n )\n assert_routing(\n { :path => \"/api/0.6/gpx/1\", :method => :get },\n { :controller => \"traces\", :action => \"api_read\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/api/0.6/gpx/1\", :method => :put },\n { :controller => \"traces\", :action => \"api_update\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/api/0.6/gpx/1\", :method => :delete },\n { :controller => \"traces\", :action => \"api_delete\", :id => \"1\" }\n )\n assert_recognizes(\n { :controller => \"traces\", :action => \"api_read\", :id => \"1\" },\n { :path => \"/api/0.6/gpx/1/details\", :method => :get }\n )\n assert_routing(\n { :path => \"/api/0.6/gpx/1/data\", :method => :get },\n { :controller => \"traces\", :action => \"api_data\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/api/0.6/gpx/1/data.xml\", :method => :get },\n { :controller => \"traces\", :action => \"api_data\", :id => \"1\", :format => \"xml\" }\n )\n\n assert_routing(\n { :path => \"/traces\", :method => :get },\n { :controller => \"traces\", :action => \"list\" }\n )\n assert_routing(\n { :path => \"/traces/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :page => \"1\" }\n )\n assert_routing(\n { :path => \"/traces/tag/tagname\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :tag => \"tagname\" }\n )\n assert_routing(\n { :path => \"/traces/tag/tagname/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :tag => \"tagname\", :page => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/traces\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :display_name => \"username\" }\n )\n assert_routing(\n { :path => \"/user/username/traces/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :display_name => \"username\", :page => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/traces/tag/tagname\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :display_name => \"username\", :tag => \"tagname\" }\n )\n assert_routing(\n { :path => \"/user/username/traces/tag/tagname/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"list\", :display_name => \"username\", :tag => \"tagname\", :page => \"1\" }\n )\n\n assert_routing(\n { :path => \"/traces/mine\", :method => :get },\n { :controller => \"traces\", :action => \"mine\" }\n )\n assert_routing(\n { :path => \"/traces/mine/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"mine\", :page => \"1\" }\n )\n assert_routing(\n { :path => \"/traces/mine/tag/tagname\", :method => :get },\n { :controller => \"traces\", :action => \"mine\", :tag => \"tagname\" }\n )\n assert_routing(\n { :path => \"/traces/mine/tag/tagname/page/1\", :method => :get },\n { :controller => \"traces\", :action => \"mine\", :tag => \"tagname\", :page => \"1\" }\n )\n\n assert_routing(\n { :path => \"/traces/rss\", :method => :get },\n { :controller => \"traces\", :action => \"georss\", :format => :rss }\n )\n assert_routing(\n { :path => \"/traces/tag/tagname/rss\", :method => :get },\n { :controller => \"traces\", :action => \"georss\", :tag => \"tagname\", :format => :rss }\n )\n assert_routing(\n { :path => \"/user/username/traces/rss\", :method => :get },\n { :controller => \"traces\", :action => \"georss\", :display_name => \"username\", :format => :rss }\n )\n assert_routing(\n { :path => \"/user/username/traces/tag/tagname/rss\", :method => :get },\n { :controller => \"traces\", :action => \"georss\", :display_name => \"username\", :tag => \"tagname\", :format => :rss }\n )\n\n assert_routing(\n { :path => \"/user/username/traces/1\", :method => :get },\n { :controller => \"traces\", :action => \"view\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/traces/1/picture\", :method => :get },\n { :controller => \"traces\", :action => \"picture\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/traces/1/icon\", :method => :get },\n { :controller => \"traces\", :action => \"icon\", :display_name => \"username\", :id => \"1\" }\n )\n\n assert_routing(\n { :path => \"/trace/create\", :method => :get },\n { :controller => \"traces\", :action => \"create\" }\n )\n assert_routing(\n { :path => \"/trace/create\", :method => :post },\n { :controller => \"traces\", :action => \"create\" }\n )\n assert_routing(\n { :path => \"/trace/1/data\", :method => :get },\n { :controller => \"traces\", :action => \"data\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/trace/1/data.xml\", :method => :get },\n { :controller => \"traces\", :action => \"data\", :id => \"1\", :format => \"xml\" }\n )\n assert_routing(\n { :path => \"/trace/1/edit\", :method => :get },\n { :controller => \"traces\", :action => \"edit\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/trace/1/edit\", :method => :post },\n { :controller => \"traces\", :action => \"edit\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/trace/1/delete\", :method => :post },\n { :controller => \"traces\", :action => \"delete\", :id => \"1\" }\n )\n end", "title": "" }, { "docid": "bc4f4a25bfaea3ed28e7b8bff107f717", "score": "0.627891", "text": "def anchored_routes; end", "title": "" }, { "docid": "ebdb5016aa5c4d6cd4fca17f34fd2172", "score": "0.62608826", "text": "def test_routing\n assert_routing '/by/12345678', :controller => 'public', :action => 'listens', :uid => '12345678'\n assert_routing '/albums/12345678', :controller => 'public', :action => 'albums', :uid => '12345678'\n assert_routing '/album/7-kasabian', :controller => 'public', :action => 'album', :id => '7-kasabian'\n assert_routing '/album', :controller => 'public', :action => 'album'\n assert_routing '/comments/12345678', :controller => 'public', :action => 'comments', :uid => '12345678'\n assert_routing '/recommendations/12345678', :controller => 'public', :action => 'recommends', :uid => '12345678'\n end", "title": "" }, { "docid": "53d4cd4ec719c9b793c36dff2a7b07ef", "score": "0.6209962", "text": "def test_03 # Router's internal routes struct\n Alfa::Router.reset\n prepare_router\n assert_equal(\n [\n {:rule=>\"/~assets/:path**\", :options=>{:type=>:asset}},\n {:rule=>\"/hello.html\", :options=>{}},\n {:context=>{:app=>{:path=>\"/admin/\", :app=>:admin, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:admin}},\n {:rule=>\"/:controller\", :options=>{:action=>:index}}\n ]},\n {:context=>{:app=>{:path=>\"/\", :app=>:frontend, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:index}},\n {:rule=>\"/:action\", :options=>{:controller=>:main, :layout=>:internal}},\n {:rule=>\"/:controller\", :options=>{:action=>:index, :layout=>:internal}},\n {:rule=>\"/:controller/:action\", :options=>{:layout=>:internal}},\n {:rule=>\"/:controller/:action/:id\", :options=>{:layout=>:internal}},\n ]},\n ],\n Alfa::Router.instance_variable_get(:@routes)\n )\n end", "title": "" }, { "docid": "b5de20802f194c4d277b5cf8856bc1af", "score": "0.61800134", "text": "def router; end", "title": "" }, { "docid": "b5de20802f194c4d277b5cf8856bc1af", "score": "0.61800134", "text": "def router; end", "title": "" }, { "docid": "c58fd92ad53d0b54948db0e1f0b4a0a3", "score": "0.6148186", "text": "def test_05\n Alfa::Router.reset\n Alfa::Router.apps_dir = File.expand_path('../data/test_router/1/apps', __FILE__)\n load File.expand_path('../data/test_router/1/config/routes.rb', __FILE__)\n assert_equal(\n [\n {:rule=>\"/~assets/:path**\", :options=>{:type=>:asset}},\n {:context=>{:app=>{:path=>\"/admin/\", :app=>:backend, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:index}},\n {:rule=>\"/:controller\", :options=>{:action=>:index}}\n ]},\n {:context=>{:app=>{:path=>\"/\", :app=>:frontend, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:index}},\n {:rule=>\"/:action\", :options=>{:controller=>:main, :layout=>:internal}},\n {:rule=>\"/:controller\", :options=>{:action=>:index, :layout=>:internal}},\n {:rule=>\"/:controller/:action\", :options=>{:layout=>:internal}},\n {:rule=>\"/:controller/:action/:id\", :options=>{:layout=>:internal}},\n ]},\n ],\n Alfa::Router.instance_variable_get(:@routes)\n )\n end", "title": "" }, { "docid": "a9ad1702a9f85d5c8973d5d10b964244", "score": "0.61480814", "text": "def _routes; end", "title": "" }, { "docid": "d09f48ac4c924c9a3c59fea28e5fd021", "score": "0.6096902", "text": "def test_invalid_route\r\n ran = Random.new(5)\r\n run = Driver.new(ran, 5)\r\n run.stub :locate, 'streetboo' do\r\n assert_nil run.good_route\r\n end\r\n end", "title": "" }, { "docid": "a7cfad5a3721c87438166a90e6820bf4", "score": "0.6079598", "text": "def mock_dashboard_calls(party_ref, requestor, filename)\n # Mock Caching call to get account details\n mock_get_account_details(party_ref, requestor, filename)\n mock_list_user\n # Mock the move to the dashboard page\n mock_list_secure_messages(party_ref, requestor)\n mock_all_returns(party_ref, requestor)\n mock_all_returns(party_ref, requestor)\nend", "title": "" }, { "docid": "fc8e2ab3cd9e7595e03605c4edad5e80", "score": "0.6032673", "text": "def with_route(the_path, _method = \"GET\")\n _fake_request = Merb::Test::FakeRequest.with(the_path, :request_method => _method)\n result = Merb::Router.match(_fake_request, {})\n yield result[1] if block_given?\n result\n end", "title": "" }, { "docid": "a88916aedc5b542b544e5aadb14136f4", "score": "0.6015168", "text": "def test_08\n Alfa::Router.reset\n Alfa::Router.apps_dir = File.expand_path('../data/test_router/2/apps', __FILE__)\n load File.expand_path('../data/test_router/2/config/routes.rb', __FILE__)\n assert_equal(\n [\n {:rule=>\"/~assets/:path**\", :options=>{:type=>:asset}},\n {:context=>{:app=>{:path=>\"/admin/\", :app=>:backend, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:index}},\n {:rule=>\"/:controller\", :options=>{:action=>:index}}\n ]},\n {:context=>{:app=>{:path=>\"/\", :app=>:frontend, :options=>{}}},\n :routes=>[\n {:rule=>\"/\", :options=>{:controller=>:main, :action=>:index, :layout=>:index}},\n {:rule=>\"/:action\", :options=>{:controller=>:main, :layout=>:internal}},\n {:rule=>\"/:controller\", :options=>{:action=>:index, :layout=>:internal}},\n {:rule=>\"/:controller/:action\", :options=>{:layout=>:internal}},\n {:rule=>\"/:controller/:action/:id\", :options=>{:layout=>:internal}},\n ]},\n ],\n Alfa::Router.instance_variable_get(:@routes)\n )\n #puts Alfa::Router.instance_variable_get(:@routes).inspect\n end", "title": "" }, { "docid": "6f2634b432679569e6a55d6c270e9a75", "score": "0.6009547", "text": "def test_route\n # @request.user_agent = @send_grid_user_agent\n # @request.env['HTTP_USER_AGENT'] = @send_grid_user_agent\n # request = ActionController::TestRequest.new\n # assert_equal @send_grid_user_agent, request.user_agent\n # ActionController::TestRequest.any_instance.stubs(:env).returns({'HTTP_USER_AGENT' => @send_grid_user_agent})\n # assert_equal @send_grid_user_agent, request.env['HTTP_USER_AGENT']\n\n ActionController::TestRequest.any_instance.stubs(:user_agent).returns(@send_grid_user_agent)\n # assert_recognizes({:controller => 'send_grid_emails', :action => 'create', :format => 'xml'}, {:method => :post, :path => '/thoughts.xml'})\n end", "title": "" }, { "docid": "2331a033c28f8338de938edfa2b44b59", "score": "0.6006429", "text": "def mock_framework; end", "title": "" }, { "docid": "c68ddc716fed69a2f7935d2c3544c00e", "score": "0.5990765", "text": "def mock_portal_basic\n end", "title": "" }, { "docid": "e51167d3606d60d5d43a4e5d21822fbd", "score": "0.59731674", "text": "def test_route_fixed_uri_to_resource_class\n resource = mock_resource('/foo')\n resource.expects(:get).returns(mock_entity('foo', 'text/html')).once\n klass = Class.new\n klass.expects(:new).with(\"/foo\").returns(resource)\n\n root_router do\n route '/foo', :to => klass\n end\n\n assert_equal STATUS_OK, get('/foo').status\n end", "title": "" }, { "docid": "f42e89f92dc57908d912b66ba010f542", "score": "0.59633905", "text": "def mock_auth; end", "title": "" }, { "docid": "5f2f489fae00c4e8526671961522b63f", "score": "0.5952382", "text": "def route_from(uri); end", "title": "" }, { "docid": "5f2f489fae00c4e8526671961522b63f", "score": "0.5952382", "text": "def route_from(uri); end", "title": "" }, { "docid": "564a69078455e69eef8a4919a2d19025", "score": "0.5922154", "text": "def custom_routes; end", "title": "" }, { "docid": "f98d6a9eea49481686b2aeab00386c37", "score": "0.59114397", "text": "def request_stubs; end", "title": "" }, { "docid": "f98d6a9eea49481686b2aeab00386c37", "score": "0.59114397", "text": "def request_stubs; end", "title": "" }, { "docid": "391aa18185cf208586e8c2a5d02de065", "score": "0.5910855", "text": "def route_sets; end", "title": "" }, { "docid": "eddddd497accb6e0d79dd61be57562ed", "score": "0.58817077", "text": "def test_07\n Alfa::Router.reset\n Alfa::Router.draw do\n route '/' => 'default#index'\n route '/zoo' => 'default#zoo', :layout => :default\n mount '/admin' => :backend\n Alfa::Router.context :app => :backend do\n route '/' => 'kfk#index', :layout => :fantastic\n end\n end\n #puts Alfa::Router.instance_variable_get(:@routes).inspect\n assert_equal(\n [\n {:rule=>\"/~assets/:path**\", :options=>{:type=>:asset}},\n {:rule=>'/', :options=>{:controller=>:default, :action=>:index}},\n {:rule=>'/zoo', :options=>{:layout => :default, :controller=>:default, :action=>:zoo}},\n {:context=>{:app=>{:path=>'/admin/', :app=>:backend, :options=>{}}},\n :routes=>[\n {:rule=>'/', :options=>{:layout=>:fantastic, :controller=>:kfk, :action=>:index}}\n ]},\n ],\n Alfa::Router.instance_variable_get(:@routes)\n )\n end", "title": "" }, { "docid": "3863709a819cbec23bb0b8c244e9fc55", "score": "0.58732593", "text": "def to(route)\n m = @method\n h = @http_method\n p = @path\n\n @context.instance_eval do\n expect_any_instance_of(described_class).public_send(m, receive(route))\n env = Rack::MockRequest.env_for(p, method: h)\n robot.app.call(env)\n end\n end", "title": "" }, { "docid": "87e8b57e47690498d8848ed8e250d5d6", "score": "0.58700854", "text": "def setup\n @requester = Rack::MockRequest.new(App)\n end", "title": "" }, { "docid": "87e8b57e47690498d8848ed8e250d5d6", "score": "0.58700854", "text": "def setup\n @requester = Rack::MockRequest.new(App)\n end", "title": "" }, { "docid": "f3b1742d00d6ddca17710ac31c72e404", "score": "0.58661747", "text": "def fake_route(route, return_value=nil, &block)\n if return_value && block\n fail 'cannot provide both a return_value and block'\n end\n block = block || proc{return_value}\n Hyperion.fake(route.uri.base) do |svr|\n svr.allow(route, &block)\n end\nend", "title": "" }, { "docid": "3eddf61d14db861333e717d132242e67", "score": "0.5856092", "text": "def request_stub; end", "title": "" }, { "docid": "3eddf61d14db861333e717d132242e67", "score": "0.5856092", "text": "def request_stub; end", "title": "" }, { "docid": "3eddf61d14db861333e717d132242e67", "score": "0.5856092", "text": "def request_stub; end", "title": "" }, { "docid": "3eddf61d14db861333e717d132242e67", "score": "0.5854956", "text": "def request_stub; end", "title": "" }, { "docid": "49ca9939198e1b22ec9f82b7efb40510", "score": "0.5847467", "text": "def test_06 # load_from_files\n Alfa::Router.reset\n Alfa::Router.apps_dir = File.expand_path('../data/test_router/1/apps', __FILE__)\n load File.expand_path('../data/test_router/1/config/routes.rb', __FILE__)\n #puts Alfa::Router.instance_variable_get(:@routes).inspect\n assert_equal([{rule: '/', options: {app: :frontend, controller: :main, action: :index, layout: :index}}, {}], Alfa::Router.find_route('/'))\n assert_equal([{rule: '/:action', options: {app: :frontend, controller: :main, layout: :internal}}, {action: :foo}], Alfa::Router.find_route('/foo'))\n assert_equal([{rule: '/:controller/:action', options: {app: :frontend, layout: :internal}}, {controller: :foo, action: :bar}], Alfa::Router.find_route('/foo/bar'))\n assert_equal([{rule: '/:controller/:action/:id', options: {app: :frontend, layout: :internal}}, {controller: :foo, action: :bar, id: '8'}], Alfa::Router.find_route('/foo/bar/8'))\n assert_equal([{rule: '/', options: {app: :backend, controller: :main, action: :index, layout: :index}}, {}], Alfa::Router.find_route('/admin/'))\n assert_equal([{rule: '/:controller', options: {app: :backend, action: :index}}, {controller: :foo}], Alfa::Router.find_route('/admin/foo'))\n end", "title": "" }, { "docid": "87bd6fdc4ccf4fe3cfacbcef06c10f8a", "score": "0.5838533", "text": "def named_route; end", "title": "" }, { "docid": "dbbfe0e6aab3b87d10e40f93da622d58", "score": "0.5833693", "text": "def request_via_API( app, method, path, params={} ) # app should be Muffinland (hexagon API)\n env = Rack::MockRequest.env_for(path, {:method => method, :params=>params} )\n rr = Rack::Request.new(env)\n puts \"and request.POST=\" + rr.POST.inspect\n request = Ml_RackRequest.new( rr )\nputs \"About to send request:\" + request.inspect\n app.handle request\nend", "title": "" }, { "docid": "12508f0fe27994c5c71a56bcaa23c4dc", "score": "0.582483", "text": "def route\n router.route if router\n end", "title": "" }, { "docid": "0beb8c677cf1c503574e32a4d4dd21be", "score": "0.58089846", "text": "def setup_routes\n route \"Elrte.routes(self)\"\n end", "title": "" }, { "docid": "aec6849e754d38855b4f596bd3086f1a", "score": "0.58088356", "text": "def mock_auth=(_arg0); end", "title": "" }, { "docid": "181a47472847f0688dbd94078859a8d9", "score": "0.5799002", "text": "def test_valid_routing\n assert_routing \"users\", {:controller => 'users', :action => 'index'}\n assert_routing \"users/1\", {:controller => 'users', :action => 'show', :id => \"1\"}\n assert_routing \"users/1/edit\", {:controller => 'users', :action => 'edit', :id => \"1\"}\n assert_routing \"users/1/follow\", {:controller => 'users', :action => 'follow', :id => \"1\"}\n assert_routing \"users/1/unfollow\", {:controller => 'users', :action => 'unfollow', :id => \"1\"}\n assert_routing \"users/1/posts\", {:controller => 'users', :action => 'user_posts', :id => \"1\"}\n assert_routing \"followers\", {:controller => 'users', :action => 'followers'}\n assert_routing \"followees\", {:controller => 'users', :action => 'followees'}\n end", "title": "" }, { "docid": "b8174e04470d52a44d86c10e9827a928", "score": "0.57710373", "text": "def generate_routes\n Shipment.generate_routes\n redirect_to \"/members/hub\"\n end", "title": "" }, { "docid": "36723f181ec9e66fc3d9f49b214ccc08", "score": "0.5767085", "text": "def test_create\n r=Ressource.find_by_namespace_and_ressource(\"numlab\",\"exercises\");r.postroute=true;r.save!\n r=Ressource.find_by_namespace_and_ressource(\"numlab\",\"exercises\");r.events=true;r.save!\n # 1.0\n sender_headers\n location = \"\"\n post '/numlab/exercises', BODY_DATA, @headers\n assert_response 201\n location = URI.split(headers[\"Location\"])[5][1..-1].sub(/[^\\/]*\\/(.*)/, '\\1')\n logger.info('headers[\"Location\"]: '+headers[\"Location\"])\n logger.info('location: '+location)\n # 1.1\n sender_headers\n get '/numlab/exercises', nil, @headers\n assert_response 200 \n assert_nil response.body.index(location)\n receiver_1_headers\n get '/numlab/exercises', nil, @headers\n assert_response 200 \n assert response.body.index(location)\n # 1.2\n sender_headers\n get '/numlab/exercises/lifo', nil, @headers\n assert_response 200 \n assert_nil response.body.index(BODY_DATA)\n receiver_1_headers\n get '/numlab/exercises/lifo', nil, @headers\n assert_response 200 \n assert response.body.index(BODY_DATA)\n # 1.3\n sender_headers\n get '/numlab/'+location, nil, @headers\n assert_response 200 \n assert response.body.index(BODY_DATA)\n receiver_1_headers\n get '/numlab/'+location, nil, @headers\n assert_response 200 \n assert response.body.index(BODY_DATA)\n # 1.4 \n sender_headers\n get '/events', nil, @headers\n assert_response 200 \n assert_nil response.body.index(/.*?#{location}.*?created.*/)\n receiver_1_headers\n get '/events', nil, @headers\n assert_response 200 \n assert response.body.index(/.*?#{location}.*?created.*/)\n # 1.5\n sender_headers\n post '/events/fifo', nil, @headers\n logger.info(\"response body:\\n\"+response.body)\n assert_response 200 \n assert_nil response.body.index(location)\n sender_headers\n post '/events/fifo', nil, @headers\n assert_response 200 \n assert_nil response.body.index(location)\n receiver_1_headers\n post '/events/fifo', nil, @headers\n assert_response 200 \n assert response.body.index(location)\n receiver_1_headers\n get '/events/fifo', nil, @headers\n assert_response 200 \n assert_nil response.body.index(location)\n end", "title": "" }, { "docid": "703bdf45e62fa365b8399907b34b35e8", "score": "0.57608396", "text": "def _roda_main_route(_)\n end", "title": "" }, { "docid": "de4a429fead37e3311134f9a6ef6a3c0", "score": "0.5753674", "text": "def call(env, &block)\n @_request = self.class::RodaRequest.new(self, env)\n @_response = self.class::RodaResponse.new\n _route(&block)\n end", "title": "" }, { "docid": "b2e82edeedd1cffe3f78bf0189f8ec2a", "score": "0.5741083", "text": "def initialize_route(*args)\n end", "title": "" }, { "docid": "b2e82edeedd1cffe3f78bf0189f8ec2a", "score": "0.5741083", "text": "def initialize_route(*args)\n end", "title": "" }, { "docid": "d200b8a6d47e0afbb4c51cfe293ce00a", "score": "0.5734923", "text": "def request_via_API( app, method, path, params={} ) # app should be Muffinland (hexagon API)\n env = Rack::MockRequest.env_for(path, {:method => method, :params=>params} )\n rr = Rack::Request.new(env)\n request = Ml_RackRequest.new( rr )\n app.handle request\nend", "title": "" }, { "docid": "da1b99fe8c35479e56a0b1891159ac30", "score": "0.57337356", "text": "def method_missing(method, *args)\n return super unless defined?(Rails) && Rails.application.routes.url_helpers.respond_to?(method)\n # Check to see if one of the args is an open struct. If it is, we'll assume it's the\n # test stub and try to call a path or url attribute.\n if args.any? {|arg| arg.kind_of?(SparkPostMailer::Mock)}\n # take the first OpenStruct found in args and look for .url or.path\n args.each do |arg|\n if arg.kind_of?(SparkPostMailer::Mock)\n break arg.url || arg.path\n end\n end\n else\n options = args.extract_options!.merge({host: SparkPostMailer.config.default_url_options[:host], protocol: SparkPostMailer.config.default_url_options[:protocol]})\n args << options\n Rails.application.routes.url_helpers.method(method).call(*args)\n end\n end", "title": "" }, { "docid": "eb29f9c345c7171584efb9fe922a123d", "score": "0.57333744", "text": "def route_to(uri); end", "title": "" }, { "docid": "eb29f9c345c7171584efb9fe922a123d", "score": "0.57333744", "text": "def route_to(uri); end", "title": "" }, { "docid": "7363efd5dd2c8c9b8e6918cf7d37b589", "score": "0.57190096", "text": "def run_record_route(stub, features)\n p 'RecordRoute'\n p '-----------'\n points_on_route = 10 # arbitrary\n reqs = RandomRoute.new(features, points_on_route)\n resp = stub.record_route(reqs.each)\n p \"summary: #{resp.inspect}\"\nend", "title": "" }, { "docid": "b3c0e56539e96c96eb699857bb73e8e9", "score": "0.5718578", "text": "def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end", "title": "" }, { "docid": "b3c0e56539e96c96eb699857bb73e8e9", "score": "0.5718578", "text": "def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end", "title": "" }, { "docid": "b3c0e56539e96c96eb699857bb73e8e9", "score": "0.5718578", "text": "def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end", "title": "" }, { "docid": "7b8468a142f82c9272cfbc021451e7d6", "score": "0.57178396", "text": "def router=(_arg0); end", "title": "" }, { "docid": "7b8468a142f82c9272cfbc021451e7d6", "score": "0.57178396", "text": "def router=(_arg0); end", "title": "" }, { "docid": "90cf176dc4d89f9ffe493a55a74a1ba9", "score": "0.57026637", "text": "def test_route_build\n ActionController::Routing.with_controllers %w(users pages) do\n r = builder.build '/:controller/:action/:id/', :action => nil\n\n [0, 2, 4].each do |i|\n assert_kind_of ROUTING::DividerSegment, r.segments[i]\n assert_equal '/', r.segments[i].value\n assert r.segments[i].optional? if i > 1\n end\n\n assert_kind_of ROUTING::DynamicSegment, r.segments[1]\n assert_equal :controller, r.segments[1].key\n assert_equal nil, r.segments[1].default\n\n assert_kind_of ROUTING::DynamicSegment, r.segments[3]\n assert_equal :action, r.segments[3].key\n assert_equal 'index', r.segments[3].default\n\n assert_kind_of ROUTING::DynamicSegment, r.segments[5]\n assert_equal :id, r.segments[5].key\n assert r.segments[5].optional?\n end\n end", "title": "" }, { "docid": "32341a492a45b8f50c34e712f77c81d9", "score": "0.5697598", "text": "def named_routes=(_arg0); end", "title": "" }, { "docid": "1a59184349f1fb3163a3ba8b51501e85", "score": "0.5690339", "text": "def route_for(name, *args); end", "title": "" }, { "docid": "17b0cb04b23b7984c01e3d77b02b02f3", "score": "0.5677022", "text": "def route_index; end", "title": "" }, { "docid": "4e09c7274467786b768266a5ce96a505", "score": "0.56415784", "text": "def new_object_url ; new_object_route('url'); end", "title": "" }, { "docid": "453c436e96cea21205234f72e3f5600e", "score": "0.56312805", "text": "def route\n @_route\n end", "title": "" }, { "docid": "ca95aa84c29e16b15a3a0d49f764f0ae", "score": "0.5628037", "text": "def recognize_path( path, options)\n # must turn our arguments into a Request and then call Merb::Router.route_for(request)\n # In Rails, this routine calls recognize_optimized(path, environment). Unfortunately (or fortunately) Merb\n # routing defines no such method. Merb routing matches request objects against routes.\n\n # get the Rails Rack app per these instructions http://guides.rubyonrails.org/rails_on_rack.html#rails-applications-rack-object\n app = ActionController::Dispatcher.new\n\n s = Rack::Test::Session.new( app ) # create the rack-test session\n \n # if we rec'd the HTTP method as a symbol, better make sure it's a string for env_for\n options[:method] = options[:method].to_s\n \n # now stick our hand up inside rack-test, not because we _want_ to mind you, but because we _have_ to (as usual)\n env = s.instance_eval{ env_for path, options }\n \n # borrowed from Rack::Test::Session#process_request (we don't actually want to _process_ this request—\n # only build its Request object)\n \n # request = Rack::Request.new(env)\n \n # oh but that Rack request isn't exactly what we need, no! And furthermore, it looks like merb_routing plugin\n # doesn't bring along Merb's own Request object (makes sense since we're integrating with Rails). So we'll create\n # a Rails request (which is a subclass of Rack::Request). Now from a read of that class I see no initialize, so I \n # assume I can construct an instance exactly the way I construct an instance of the base class...\n # (note that Request moves into ActionDispatch in Rails 3)\n request = ActionController::Request.new( env )\n \n # make the request\n begin\n route_and_params = merb_route_for( request )\n rescue ActionController::RoutingError\n # gotta avoid letting that error bubble up lest we break the caller!\n end\n elide_blank_format( route_and_params.blank? ? {} : route_and_params[1] )\n end", "title": "" }, { "docid": "da0d287d2cead6aaceeb8a4af23f676d", "score": "0.56159323", "text": "def route\n ready\n _route\n true\n end", "title": "" }, { "docid": "8d5fe5f4d2339d1a3a3c1804f8c59e00", "score": "0.5611888", "text": "def initialize(root_api, type = :sinatra)\n @routes = {}\n Midori::Const::ROUTE_METHODS.map {|method| @routes[method] = []} \n @root_api = root_api\n @type = type\n @routes = merge('', root_api, [])\n @routes.delete :MOUNT\n @routes.each do |method|\n method[1].each do |route|\n route.path = Mustermann.new(route.path, type: type)\n end\n end\n end", "title": "" }, { "docid": "371f87740b621dc21600f9f4ae25265e", "score": "0.56089", "text": "def test_route_for_users_login\n\t\tassert_routing({path: '/users/login', method: :post}, {controller: 'users', action: 'login'})\n\tend", "title": "" }, { "docid": "b847ab7c9350e439973ad6fb2d4624e2", "score": "0.5604242", "text": "def route_config_class; ::Totem::Test::Routes::Config; end", "title": "" }, { "docid": "16f372f7352498479a6c0f8d4d19c5e4", "score": "0.5592156", "text": "def add_new_route\n\nend", "title": "" }, { "docid": "2e4bd1bbca07e54f102ebeefd46d22fb", "score": "0.5588979", "text": "def test_complex_scenario\n routing_mock = OpenStruct.new(\n routing_parameters: [\n OpenStruct.new(field: \"table_name\", path_template: \"projects/*/{table_location=instances/*}/tables/*\"),\n OpenStruct.new(field: \"table_name\", path_template: \"{table_location=regions/*/zones/*}/tables/*\"),\n OpenStruct.new(field: \"table_name\", path_template: \"{routing_id=projects/*}/**\"),\n OpenStruct.new(field: \"app_profile_id\", path_template: \"{routing_id=**}\"),\n OpenStruct.new(field: \"app_profile_id\", path_template: \"profiles/{routing_id=*}\")\n ]\n )\n\n routing = Gapic::Model::Method::Routing.new routing_mock, nil\n\n test_cases = [\n {\n request: OpenStruct.new(table_name: \"projects/100/instances/200/tables/300\",\n app_profile_id: \"profiles/profile_17\"),\n expected: \"table_location=instances/200&routing_id=profile_17\"\n },\n {\n request: OpenStruct.new(table_name: \"projects/100/instances/200/tables/300\",\n app_profile_id: \"profile_17\"),\n expected: \"table_location=instances/200&routing_id=profile_17\"\n },\n {\n request: OpenStruct.new(table_name: \"projects/100/instances/200/tables/300\",\n app_profile_id: \"\"),\n expected: \"table_location=instances/200&routing_id=projects/100\"\n }\n ]\n\n assert_regex_matches routing, test_cases\n end", "title": "" }, { "docid": "712904f04a87830f580f9eb5c6e7b300", "score": "0.5579258", "text": "def test_should_setup_taxes\n @controller.stubs(:form_authenticity_token).returns('aaaa')\n Invoice.any_instance.expects(:setup_taxes)\n get :new\n end", "title": "" }, { "docid": "ca2c7a84f4576cf5c8ded5c8dfc984ec", "score": "0.5575829", "text": "def stub(base_url); end", "title": "" }, { "docid": "182ef3d96595fd17f018be875ce35b35", "score": "0.5560679", "text": "def mock_response(type, route='', proc=nil, &block)\n proc = block if block_given?\n route = clean_route route\n\n @responses[type] ||= {}\n @responses[type][route].deactivate! if @responses[type][route]\n @responses[type][route] = Response.new(type, prepare_uri(type, route), self, &proc)\n @responses[type][route].activate!\n end", "title": "" }, { "docid": "3c87778e34d128826c70fac393d1a167", "score": "0.55584824", "text": "def external_routes; end", "title": "" }, { "docid": "ada4d13f09a8cd4b82f773a16c0bb364", "score": "0.5546638", "text": "def test_router_no_match\n root_router.expects(:perform_routing).with('/foo', nil, '').returns(nil).once\n assert_equal STATUS_NOT_FOUND, get('/foo').status\n end", "title": "" }, { "docid": "04aefb9bcdad387a56d4aa832818d4b1", "score": "0.55403006", "text": "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "title": "" }, { "docid": "9a1cb6618f209f33da90f5d8712ec7d9", "score": "0.55362064", "text": "def test_access_lead \n \n #client \n login_as('lead') \n \n msg = \"Lead don't have privileges to access lead/\"\n \n #new\n get :new\n assert_response :success\n assert_template 'error' , msg + \"new\" \n \n #show\n get :show\n assert_response :success\n assert_template 'error' , msg + \"show\" \n \n #create\n get :create\n assert_response :success\n assert_template 'error' , msg + \"create\" \n \n #edit\n get :edit\n assert_response :success\n assert_template 'error' , msg + \"edit\" \n \n #update\n get :update\n assert_response :success\n assert_template 'error' , msg + \"update\" \n \n #destroy\n get :destroy\n assert_response :success\n assert_template 'error' , msg + \"destroy\" \n \n \n \n \n logout() \n end", "title": "" } ]
23e1edf2bca7d4d0e31488f07de41727
validates_uniqueness_of :applicant, :scope => [:committee, :deliberation_id]
[ { "docid": "e9950342868daef1a05941ab17082f87", "score": "0.5277618", "text": "def get_applicant\n \treturn Applicant.find(self.applicant)\n end", "title": "" } ]
[ { "docid": "9cc4818c3ca359b48b65d99065ea2e49", "score": "0.6779906", "text": "def validate_duplicated_application\n if job.job_applicants.exists?(:applicant_id => applicant.id) #21\n if is_hired == false\n errors.add(:job, \"has been applied before. You can't apply it again\")\n end\n end\n end", "title": "" }, { "docid": "6e43552682e73613feb382d510e65f34", "score": "0.6415429", "text": "def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n errors.add(:email, \"is already taken\")\n end\n end", "title": "" }, { "docid": "34bbd6fe35089f358935da915ae27241", "score": "0.6256398", "text": "def validate_attendances_uniqueness\n attendances.each do |attendance|\n next if attendance.justification_ids.blank?\n errors.add(:attendance_ids, \"a falta de #{attendance.date.month}/#{attendance.date.year} já tem justificativo.\")\n end\n end", "title": "" }, { "docid": "faf0c0e072a63a5f5c6f8a871025bcd7", "score": "0.6164011", "text": "def check_uniqueness \n has_visits = pat.visits.where(doc_id: OWNER_DOC_ID).order(entry_ts: :desc).first.entry_ts.today? rescue nil #where('date(entry_ts)=?', self.entry_ts.to_date)\n errors.add(:reason, \"Only 1 visit is allowed by OHIP per patient per day\") if has_visits\n end", "title": "" }, { "docid": "54fb868d6fb6cbca7f0bd469d7aba0df", "score": "0.6151532", "text": "def verify_unique_semester_application(current_applicant)\n return true unless current_applicant.applied_for?(@settings.current_semester)\n redirect_to students_apply_path, flash: { error: t('student_applications.create.resubmit') }\n false\n end", "title": "" }, { "docid": "ab1e3b602cc27fda23cfeaecd1841b9f", "score": "0.6099769", "text": "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "title": "" }, { "docid": "542f7a6dfa115e1f7fc43073aee0d8f6", "score": "0.60472083", "text": "def validate_date_uniqueness()\n self.subject_class.attendances.each do |at|\n if self.date_created == at.date_created\n errors.add(:date, \"already existed\")\n end\n end \n end", "title": "" }, { "docid": "efe88a54a6bf90903c913e4f595fef92", "score": "0.60318935", "text": "def verify_unique_semester_application(current_applicant)\n return true unless current_applicant.external_applied_for?(@settings.current_semester)\n redirect_to students_apply_path, flash: { error: t('student_applications.create.resubmit') }\n false\n end", "title": "" }, { "docid": "03bcd46fbd455647e56e278440bc1cf6", "score": "0.59605926", "text": "def ensure_unique_athlete_per_prediction\n \terrors.add(:athlete_id, \"Already chosen\") if @duplicate_athlete_ids.present? and @duplicate_athlete_ids.include?(athlete_id)\n\tend", "title": "" }, { "docid": "a3d12affb34318e781970b55daf17b02", "score": "0.59358376", "text": "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "title": "" }, { "docid": "f899b435f6c04e219b32f352913f2839", "score": "0.5930644", "text": "def unique_activity\n if self.user.bookings.where(activity_id: self.activity.id).any?\n errors.add(:already_joined, \"this activity!\")\n end\n end", "title": "" }, { "docid": "adc5c108b4e6c4a74eb1a25e39e25603", "score": "0.59137434", "text": "def allows_unique?\n true\n end", "title": "" }, { "docid": "840f773826de9df0bb7b43d0c8c199e6", "score": "0.5829948", "text": "def validate_unique_submission\n existing = Course::Assessment::Submission.find_by(assessment_id: assessment.id,\n creator_id: creator.id)\n return unless existing\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/assessment/'\\\n 'submission.submission_already_exists')\n end", "title": "" }, { "docid": "9925c1a506ece2bb8e53de4bcf545952", "score": "0.58000755", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "ba7bb2ca313a8c62af949fe9108e00c3", "score": "0.5793138", "text": "def validates_email_uniqueness\n if validate_attributes == true\n if email and (Contact.find_by_email(email) or Lead.find(:first, :conditions => [\"email = ? and record_type_id = ?\",email,MOLTEN_REQUEST_RECORD_TYPE]))\n errors.add('email', \"A contact already exists with this email address.\")\n end\n end\n end", "title": "" }, { "docid": "8694de8a8279d79573c2447a61e8960d", "score": "0.578733", "text": "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "title": "" }, { "docid": "b5edc923ae752f31e00e008f0a7ec288", "score": "0.57629406", "text": "def test_should_deny_duplicate_intitution\n intitution = create\n assert_valid intitution\n \n intitution = create\n assert_invalid intitution, \"User shouldn't be created\"\n end", "title": "" }, { "docid": "598ad9e84d4bd7aad69149c5182fcc9e", "score": "0.57597375", "text": "def appointment_unique_with_doctor_in_clinic\n times_taken = []\n begin\n self.doctor.appointments.confirmed.each do |appt|\n unless appt.id == self.id\n times_taken << appt.appointment_time\n end\n end\n rescue NoMethodError\n errors.add(:doctor_id, 'No doctor specified')\n end\n errors.add(:appointment_time, \"Time not available\") if times_taken.include?(appointment_time)\n end", "title": "" }, { "docid": "162124942ba8436a68075dfaaeea8179", "score": "0.57593316", "text": "def check_uniqueness\n unless FriendRequest.find_friend_request(requester_id, requestee_id).nil? \n errors.add(:base, \"There is already a pending friend request to that user\")\n end\n end", "title": "" }, { "docid": "5236b51651da1a43c5d10b4b02551410", "score": "0.5757859", "text": "def uniqueness_by_votable\n errors.add(\"you already voted!\") if Vote.where(votable: self.votable, user_id: self.user_id).count > 0\n end", "title": "" }, { "docid": "e54c25dbe33c8130876e53ffc523c187", "score": "0.5726985", "text": "def validate_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "47b565197b325aa64448efad954f4199", "score": "0.57060575", "text": "def agreement_creds_unique\n matching = Agreement.where(\n 'lower(email) = ? AND agreement_version = ?', # and have to match version\n email.downcase,\n Agreement::LATEST_AGREEMENT_VERSION\n )\n\n # Further limit results if a uni is provided.\n matching = matching.where('lower(uni) = ?', uni.downcase) if uni.present?\n\n errors.add(:base, 'A person with this email (and uni) has already signed an agreement.') unless matching.count.zero?\n end", "title": "" }, { "docid": "4c5212f165d7823fae5e89ec58ce9783", "score": "0.56967914", "text": "def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendly_name)\n errors.add(:course, 'course friendly name already exists')\n return\n end\n end\n end", "title": "" }, { "docid": "0533966ec814bc64a10b8e10962b75f7", "score": "0.5694418", "text": "def duplicate_user_assignment?\n self.id != this_user_and_assignment.id && this_user_and_assignment.id != \"\"\n end", "title": "" }, { "docid": "7a25b264db903002c9d251a1f397f7ce", "score": "0.5694316", "text": "def only_one_id_per_semester\n if current_step == 'id_and_semester' && !persisted? && semester\n if Prospect.joins(:enumerations).exists?(suppressed: false, directory_id: directory_id, enumerations: { id: semester.id })\n errors.add(:semester, \"Please note that this directory ID has already submitted an application. You are only allowed one application submission per semester. If you need to edit your submission please contact Lisa Warner at <a href='tel:3014059245'>301-405-9245</a> or <a href='mailto:[email protected]'>[email protected]</a> for assistance.\".html_safe)\n end\n end\n end", "title": "" }, { "docid": "db31f248abc2151a05c8f733f63bf473", "score": "0.5689876", "text": "def create_applicant(cmd, email)\n if @applicants.include? email\n output MSG_DUPLICATE_APPLICANT\n else\n @applicants << Applicant.new(email: email, stage: @stages.first)\n output cmd\n end\n end", "title": "" }, { "docid": "05c9827ae3d29b74ed1cd3f510e13630", "score": "0.56701916", "text": "def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end", "title": "" }, { "docid": "e61b1d8dac7ed65c3b19fa5fa177535c", "score": "0.5576651", "text": "def employment_duplicated?\n employments = @restaurant.employments.select { | employment | employment.employee == @employment.employee }\n if employments.size > 1\n flash[:error] = \"Employee is already associated with that restaurant\"\n render :new\n else\n return false\n end\n end", "title": "" }, { "docid": "9a598fd72870fa3bee8ddcadbab3de5c", "score": "0.5566697", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_type_code => self.treatment_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "6c38182b46ef154e2bec70ba7fb3504f", "score": "0.5552885", "text": "def site_membership_uniqueness\n return unless site && user\n\n existing_membership =\n user.site_memberships.where(site_id: site.id).where.not(id: id).first\n\n errors.add(:user, \"already has a membership to #{ site.url }\") if existing_membership\n end", "title": "" }, { "docid": "1fb3eec8463dcb575f0bdb4c0531ed81", "score": "0.5547846", "text": "def uniqueness_constraint\n base_role.all_role_ref.detect{|rr|\n rs = rr.role_sequence\n rs.all_role_ref.size == 1 and\n rs.all_presence_constraint.detect do |pc|\n return pc if pc.max_frequency == 1 and !pc.enforcement # Alethic uniqueness constraint\n end\n }\n nil\n end", "title": "" }, { "docid": "81f8b7aa3ba7b2db4918fce61aa4b149", "score": "0.5532738", "text": "def set_applicant\n @applicant = Applicant.friendly.find(params[:applicant_id])\n end", "title": "" }, { "docid": "0c75d007bdd8e1db58e22451114e5095", "score": "0.55224025", "text": "def numero_fattura_must_be_unique_in_anno_and_data_fattura\n #return if field.blank?\n not_uniq = self.class.count(:conditions => [\"anno = ? AND numero_fattura = ? AND YEAR(data_fattura) = ?\", self.anno, self.numero_fattura, self.data_fattura.year])\n if not_uniq > 0\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\")\n flash[:error] = \"anno, numero_fattura e anno di data_fattura devono essere unici\"\n end\n #not_uniq = self.class.where(:anno=>self.anno,:numero_fattura=>self.numero_fattura).where(\"YEAR(data_fattura) = ?\",data_fattura.year).first\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\") if not_uniq\n end", "title": "" }, { "docid": "c416ff9776f265ae4a73db8fa8f8076c", "score": "0.55154824", "text": "def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end", "title": "" }, { "docid": "d586bedb2a45a11305d52073bb76baec", "score": "0.549995", "text": "def trade_is_not_a_repeat\n # see if the record has been created, and has an id assigned\n number_that_can_exist = id.nil? ? 0 : 1\n if Offer.where(user_id: user_id, trade_id: trade_id).length > number_that_can_exist\n errors.add(:user_id, \"user has already made an offer for this trade\")\n end\n end", "title": "" }, { "docid": "f1a196f3bf5dce4fb214d67b18bc5392", "score": "0.54925364", "text": "def preconditions\n validator.kind == :uniqueness\n end", "title": "" }, { "docid": "60a730c5d34c4bee222d4ff6b97858a6", "score": "0.5490336", "text": "def validate_unique_submission\n return unless existing_submission\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/video/submission.'\\\n 'submission_already_exists')\n end", "title": "" }, { "docid": "ca6b606a27a43522fb629366f62e1608", "score": "0.548558", "text": "def test_uniqueness_of_batchid\n client1 = Client.create(:name => 'Test Client1',:tat => 12)\n facility1 = Facility.create(:name => \"Test facility1\",:sitecode => 8234,:client => client1)\n batch1 = Batch.new(:id => 20,\n :batchid=>999,\n :date => Date.today.strftime(\"%m/%d/%Y\"),\n :eob => 30,\n :facility=> facility1,\n :arrival_time => \"#{Time.now}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\"\n )\n assert_equal(true, batch1.save, \"Save failed!\")\n\n client2 = Client.create(:name => 'Test Client2',:tat => 13)\n facility2 = Facility.create(:name => \"Test facility2\",:sitecode => 8235,:client => client2)\n batch2 = Batch.new(:id => 21,\n :batchid=>999,\n :date => \"2006-10-09\",\n :eob => 30,\n :facility=> facility2,\n :arrival_time => \"#{Time.now}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\"\n )\n assert_equal(false, batch2.save)\n end", "title": "" }, { "docid": "9f82e47fc2558a7fba2a0aa8e20f0909", "score": "0.5481317", "text": "def applicant_params (params)\n params.require(:applicant).permit(:name, :surname, :email, :position_id, :recruiter_id, :meeting)\n end", "title": "" }, { "docid": "21fd516f6e368101fe7f16e4cb0f1d8a", "score": "0.5475236", "text": "def validate_consistent_user\n return if course_user && course_user.user == creator\n\n errors.add(:experience_points_record, :inconsistent_user)\n end", "title": "" }, { "docid": "21fd516f6e368101fe7f16e4cb0f1d8a", "score": "0.5475236", "text": "def validate_consistent_user\n return if course_user && course_user.user == creator\n\n errors.add(:experience_points_record, :inconsistent_user)\n end", "title": "" }, { "docid": "adb3829aff13afff8d7b598b1c25c2d1", "score": "0.5474453", "text": "def disallow_superusers_duplicate_via_frontend\n cannot :duplicate_to, Course\n end", "title": "" }, { "docid": "bbc77ba4820da65f4980648c7add6418", "score": "0.5473127", "text": "def applicant_params\n params.require(:applicant).permit(:user_id, :academic_year_id, :first_name, :father_name, :grand_father_name, :gender, :date_of_birth, :applicant_type,\n :place_of_birth, :marital_status, :nationality, :region_id, :city, :phone, :university_id,\n :other_university, :university_type, :qualification, :program_id, :do_you_have_needs_for_disability,\n :disability, :i_understand, :i_give_my_permission, :exam_hub_id,\n :passport_size_photo, :passport_or_admission_card, :original_diploma, :official_transcript, :authenticated_document_from_herqa)\n end", "title": "" }, { "docid": "a043da909aa3ba56a8ec002cf557c3fd", "score": "0.547185", "text": "def create\n @applicant = Applicant.new(params[:applicant])\n\n respond_to do |format|\n if @applicant.save\n if @applicant.wall_post == true\n User.delay.share_application(current_user.id, applicant_url(@applicant))\n end\n UserMailer.delay.applicant_confirmation(@applicant)\n format.html { redirect_to success_applicant_path(@applicant), notice: 'Applicant was successfully created.' }\n format.json { render json: @applicant, status: :created, location: @applicant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb234c9850e076008b7d973c493232b1", "score": "0.54660076", "text": "def validate_on_create\n if View.find(:first, :conditions => [\"created_by = ? and resource_type = ? and resource_id = ?\", created_by, resource_type, resource_id])\n errors.add_to_base(\"View must be unique\")\n end\n end", "title": "" }, { "docid": "9d99e924710d434a794adf48f043d43d", "score": "0.54647684", "text": "def check_uniqueness(klass, filter)\n instance = klass.new\n group = [filter.attributes.map { |a| instance.respond_to?(\"#{a}_id\") ? \"#{a}_id\".to_sym : a }]\n\n group << filter.options[:scope] if filter.options[:scope].present?\n group = group.flatten.uniq\n ids = klass.group(group).count.select { |_k, v| v > 1 }\n [ids, \" #{ids.count} records that are not unique per (#{group.join(', ')})\"]\n end", "title": "" }, { "docid": "2a33684690d7a8cc24ce6ff6c008b899", "score": "0.54642487", "text": "def validate_challonge_id_uniqueness\n if tournament.matches.where.not(id: id).where(challonge_id: challonge_id).any?\n errors.add(:challonge_id, \"is not unique\")\n end\n end", "title": "" }, { "docid": "75968e4bd93eec60619876827ec4b81b", "score": "0.54627717", "text": "def after_save\n validate_uniqueness_as_run(:name)\n end", "title": "" }, { "docid": "8657d1ae4e95676a656567175a304445", "score": "0.5444882", "text": "def must_not_be_a_duplicate_review\n dup_reviews = Review.where(user: user, product: product)\n if new_record?\n if dup_reviews.length > 0\n errors.add(:product, \"already has a review from this user.\")\n end\n elsif dup_reviews.length > 0 && !dup_reviews.include?(self)\n errors.add(:product, \"already has a review from this user.\")\n end\n end", "title": "" }, { "docid": "c523c1bedd5ceb30b778557d601b286d", "score": "0.54411376", "text": "def create\n @applicant = Applicant.new(params[:applicant])\n\n respond_to do |format|\n if @applicant.save\n format.json { render json: @applicant, status: :created, location: @applicant }\n else\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b2460c4297d1e38386a96fb4e9c32db", "score": "0.54384595", "text": "def validate_unique(record)\n return if provided(record).uniq.length == provided(record).length\n\n record.errors.add(\n options[:attribute],\n 'contains an option more than once'\n )\n end", "title": "" }, { "docid": "684f195e69eb5e76e861403cb540c1e6", "score": "0.54359823", "text": "def name_must_be_unique_if_organization\n unless type == \"Individual\"\n self.errors.add(:name, :is_already_taken) if Entity.where('lower(name) = ?', name.downcase).any?\n end\n end", "title": "" }, { "docid": "1cc2e23682b8beb52298c332724c0d83", "score": "0.5430532", "text": "def create\n @applicant = Applicant.new(applicant_params)\n @applicant.student_id = current_user.id.to_i\n @applicant.references = 0\n respond_to do |format|\n if @applicant.save\n format.html { redirect_to @applicant, notice: 'Applicant was successfully created.' }\n format.json { render :show, status: :created, location: @applicant }\n else\n format.html { render :new }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8aa2a75fa0918df7687015d8914397dd", "score": "0.54260886", "text": "def applicant_params\n params.require(:applicant).permit(:application_case_id, :user_id, :as_role)\n end", "title": "" }, { "docid": "ea58a98629fa9a7873a8305d8c2c6c07", "score": "0.5421885", "text": "def must_not_be_a_project_observation\n\n if ProjectObservation.first(:conditions => {:observation_id => self.observation_id, :project_id => self.project_id})\n errors.add(:observation_id, \"can't be used to make invitation when project_observation exists for same observation_id and project_id\")\n end\n true\nend", "title": "" }, { "docid": "10b123a1e4e65fd9721349bc722114aa", "score": "0.5418185", "text": "def create\n @applicant = Applicant.new(applicant_params)\n @applicant_type = @applicant.applicant_type\n respond_to do |format|\n if @applicant.save\n format.html { redirect_to @applicant, notice: 'Application successfully Saved.' }\n else\n format.html { render :new }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edf075967a73a0ba158ae2a5b5492f6f", "score": "0.54120255", "text": "def check_dups\n\t\t\tCampInstructor.all.each do |e|\n\t\t\t\tif (e.instructor.id == self.instructor_id && e.camp.id == self.camp_id)\n\t\t\t\t\terrors.add(:camp_id, \"camp instrctor obj already exists\")\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn true \n\t\tend", "title": "" }, { "docid": "2f023b0a6b5f3d13c0b36f68f7e8e116", "score": "0.54054344", "text": "def create\n @applicant = Applicant.new(applicant_params)\n\n respond_to do |format|\n if @applicant.save\n format.html { redirect_to @application_case, notice: 'Applicant was successfully created.' }\n format.json { render :show, status: :created, location: @applicant }\n else\n format.html { render :new }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d2106bf803bd285abc76d3ca2775389", "score": "0.5401634", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "0d2106bf803bd285abc76d3ca2775389", "score": "0.5401634", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "90c42c1a1fc19d2b75ada3cd0982240e", "score": "0.53947747", "text": "def duplicant\n\t\t\t@duplicant ||= self.link_fieldlet.entity\n\t\t\t@duplicant || @old_duplicant\n\t\tend", "title": "" }, { "docid": "693d8af7e8b7e674457da71fd1f3dd9f", "score": "0.5392384", "text": "def uniqueness_of_pending_request\n return true if UserRequest.pending_requests.where(team: team, user: user).empty?\n\n errors.add(:user, I18n.t('requests.already_pending'))\n end", "title": "" }, { "docid": "b7c84e4638ae72e905cc09daef75714f", "score": "0.53731054", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "082c2962af8d9e19d80d158d4307cc41", "score": "0.5372491", "text": "def email_is_unique\n active_users = User.active.where(:email => self.email)\n active_users = active_users.exclude(self) unless self.new_record?\n errors.add :email, 'ya existe' if active_users.count(:id) > 0\n end", "title": "" }, { "docid": "7d1f467d55fecd654deb6e9ffae30e5e", "score": "0.53700024", "text": "def create\n @applicant = ApplicantUser.new(applicant_params)\n\n respond_to do |format|\n if @applicant.save\n format.html { redirect_to admin_applicant_path(@applicant), notice: 'Applicant was successfully created.' }\n format.json { render :show, status: :created, location: @applicant }\n else\n format.html { render :new }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bf09cd2997c857b217cb1ea0d50472d", "score": "0.53575504", "text": "def validate_consistent_user\n return if course_user && course_user.user_id == creator_id\n errors.add(:experience_points_record, :inconsistent_user)\n end", "title": "" }, { "docid": "d0d0f2563e89bc235b72942163a23583", "score": "0.5355889", "text": "def create\n @applicant = Applicant.new(params[:applicant])\n\n respond_to do |format|\n if @applicant.save\n ApplicantMailer.application_confirmation(@applicant).deliver\n ApplicantMailer.application_notification(@applicant).deliver\n format.html { redirect_to root_url, notice: 'Applicant was successfully created.' }\n format.json { render json: @applicant, status: :created, location: @applicant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e122f989fe5a1aad8a4b4fd78928590e", "score": "0.53545195", "text": "def validates_duplicity_of(attr_name, scope: nil)\n set_callback :save, :before, Callback.new(attr_name, scope)\n end", "title": "" }, { "docid": "6966d7e4dbcc88102716b21691d6af55", "score": "0.5353109", "text": "def validate_enrolment\n if self.offer_id.present?\n if self.subject_id != Offer.find(self.offer_id).subject_id\n errors.add(:enrolment, 'Offer subject id not same as enrolment subject')\n end\n end\n end", "title": "" }, { "docid": "1e93c8bf43c904a2928cf31ab06f707a", "score": "0.5345013", "text": "def create\n @guarantor = Guarantor.new(params[:guarantor])\n\n respond_to do |format|\n if @guarantor.save\n applicant=Applicant.find(@guarantor.applicant_id)\n format.html { redirect_to(applicant, :notice => 'Guarantor was successfully updated.') }\n format.xml { render :xml => @guarantor, :status => :created, :location => @guarantor }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @guarantor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7f9a9d9cf13e1857f3ccc6caea13707", "score": "0.5342138", "text": "def duplicate_email\n\t\tif Student.find_by email: email or TeachingAssistant.find_by email: email\n\t\t\terrors.add(:email, \"has already been taken\")\n\t\tend\n\tend", "title": "" }, { "docid": "168ad08c3e0f30f0bf6cb45f21b9578b", "score": "0.5340614", "text": "def create\n @graduate_applicant = GraduateApplicant.new(params[:graduate_applicant])\n\n # Set Graduate Applicant Department To The Current User's Department\n @graduate_applicant.department_id = current_user.department_id\n \n #Capitalize First and Last Names\n @graduate_applicant.first_name = @graduate_applicant.first_name.capitalize\n @graduate_applicant.last_name = @graduate_applicant.last_name.capitalize\n\n add_application_requirements\n\n add_degree_requirements\n\n respond_to do |format|\n if @graduate_applicant.save\n \n clear_application_received_date\n \n flash[:notice] = 'Graduate Applicant was successfully created.'\n format.html { redirect_to(@graduate_applicant) }\n format.xml { render :xml => @graduate_applicant, :status => :created, :location => @graduate_applicant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @graduate_applicant.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f57c5a263b4bf431f56412ed6b31e7d", "score": "0.53374994", "text": "def applicant_params\n params.require(:applicant).permit(:fname, :lname, :year, :email, :schedule_id, :available,\n :mondayStartFirst, :mondayEndFirst,\n :tuesdayStartFirst, :tuesdayEndFirst,\n :wednesdayStartFirst, :wednesdayEndFirst,\n :thursdayStartFirst, :thursdayEndFirst,\n :fridayStartFirst, :fridayEndFirst,\n :mondayStartSecond, :mondayEndSecond, \n :tuesdayStartSecond, :tuesdayEndSecond, \n :wednesdayStartSecond, :wednesdayEndSecond, \n :thursdayStartSecond, :thursdayEndSecond, \n :fridayStartSecond, :fridayEndSecond,\n :schedule, :classOne, :classTwo, :classThree, :student_id, :references, :semester)\n end", "title": "" }, { "docid": "6c015ba6fe1f21df36894a572f93e4ed", "score": "0.5334856", "text": "def name_is_unique\n return if self.name.nil?\n errors.add(:name, 'has already been taken') if Institution.where(name: self.name).reject{|r| r == self}.any?\n end", "title": "" }, { "docid": "a4583ddc114855ee2ff6eadb33391001", "score": "0.53328735", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:puc_type_code => self.puc_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_puc_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "f46188aad34c0cfe4ca5a14116c9be76", "score": "0.5298439", "text": "def unique_email_user\n if self.class.where(email: email).count > 0\n errors.add(:email, :taken)\n end\n end", "title": "" }, { "docid": "4a7abd8025a5f2c12dc207323961e4b1", "score": "0.5297827", "text": "def set_applicant\n @applicant = Applicant.where(key: params[:id]).first\n end", "title": "" }, { "docid": "b66995a94b8b012e021fb9c52ccb197d", "score": "0.52912784", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_group_code => self.farm_group_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm_group\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "52d730d0adf1797ae26c09d7661ad500", "score": "0.5283021", "text": "def verify_org_task_unique\n # do not verify for split appeal process\n return if appeal.appeal_split_process == true\n return if !open?\n\n if appeal.tasks.open.where(\n type: type,\n assigned_to: assigned_to,\n parent: parent\n ).any? && assigned_to.is_a?(Organization)\n fail(\n Caseflow::Error::DuplicateOrgTask,\n docket_number: appeal.docket_number,\n task_type: self.class.name,\n assignee_type: assigned_to.class.name\n )\n end\n end", "title": "" }, { "docid": "908b41cb2d5aea4b880e44f3d79050dc", "score": "0.5282714", "text": "def retail_subdomain_uniqueness\n return if retail_subdomain.blank? || !retail_subdomain_changed?\n errors.add(:retail_subdomain, :taken) if given_subdomain_exists?(retail_subdomain)\n end", "title": "" }, { "docid": "ce939e13bc9c9824243394e967dbd0c2", "score": "0.5274715", "text": "def validate_unique_with_status\n psl = PersonSchoolLink.where(:person_id => self.person_id, :school_id => self.school_id).status_active\n if self.id\n psl = psl.where(\"id != #{self.id}\")\n end\n if psl.length > 0\n errors.add(:status, \"Username already associated with this school.\")\n end\n end", "title": "" }, { "docid": "a9f517e8b0ed43cf557ec6aa406f7ceb", "score": "0.52701813", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:account_code => self.account_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_account\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "c4893f6e14a64586f40b3189e08dc367", "score": "0.5270148", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "c4893f6e14a64586f40b3189e08dc367", "score": "0.5270148", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "c4893f6e14a64586f40b3189e08dc367", "score": "0.5270148", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "c4893f6e14a64586f40b3189e08dc367", "score": "0.5270148", "text": "def set_applicant\n @applicant = Applicant.find(params[:id])\n end", "title": "" }, { "docid": "d1aa64dbc6e2b08fd586fb203496df74", "score": "0.52680093", "text": "def should_validate_uniqueness_of(*attributes)\n message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive)\n scope = [*scope].compact\n case_sensitive = true if case_sensitive.nil?\n\n attributes.each do |attribute|\n matcher = validate_uniqueness_of(attribute).\n with_message(message).scoped_to(scope)\n matcher = matcher.case_insensitive unless case_sensitive\n should matcher.description do\n assert_accepts(matcher, subject)\n end\n end\n end", "title": "" }, { "docid": "2f4aab28cdd97d143398788681808beb", "score": "0.52663654", "text": "def point_of_contact_is_associated\n return unless point_of_contact\n return if users.include? point_of_contact\n\n errors.add(:point_of_contact, 'must be an associated applicant')\n end", "title": "" }, { "docid": "b3eb05a8a31541c733a2e09e336ee215", "score": "0.5261526", "text": "def salesforce_applicant_params\n params.require(:salesforce_applicant).permit(:name, :applicant_id)\n end", "title": "" }, { "docid": "8ade47a554ffc2de1e2945f776f96312", "score": "0.52593136", "text": "def disallow_if_accepted_proposal\n if listing.accepted_proposal and listing.accepted_proposal.id == id\n errors.add(:base, \"You can't remove an accepted proposal.\") \n end\n\n #if blank, return true, and therefore allow destruction\n errors.blank? \n end", "title": "" }, { "docid": "41bdfb5635a1d9339a5aeaf9399d9d26", "score": "0.5243973", "text": "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "title": "" }, { "docid": "90b762ddc73fba3c4b2f268c69df6772", "score": "0.5243098", "text": "def set_applicant\n @applicant = ApplicantUser.find(params[:id])\n end", "title": "" }, { "docid": "d8928d0b241acc37ad4456d8ee6f1b5c", "score": "0.5242624", "text": "def unique_name\n return true unless company && name\n scope = company.time_periods.where('LOWER(name) = ?', self.name.downcase)\n scope = scope.where('id <> ?', self.id) if self.id\n\n errors.add(:name, \"with value #{name} has already been taken\") if scope.count > 0\n end", "title": "" }, { "docid": "61934e846fd94737a94da4d27a776b7b", "score": "0.52405846", "text": "def applicant_params\n params.require(:applicant).permit(:name, :email, :score, :token, :challenge_id, :attachment, :id, :log, :language)\n end", "title": "" }, { "docid": "0bbf6b6567b93b172a600279fc7663a0", "score": "0.5239142", "text": "def validate_supervisor\r\n return false unless @current_user.is_supervisor?\r\n expense = Expense.find(params[:id]) rescue nil\r\n return false if expense.blank?\r\n expense.user.supervisor_id == @current_user.id || expense.project.supervisor_id == @current_user.id\r\n end", "title": "" }, { "docid": "d48a79c6aff038f72f8e1656cfa65555", "score": "0.5234935", "text": "def ensure_different_creator_and_user\n errors.add(:user_id, \"can't be same as creator\") if user == creator\n end", "title": "" }, { "docid": "4f9eb00961d21f969075cce76d414eb4", "score": "0.5227807", "text": "def applicant_params\n params.require(:applicant).permit(:name, :contact, :status, :salary)\n end", "title": "" }, { "docid": "d79d18ddc869b48b074bb57545441f3a", "score": "0.5220393", "text": "def create\n @applicant = Applicant.new(applicant_params)\n\n respond_to do |format|\n if @applicant.save\n format.html {\n UserMailer.registration_confirmation(@applicant).deliver\n redirect_to @applicant, notice: 'Applicant was successfully created and will send u email your information.'\n }\n format.json { render action: 'show', status: :created, location: @applicant }\n else\n format.html { render action: 'new' }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4cf6c6245676ffe3af282bc453ae0ab", "score": "0.5218918", "text": "def sent_to_applicant\n ApplicateMailer.with(applicate: Applicate.first).sent_to_applicant\n end", "title": "" }, { "docid": "863fcc7afcd262a1ffa16bb12b5ef320", "score": "0.5218067", "text": "def test_duplicate_religion_value\n religion_obj = Religion.new(:name => 'Roman Catholic')\n assert !religion_obj.valid?\n assert religion_obj.errors.invalid?(:name)\n end", "title": "" } ]
6dd4aae0ac13c3e6107ccaf93d913570
Time Complexity: O(n) where is equal to number of each single node in the tree Space Complexity: O(n) where n is the number of functino calls
[ { "docid": "8f79ef9c4b783080a3a2cfc105a5d99a", "score": "0.0", "text": "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "title": "" } ]
[ { "docid": "a11565bfce15075e1ca2cc65e69e3480", "score": "0.65899783", "text": "def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend", "title": "" }, { "docid": "751bc6f151fc4e87e3fd9118f4624696", "score": "0.6387855", "text": "def total_node_number(tree)\n if tree.root == nil\n 0\n else\n left_tree = MyBinaryTree.new\n left_tree.root = tree.root.left_child\n right_tree = MyBinaryTree.new\n right_tree.root = tree.root.right_child\n 1+total_node_number(left_tree)+total_node_number(right_tree)\n end\nend", "title": "" }, { "docid": "ee949a433d5b1a5996d6e25d61cad81d", "score": "0.6386238", "text": "def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend", "title": "" }, { "docid": "a567d9589d718f09946caf0030f21755", "score": "0.63310856", "text": "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "title": "" }, { "docid": "a34742ff4dd61753bf3c3f07a5a2e574", "score": "0.6210545", "text": "def size_without_recursion\n count = 0\n return 0 unless @root\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n while !q.isEmpty?\n node = q.dequeue\n count += 1\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n count\n end", "title": "" }, { "docid": "2f4df710cac0e74a8d4997c615d23003", "score": "0.62057906", "text": "def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend", "title": "" }, { "docid": "6d4f6a517b676827f3f263eb5b86e1e9", "score": "0.6203919", "text": "def produce_tree(ary); end", "title": "" }, { "docid": "e382d392729605878c23069dde6a8541", "score": "0.6197254", "text": "def sum_of_left_leaves(root)\nend", "title": "" }, { "docid": "578a00f05bad8079aca46e842ec17514", "score": "0.6188202", "text": "def topologies(n, cache = {})\n cache[n] =\n n == 0 ? 1 : (0..n-1).inject(0){ |sum, i| \\\n sum + topologies(i, cache) * topologies(n-i-1, cache) } unless cache.has_key? n\n cache[n]\nend", "title": "" }, { "docid": "c2244bafba633ec312dd40740c3b5189", "score": "0.6171208", "text": "def visit_node(n); end", "title": "" }, { "docid": "f286cf688180253f35897a2b342a5454", "score": "0.6168265", "text": "def size(node)\n if node.nil?\n return 0\n elsif node.left_child.nil? && node.right_child.nil?\n return 1\n else\n left_size = size(node.left_child)\n right_size = size(node.right_child)\n return left_size + 1 + right_size\n end\nend", "title": "" }, { "docid": "61e56687479cc681b5ad0e3034349a5e", "score": "0.60919607", "text": "def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end", "title": "" }, { "docid": "77e40b6174437de5de2446cd06bae5e2", "score": "0.6063914", "text": "def count_leaf_nodes(node)\n if node.nil?\n return 0\n elsif node.left_child.nil? && node.right_child.nil?\n return 1\n else\n left_leaves = count_leaf_nodes(node.left_child)\n right_leaves = count_leaf_nodes(node.right_child)\n return left_leaves + right_leaves\n end\nend", "title": "" }, { "docid": "922f936725d9cd57764c013fae9f4625", "score": "0.60626966", "text": "def in_order_traverse(tree, array)\n if !tree.nil?\n in_order_traverse(tree.left, array)\n array.append(tree.value)\n in_order_traverse(tree.right, array)\n end\n return array\n\n\nend", "title": "" }, { "docid": "843b6b9d24f4958487c2565a3054f08d", "score": "0.6037271", "text": "def find_smallest_sum(node)\n # traverse entire tree and keep track of smallest sums and return that sum\n # DFS\n return node.value if node.children.empty? # base case\n\n min_sum = Integer::MAX\n\n node.children.each do |child|\n sum = node.value + find_smallest_sum(child)\n min_sum = Math.min(sum, min_sum)\n end\n\n return min_sum\n\nend", "title": "" }, { "docid": "3b6fe118bbe1f0bd51801e43b7380d72", "score": "0.6029624", "text": "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend", "title": "" }, { "docid": "aaeed4145bcc6b736c514199773ab652", "score": "0.60193425", "text": "def dfs(root, sum, flag)\n return if root.nil?\n @count += 1 if root.val == sum\n dfs(root.left, sum - root.val, false)\n dfs(root.right, sum - root.val, false)\n if flag\n dfs(root.left, sum, true)\n dfs(root.right, sum, true)\n end\nend", "title": "" }, { "docid": "3cb0f8e39257fed35f04fd0c403070df", "score": "0.6016655", "text": "def utopian_tree_size(n)\n\n\t# Using the formula above, the solution is quite simple\n\t# (n) = (2^(m+1) - 2) + 1(1 - n mod 2), where m = ( n + n mod 2) / 2\n\n\t# Find the max M \n\tm = ( n + n % 2) / 2\n\n\t# Get the result \n\t(2**(m+1) - 2 + 1*(1 - n % 2))\nend", "title": "" }, { "docid": "c65aab22b50b5d14f32cd73ef0e168f8", "score": "0.5999898", "text": "def print_tree(n, i = 0)\n i.times { print \" \" }\n puts \"+-#{n}\"\n $classtree[n].sort.each { |c| print_tree(c, i+2) }\nend", "title": "" }, { "docid": "4170432ef4da8b19cc829580a8150426", "score": "0.59641266", "text": "def dfs(root, depth)\n return if root.nil?\n @f[depth] = @f[depth].to_i + root.val\n dfs(root.left, depth + 1) if root.left\n dfs(root.right, depth + 1) if root.right\nend", "title": "" }, { "docid": "ac621869e0a6d6fc445a78dc8f196200", "score": "0.5963482", "text": "def build_tree(arr)\n\tend", "title": "" }, { "docid": "754b75a64844899c8794b5d7285b51ae", "score": "0.5957051", "text": "def count_nodes(node = @root)\n node.children.map do |child_node|\n @node_count +=1\n # binding.pry if child_node.is_word\n count_nodes(child_node)\n end\n @node_count\n end", "title": "" }, { "docid": "4b0d8c9533200ab26dfee39d4c2e8f54", "score": "0.5954579", "text": "def tree(n)\n SegmentTree.new list(n)\nend", "title": "" }, { "docid": "80070882908244f86ced034993bf9157", "score": "0.59325516", "text": "def build_tree_unsorted(array)\n array.each_index{ |index|\n\n }\nend", "title": "" }, { "docid": "c91ee6c58cb6d72ad52a5799f6acdc78", "score": "0.592998", "text": "def func(node,subtree_node_index_in_array,subtree_begin_index,subtree_end_index)\n\tif subtree_begin_index == subtree_end_index\n\t\t#puts \"leaf node begin #{subtree_begin_index} and end #{subtree_end_index}\"\n\t\t#puts $inorder_array[subtree_begin_index]\n\telse\n\t\t$preorder_index = $preorder_index + 1\n\t\tleft_subtree_node_value = $preorder_array[$preorder_index]\n\t\tleft_subtree_node_index_in_array = find_index_of_value_in_in_array(left_subtree_node_value,subtree_begin_index,subtree_node_index_in_array - 1)\n\t\tleft_node = Btnode.new($inorder_array[left_subtree_node_index_in_array])\n\t\tnode.left = left_node\n\t\tfunc(left_node,left_subtree_node_index_in_array,subtree_begin_index,subtree_node_index_in_array - 1 )\n\t\t#puts \"subtree node at #{$inorder_array[subtree_node_index_in_array]}\"\n\t\t#puts $inorder_array[subtree_node_index_in_array]\n\t\t$preorder_index = $preorder_index + 1\n\t\tright_subtree_node_value = $preorder_array[$preorder_index]\n\t\tright_subtree_node_index_in_array = find_index_of_value_in_in_array(right_subtree_node_value,subtree_node_index_in_array + 1,subtree_end_index)\n\t\tright_node = Btnode.new($inorder_array[right_subtree_node_index_in_array]) \n\t\tnode.right = right_node\n\t\tfunc(right_node,right_subtree_node_index_in_array,subtree_node_index_in_array + 1,subtree_end_index)\n\tend\nend", "title": "" }, { "docid": "82e7af0f466692b8f45f678e155d5a93", "score": "0.59062314", "text": "def elegant_tree_by_levels(node)\n stack=[]\n stack.push node if node\n stack.each do |n|\n stack.push n.left if n.left\n stack.push n.right if n.right\n end\n stack.map! &:value\nend", "title": "" }, { "docid": "9af3ed4587fa7a633deb093b96970ab8", "score": "0.58998275", "text": "def tes_gettree\n tree = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree { |b| tree.push b.rev_index }\n }\n tree_d = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree_debug { |b| tree_d.push b.rev_index }\n }\n\n assert_equal 389, tree.count\n assert_equal 389, tree_d.count\n end", "title": "" }, { "docid": "593a88894f9b4b3c4733ce68daf12fb2", "score": "0.5899169", "text": "def total_node_number_cps(tree)\n callcc{|cc|\n helper_2(tree.root, cc, 0)\n }\nend", "title": "" }, { "docid": "227e6b100d87ed2d5e23ed690207381f", "score": "0.5883363", "text": "def full_nodes_count(root)\n if root.nil?\n puts 'Empty tree'\n return\n end\n full_nodes_count = 0\n queue = QueueWithLinkedList.new\n queue.enqueue(root)\n while !queue.isEmpty?\n node = queue.dequeue\n full_nodes_count += 1 if node.left && node.right\n queue.enqueue(node.left) if node.left\n queue.enqueue(node.right) if node.right\n end\n full_nodes_count\n end", "title": "" }, { "docid": "34acc8dd2134391997ba35fc2a76e485", "score": "0.58824486", "text": "def number_of_half_nodes_in_binary_tree(root)\n return 0 if !root\n count = 0\n queue = Queue.new()\n queue.enqueue(root)\n while(!queue.is_empty?)\n node = queue.dequeue\n\n count += 1 if (node.left_child && !node.right_child) || (!node.left_child && node.right_child)\n\n queue.enqueue(node.left_child) if node.left_child\n queue.enqueue(node.right_child) if node.right_child\n end\n count\nend", "title": "" }, { "docid": "8f026304973bc41abbafcdaf6400c865", "score": "0.5877429", "text": "def size\n return 0 if empty?\n count_node(head, 1)\nend", "title": "" }, { "docid": "345f077899d42ec697e4e100ef85be9f", "score": "0.5873508", "text": "def challenge4\n\t@size = length(@rootNode)\n\tputs \"Challenge #4 solution: \"\n\tputs \"Number of nodes in tree: \" + @size.to_s\n\tputs \"-----------------------------------\"\nend", "title": "" }, { "docid": "032f579338e58ed933619240fe9953ca", "score": "0.5860718", "text": "def calc_tree\n tree = []\n n = 1\n while n <= @n\n result = []\n result = [[0, 1]] if n == 1\n tree.each do |row|\n line1 = []\n line2 = []\n row.each_with_index do |elem, i|\n line1 << \"#{elem}0\" if i.positive?\n line2 << \"#{elem}0\" if i.zero?\n line2 << \"#{elem}1\"\n end\n result << line1 unless row.count == 1\n result << line2\n end\n tree = result\n n += 1\n end\n tree\n end", "title": "" }, { "docid": "e5e665dc55f24817e0fd9e3359e48e76", "score": "0.58434236", "text": "def size\n return @tree.size\n end", "title": "" }, { "docid": "f15281148bc180428829c944c73c4aa6", "score": "0.58305645", "text": "def depth_first(node, visited = Set.new())\n return nil if visited.include?(node.val)\n\n puts node.val\n visited.add(node.val)\n\n node.neighbors.each do |neighbor|\n depth_first(neighbor, visited);\n end\nend", "title": "" }, { "docid": "4c48e30661f8e6926acdee1057d4be13", "score": "0.5828009", "text": "def display_tree(an_array)\r\n an_array.length\r\n count = 1\r\n (count - 1).upto(count) do\r\n end\r\nend", "title": "" }, { "docid": "fe8b5d02d07574d6924586203eeba0c7", "score": "0.5811536", "text": "def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend", "title": "" }, { "docid": "9fd56d34be5153f0eb2329e7342472d7", "score": "0.5805588", "text": "def n_ary_trees(range=2..2, minimize=true)\n raise \"Range parameter expected\" unless range.is_a? Range\n min = range.first.to_i\n raise \"minimum branches must be at least 2\" unless min > 1\n max = range.last.to_i\n max -= 1 if range.exclude_end?\n raise \"maximum branches less than minimum branches\" if max < min\n return [] if empty?\n\n # a lambda so we can do recursion without sticking private methods in Array\n\n # all n-way branches of a\n nwb = -> (a, n) do\n n = a.length if n > a.length\n if n == 1\n [a]\n else\n rv = []\n (1..( a.length - n + 1 )).each do |i|\n a1 = a[0...i]\n r = n - 1\n nwb.call( a[i..-1], r ).each do |branches|\n branches = [branches] if r == 1\n rv << [a1.dup] + branches\n end\n end\n rv\n end\n end\n\n # faux method for recursively making n-ary trees\n nt = -> (a) do\n if a.length <= min\n [a]\n else\n rv = []\n (min..( a.length < max ? a.length : max )).each do |branchiness|\n nwb.call( a, branchiness ).each do |part|\n head, *tail = part.map{ |a2| nt.call a2 }\n if tail.any?\n head = head.map{ |t| [t] }\n tail.each do |nxt|\n h = []\n head.each do |a1|\n nxt.each do |a2|\n h << a1 + [a2]\n end\n end\n head = h\n end\n end\n rv += head\n end\n end\n rv\n end\n end\n\n trees = nt.(self)\n\n if minimize\n m = -> (t) do\n if t.is_a? Array\n if t.length == 1\n m.call( t[0] )\n else\n t.map{ |t2| m.call t2 }\n end\n else\n t\n end\n end\n\n m.call trees\n else\n trees\n end\n end", "title": "" }, { "docid": "cf72197e7c7496e2c650c433e7da75d6", "score": "0.5802098", "text": "def total_depth(node, depth = 0)\n @d = depth\n @d = @d + 1 if node.children.size > 0\n node.children.map{|c| x = total_depth(c,@d) - 1; @d = x if x > @d }\n return @d\nend", "title": "" }, { "docid": "88ac2b52e90688d550a138062ef6b7fa", "score": "0.5795948", "text": "def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend", "title": "" }, { "docid": "baa76ca668525e2a90dd2f882fc5e4f9", "score": "0.5795308", "text": "def depth_search(node, proc)\n res = nil\n counter = 0\n number_of_children = node.children.length\n\n while counter < number_of_children\n return res if res\n\n child = node.children[counter]\n res = proc.call(child)\n return res if res\n\n res = depth_search(child, proc)\n counter += 1\n end\n res\n end", "title": "" }, { "docid": "8ebe8f2b0b2e77b25fd4027d35be5408", "score": "0.578294", "text": "def size_all\n\t\tfname=\"Node:#{__method__}\"\n\t\tret=0\n\t\tlevel=0\n\t\tbegin\n\t\t\tret=self.size_all_(ret, level)\n\t\trescue Exception=>e\n\t\t\tLOG.error(fname){\"EXCEPTION during nodes size calculation: #{e} \"}\n\t\tret=-1\n\t\tend\n\t\tret\n\tend", "title": "" }, { "docid": "c78dc94ec22cffc97ef68d33300a2e6f", "score": "0.57815534", "text": "def num_of_arr_trees_supp(arr, start_index, end_index)\n return 1 if start_index > end_index\n i = start_index\n sum = 0\n while i <= end_index\n left_count = num_of_arr_trees_supp(arr, start_index, i - 1)\n right_count = num_of_arr_trees_supp(arr, i + 1, end_index)\n sum += left_count * right_count\n i+=1\n end\n sum\n end", "title": "" }, { "docid": "28268cd121aa30f0101e76151977a360", "score": "0.57647985", "text": "def preOrder(root) # O(n)\n\n return nil if root == nil\n\n print \" #{root.value}\"\n preOrder(root.left)\n preOrder(root.right)\n\nend", "title": "" }, { "docid": "2a6253e1cd6e05da7508c2a2360d4a17", "score": "0.5750581", "text": "def tree_sum(head, target)\n @res = 0\n helper(head, target, 0, {0=> true})\n return @res\nend", "title": "" }, { "docid": "68fca9e2da0db0c4f77f57520e96fae3", "score": "0.5749277", "text": "def orbit_count\n return 0 unless @root\n sum_of_depths = 0\n nodes_to_traverse = [{ node: @root, depth: 0 }]\n until nodes_to_traverse.empty?\n node_pair = nodes_to_traverse.shift\n node = node_pair[:node]\n depth = node_pair[:depth]\n sum_of_depths += depth\n node.children.each { |child| nodes_to_traverse << { node: child, depth: depth + 1 } }\n end\n sum_of_depths\n end", "title": "" }, { "docid": "2c48621d55b6ab4521b69b5a7e0fef1e", "score": "0.5745791", "text": "def dfs(node ,max)\n return if node.nil?\n if node.val >= max\n @count += 1\n max = node.val\n end\n dfs(node.left, max)\n dfs(node.right, max)\nend", "title": "" }, { "docid": "bd18ba59d6fa46fe188693567f372315", "score": "0.5745688", "text": "def tree_by_levels(node)\n return [] if node.nil?\n queue = [node]\n visited = []\n while !queue.empty?\n node = queue.shift\n visited << node.value\n [node.left, node.right].each do |child|\n queue << child if child\n end\n end\n visited\nend", "title": "" }, { "docid": "6ee46440c4a0390dcb77e76f9dbaa28b", "score": "0.57431275", "text": "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend", "title": "" }, { "docid": "f0ec2ea69396a16c7c580dc726abb3cf", "score": "0.57349336", "text": "def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\n count\n end", "title": "" }, { "docid": "1d2352af9709425e873c340d6afe7728", "score": "0.5726943", "text": "def subtree_size(node)\n return 0 if node.nil?\n\n 1 + subtree_size(node.left) + subtree_size(node.right)\n end", "title": "" }, { "docid": "9491dd1bde1977cfe49156183a296821", "score": "0.57099617", "text": "def leaves(node)\n return 1 if /\\d+/.match(node.value)\n return (leaves(node.left) + leaves(node.right))\nend", "title": "" }, { "docid": "8067e9fa1d9f95446349f07e454d8335", "score": "0.56887645", "text": "def find_weights(node_name,node_hash)\n node = node_hash[node_name]\n if(node[\"children\"])\n node[\"total_weight\"] = node[\"weight\"] + node[\"children\"].map{|c| find_weights(c,node_hash)}.inject(:+)\n else\n node[\"total_weight\"] = node[\"weight\"]\n end\n node[\"total_weight\"]\nend", "title": "" }, { "docid": "e5ee756468b394cc87ed2b55b167626c", "score": "0.568582", "text": "def recalculate(inode)\n full_count = 0\n inode.list_of_children.each do |node|\n#p node\n komvos = self.get(node)\n#p komvos\n if komvos.normalize==0\n puts \"node #{node} is not leaf\"\n # if not leaf\n #recalc(holon.searchFor(node).listOfChildren)\n self.recalculate(komvos)\n else \n # exw kanei: node.normalize kai einai leaf\n puts \"node #{node} is leaf\"\n \n end\n # uplogizw to sum of coun and re-normalize\n full_count = full_count + komvos.weight\n end\n inode.weight = full_count\n end", "title": "" }, { "docid": "6361edfe17e5caf501eefa4c48ee3982", "score": "0.5684165", "text": "def calc_numbers(n, indexes) #:nodoc:\n my_lft = n\n # performance improvements (3X or more for tables with lots of columns) by using :select to load just id, lft and rgt\n ## i don't use the scope condition here, because it shouldn't be needed\n my_children = self.class.find_in_nested_set(:all, :conditions => \"#{prefixed_parent_col_name} = #{self.id}\",\n :order => \"#{prefixed_left_col_name}\", :select => \"#{self.class.primary_key}, #{prefixed_left_col_name}, #{prefixed_right_col_name}\")\n if my_children.empty?\n my_rgt = (n += 1)\n else\n for c in (my_children)\n n = c.calc_numbers(n + 1, indexes)\n end\n my_rgt = (n += 1)\n end\n indexes << {:id => self.id, :lft => my_lft, :rgt => my_rgt} unless self[left_col_name] == my_lft && self[right_col_name] == my_rgt\n return n\n end", "title": "" }, { "docid": "66f0213593b14d5056d7c0109937a86c", "score": "0.5683638", "text": "def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end", "title": "" }, { "docid": "7e5acb4f9985acceee3d9a1b747b77e9", "score": "0.5681519", "text": "def fulltree_count(*args)\n fulltree_rels(*args).size\n end", "title": "" }, { "docid": "e5f6c7acefa92c7414990ed8809cd997", "score": "0.5680019", "text": "def dfs(root)\n return if root.nil?\n @stack << root\n @hash[root] = [root.val]\n @stack.each do |node|\n @hash[node] << root.left&.val\n @hash[node] << root.right&.val\n end\n dfs(root.left)\n dfs(root.right)\n @stack.pop\nend", "title": "" }, { "docid": "f506869410de1bef3b72011d94824252", "score": "0.56800115", "text": "def find_height_nodes(root) # O(n)\n return 0 if root == nil\n left_height = 1 + find_height_nodes(root.left)\n right_height = 1 + find_height_nodes(root.right)\n\n return (left_height > right_height)? left_height : right_height\nend", "title": "" }, { "docid": "40cae4df25a0b3d77a0bfb7ea44d8a97", "score": "0.56758857", "text": "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend", "title": "" }, { "docid": "e569fc594947a5ed64e0fde745178558", "score": "0.5674079", "text": "def fitness\n -(0..5).map{|t| \n $pors_store = 0 # reset store\n t_val = t\n values = {:rec=>proc{$pors_store},:T=>proc{ cv=t_val; t_val=0; cv} } # using T destroys T\n (eval_genes(values) - N*t).abs \n }.sum - 0.1*size # find a tree that multiplies T by 3\n end", "title": "" }, { "docid": "92940508d24bdced8e3bc9ab4d100e43", "score": "0.56731987", "text": "def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend", "title": "" }, { "docid": "ff1d871bab8cc810ba3f212e5cb814e9", "score": "0.5670432", "text": "def max_depth(root)\n node_queue = [root]\n depth = 0\n\n while node_queue.any?\n depth += 1\n breadth = node_queue.size\n breadth.times do\n node = node_queue.shift\n node_queue.push(node.left) unless node.left.nil?\n node_queue.push(node.right) unless node.right.nil?\n end\n end\n\n depth\nend", "title": "" }, { "docid": "f280f2b756fa7f923cfd6975a1e6c71f", "score": "0.56668127", "text": "def length\n @tree.length\n end", "title": "" }, { "docid": "cada20a9befdf6682de2d1ab88ef80cc", "score": "0.565169", "text": "def subtree_count(*args)\n subtree_rels(*args).size\n end", "title": "" }, { "docid": "06ff1225a4caeebb0a77e0d074b6144f", "score": "0.56514573", "text": "def full_tree_node_count(min_capacity)\n full_tree_leaf_count(min_capacity) * 2 - 1\n end", "title": "" }, { "docid": "4c5921ebafabf687d9278bb34e7af887", "score": "0.5647917", "text": "def leaves(node, depth=0)\n if node.left.nil? && node.right.nil?\n puts \"#{node.value}, depth: #{depth}\"\n return 1\n else\n leaves(node.left, depth+1) + leaves(node.right, depth+1)\n end\nend", "title": "" }, { "docid": "d75e8f7d5ca8017969470ff718a64ac5", "score": "0.5646456", "text": "def f(n)\n if @algorithm == :depth_first_forward_search\n # Because a min priority queue is used, returning -g(n) will give deeper\n # nodes higher priority. DFS doesn't use heuristic functions.\n -g(n)\n elsif @algorithm == :breadth_first_forward_search\n # For the same reason, returning g(n) will give shallower nodes higher\n # priority. BFS doesn't use heuristic functions either.\n g(n)\n else\n g(n) + h(n)\n end\n end", "title": "" }, { "docid": "94f88fda008db6da1c0c7d89b3bbf88a", "score": "0.5643577", "text": "def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end", "title": "" }, { "docid": "88427abc256f81a09a5140571e5afcbb", "score": "0.5642752", "text": "def post_order_traverse(tree, array)\n if !tree.nil?\n post_order_traverse(tree.left, array)\n post_order_traverse(tree.right, array)\n array.append(tree.value)\n end\n \n return array\n\nend", "title": "" }, { "docid": "86a1408bf3591164ef157658e678248a", "score": "0.5634091", "text": "def build_tree(s)\n bytes = s.bytes\n uniq_b = bytes.uniq\n nodes = uniq_b.map { |byte| Leaf.new(byte, bytes.count(byte)) }\n until nodes.length == 1\n node1 = nodes.delete(nodes.min_by(&:count))\n node2 = nodes.delete(nodes.min_by(&:count))\n nodes << Node.new(node1, node2, node1.count + node2.count)\n end\n nodes.fetch(0)\nend", "title": "" }, { "docid": "199db2065f4b81f8ba0d330cd369c760", "score": "0.5631345", "text": "def serialize_binary_search_tree_helper( node, nodes_array)\n \n if node.nil?\n return nil\n end\n \n s_node = Serilized_Node.new(node.value)\n \n nodes_array.push(s_node)\n node_index = nodes_array.size - 1 #the index of the sub tree root\n s_node.left_child_index = serialize_binary_search_tree_helper(node.left, nodes_array)\n s_node.right_child_index = serialize_binary_search_tree_helper(node.right, nodes_array)\n\n \n return node_index\nend", "title": "" }, { "docid": "176e3f283242f63cca356751f512bbfc", "score": "0.56259495", "text": "def num_tree_levels\n level = 0\n num_nodes= all_node_values_with_nil.length # considers tree as 'complete\n num_nodes_in_full_tree = 2**level\n until num_nodes_in_full_tree >= num_nodes\n level += 1\n num_nodes_in_full_tree += 2**level\n end\n num_tree_levels = level + 1 # (started count at 0)\n num_tree_levels = 0 if @root.nil?\n return num_tree_levels\n end", "title": "" }, { "docid": "ea3dcfc9061117eca50507075c4e61b4", "score": "0.56250036", "text": "def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end", "title": "" }, { "docid": "db7a8cf5d8696b48f943718039a236d6", "score": "0.56212264", "text": "def half_nodes_count(root)\n if root.nil?\n puts 'Empty tree'\n return\n end\n half_nodes_count = 0\n queue = QueueWithLinkedList.new\n queue.enqueue(root)\n while !queue.isEmpty?\n node = queue.dequeue\n half_nodes_count += 1 if ((node.left && !node.right) || (!node.left && node.right))\n queue.enqueue(node.left) if node.left\n queue.enqueue(node.right) if node.right\n end\n half_nodes_count\n end", "title": "" }, { "docid": "a179217f6d2afb77e86157c4450d6f0b", "score": "0.5601931", "text": "def item_check(tree)\n if tree[0] == nil\n tree[1]\n else\n tree[1] + item_check(tree[0]) - item_check(tree[2])\n end\nend", "title": "" }, { "docid": "9a2ef21df1c9ad88f962ff505abe84c7", "score": "0.5593806", "text": "def node_depths(root, depth = 0)\n if root.nil?\n return 0\n end\n\n return depth + node_depths(root.left, depth + 1) + node_depths(root.right, depth + 1)\nend", "title": "" }, { "docid": "634ff3586fd883a21b09b9375c0a1c7a", "score": "0.5590603", "text": "def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend", "title": "" }, { "docid": "646375f73006f18fcc3e705de49ae55a", "score": "0.55897504", "text": "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "title": "" }, { "docid": "846e385012616a13bcc6797fb2eb76a2", "score": "0.5586317", "text": "def build_tree(array)\n first_node = Node.new(nil, nil, array[0])\n this_node = first_node\n i = 1\n\n finished = false\n while !finished\n if array[i] == nil\n finished = true\n elsif array[i] < this_node.data\n if this_node.left_child == nil\n this_node.left_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.left_child\n end\n elsif array[i] > this_node.data\n if this_node.right_child == nil\n this_node.right_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.right_child\n end \n elsif array[i] == this_node.data\n i += 1\n end\n end\n return first_node\nend", "title": "" }, { "docid": "bc2c110fd401fed2004e697bb4fd91d3", "score": "0.55860305", "text": "def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend", "title": "" }, { "docid": "f8eea9eea3af6182820c5304f498e30c", "score": "0.5585062", "text": "def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end", "title": "" }, { "docid": "3d0bb19330de4c3d080ecee6f8ab571f", "score": "0.55829674", "text": "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "title": "" }, { "docid": "89e864bd80e66f4c9819c99faec41cb0", "score": "0.55782396", "text": "def build_tree(arr)\n\ntree = []\n\ntree.push(Node.new(arr[0]))\n\n arr[1..-1].each do |i|\n new_node = Node.new(i)\n\n condition = false\n current = tree[0]\n until condition == true\n if i > current.value && current.find_right_child.count == 0\n new_node.create_parent(current)\n current.create_right_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i < current.value && current.find_left_child.count == 0\n new_node.create_parent(current)\n current.create_left_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i > current.value && current.find_right_child.count == 1\n current = current.find_right_child[0]\n elsif i < current.value && current.find_left_child.count == 1\n current = current.find_left_child[0]\n end\n end\n end\n tree\nend", "title": "" }, { "docid": "5d80d66a986a56bd294709c1d5c499c8", "score": "0.5576951", "text": "def grow_tree(root, nodes, adopt_fn)\n kids = nodes.select { |w| adopt_fn.call(root, w) }\n branches = kids.map { |k| grow_tree(k, nodes - [root], adopt_fn) }\n { root => branches.reduce(&:merge) }\nend", "title": "" }, { "docid": "db164f851d648f0b4a6b7afbc95323cd", "score": "0.55730516", "text": "def visit_nodes(node)\n return if node.blank?\n if node.respond_to?(:each) # e.g. a list of nodes from a has_many association\n node.each { |n| visit_nodes(n) }\n else\n class_name = node.class.name\n @hash[class_name] ||= Set.new\n @hash[class_name] << visit(node)\n get_associations(node).each do |assoc|\n @logger.debug(\"Visiting #{assoc.name}\")\n new_nodes = node.send(assoc.name)\n next if new_nodes.blank?\n\n if new_nodes.respond_to?(:find_each)\n new_nodes.find_each { |n| visit_nodes(n) }\n else\n visit_nodes(new_nodes)\n end\n end\n\n end\n end", "title": "" }, { "docid": "dea3e27a17a44dbac20a10749960aaaf", "score": "0.55614513", "text": "def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend", "title": "" }, { "docid": "cd2c29b164107f9a1438f106ad26e66c", "score": "0.55603963", "text": "def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end", "title": "" }, { "docid": "b218b67d0990866c07d71d2ba09de892", "score": "0.5552576", "text": "def inorder(root)\n return if root.nil?\n inorder(root.left)\n @hash[root.val] ||= 0\n @hash[root.val] += 1\n inorder(root.right)\nend", "title": "" }, { "docid": "a902042469f9173b6e3c8677e43fbb48", "score": "0.55498475", "text": "def number_of_nodes(node_name)\n nodes(node_name).count\nend", "title": "" }, { "docid": "7ab6d5b96003d577d30228a56c0b442e", "score": "0.55486685", "text": "def build_tree(array)\n array.sort!.uniq!\n left = 0\n right = array.length\n\n return build_driver(array, left, right)\n end", "title": "" }, { "docid": "efda0880f51f6219554ee76e4a36a4ac", "score": "0.55475706", "text": "def buildTree(node,arr)\n node.value = arr.shift\n size = (arr.size/2.0).round\n if size > 0\n left, right = arr.each_slice( size ).to_a\n if left and left.count > 0\n node.left = TreeNode.new\n buildTree(node.left, left)\n end\n if right and right.count > 0\n node.right = TreeNode.new\n buildTree(node.right, right)\n end\n end\nend", "title": "" }, { "docid": "0339d9b8bc5af6f58439d8bac323b085", "score": "0.5547506", "text": "def build_tree(array, left=0, right=array.length-1)\n \n# base case\n return if left > right\n\n# from smallest to largest\n array = merge_sort(array)\n\n# middle index, make this the first node\n index_mid = left + (right-left) / 2 \n node = Node.new(array[index_mid]) \n \n# i think it's making the left node (smaller), & right (larger)\n# looks like it is recursion\n node.left_child = build_tree(array, left, index_mid-1) \n node.right_child = build_tree(array, index_mid+1, right) \n\n @tree = node\n @tree\n end", "title": "" }, { "docid": "de76bcc464d7faf4d87154622495557a", "score": "0.5545074", "text": "def recursive => nil", "title": "" }, { "docid": "ca74b4376965a7d211bcc75c029e220b", "score": "0.55399764", "text": "def build_tree(input_array)\n sorted_set = input_array.sort.uniq\n build_tree_aux(sorted_set, 0, sorted_set.length - 1)\n end", "title": "" }, { "docid": "e21758ebce8738bdca0a14bfa8e7af85", "score": "0.55330515", "text": "def count_all\n # map all nodes into enumerable\n # then add them all together (reduce :+)\n self.map { |node| node.count }.reduce(:+)\n end", "title": "" }, { "docid": "9dc1efed97e92af874f003ec48c6202a", "score": "0.5532762", "text": "def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend", "title": "" }, { "docid": "5ecc0e087b8620efe8ae421e21961af4", "score": "0.55320203", "text": "def in_order_traversal(tree_node, arr = [])\n return arr if tree_node == nil\n\n arr = in_order_traversal(tree_node.right, arr)\n arr << tree_node\n arr = in_order_traversal(tree_node.left, arr)\n\n arr\nend", "title": "" }, { "docid": "35c62bf83a8df45c3e2010b9f0132fc2", "score": "0.5530225", "text": "def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend", "title": "" }, { "docid": "286f6c5c3a1c49b70e2600982d1f7870", "score": "0.55241084", "text": "def recursive_terms(n)\n all_ns << n\n # if we get 1111\n # we have 1111 and should then get 211 and then 31 and then 4\n # then continue from 1111 to 121 then 13\n # then continue from 1111 to 112\n # to find these terms, find the \n next_ns = convert_n_to_next_terms(n)\n next_ns.each do |next_n|\n all_ns << recursive_terms(next_n)\n end\n return all_ns.flatten.uniq\nend", "title": "" }, { "docid": "6d256af01030948637d8cfcf6ee232d7", "score": "0.5521987", "text": "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend", "title": "" } ]
18f3523b835c8d4a5f2fd91e84d53eff
GET /rooms/1 or /rooms/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "feaa838e2a85e776367fbf59114d5c2a", "score": "0.7220368", "text": "def index\n rooms = Room.includes(:problems, :registrations, :users, :owner)\n if params[:name]\n render json: rooms.where(name: params[:name])\n else\n render json: rooms\n end\n end", "title": "" }, { "docid": "58ec004cf3d79f6b5c6ac6646150b93f", "score": "0.7199394", "text": "def show\n @room = Room.find(params[:id])\n\n render '/api/rooms/show'\n end", "title": "" }, { "docid": "9e4dacf91b49fd06774ba6411d4ae35f", "score": "0.7190084", "text": "def index\n\t\t@rooms = Room.order(updated_at: :desc)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @rooms }\n\t\tend\n\tend", "title": "" }, { "docid": "12013473bab47e6e00c915e6bd24b325", "score": "0.71842873", "text": "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "title": "" }, { "docid": "8599e3fb26ccd3ea88562f312d03703a", "score": "0.7123076", "text": "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end", "title": "" }, { "docid": "e3fbb329cdbc2f6f3383aed6ac609fdb", "score": "0.7032912", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "e3fbb329cdbc2f6f3383aed6ac609fdb", "score": "0.70320034", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "e3fbb329cdbc2f6f3383aed6ac609fdb", "score": "0.70320034", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "e3fbb329cdbc2f6f3383aed6ac609fdb", "score": "0.70320034", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "720f0ade7ef0d17af71f33a0afe764e0", "score": "0.6994984", "text": "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "title": "" }, { "docid": "b741ebd31d35564284790f43094fc088", "score": "0.69818014", "text": "def get_rooms(company, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms', params\n end", "title": "" }, { "docid": "9996ecbe360db387517ee315b2e72dbc", "score": "0.69619334", "text": "def index\n if authorise(request)\n auth_token = request.headers['Authorization1'].split(' ').last\n req = GetRoomsRequest.new(auth_token)\n serv = RoomServices.new\n resp = serv.get_rooms(req)\n render json: { status: resp.success, message: resp.message, data: resp.data }, status: :ok\n else\n render json: { status: false, message: 'Unauthorized' }, status: 401\n end\n end", "title": "" }, { "docid": "dbd32513df725568c1999267968f08ec", "score": "0.68633753", "text": "def get_all_rooms(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"room\"), :query_params => params)\n return unless res.successful?\n Rooms.new(res.data)\n end", "title": "" }, { "docid": "0089cb00745f864cfe1dce10306848e5", "score": "0.68096244", "text": "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "title": "" }, { "docid": "3a23eef8bd230ad5967d30b11785cc5b", "score": "0.6801864", "text": "def show\n @restroom = Restroom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end", "title": "" }, { "docid": "ab016dc2772fd65e0352105f7b96659c", "score": "0.67811555", "text": "def show\n if params[:id]\n current_user # initialize @current_user\n\n @room = {\n \t:name => params[:id],\n \t:url => RTCHelper::getRoomURL(params[:id]),\n \t:token => RTCHelper::getAuthToken(params[:id], @current_user)\n }\n else\n #\n # if there is no room, we really wanted to go to /rooms/index\n #\n redirect_to :action => 'index'\n end\n end", "title": "" }, { "docid": "53c344b12c2345f92f1546fc3dc5448c", "score": "0.6740472", "text": "def get_rooms \n json_rooms = IO.popen(\"curl -u #{@config['campfire_config']['API_KEY']}:X #{@config['campfire_config']['URL']}/presence.json\") \n parsed_rooms = JSON.parse(json_rooms.readlines.first)[\"rooms\"]\n rooms = parsed_rooms.collect {|room| [room[\"name\"],room[\"id\"]]} \nend", "title": "" }, { "docid": "b5ef5ebac5117ac9ec9da919f43e04c6", "score": "0.66774726", "text": "def get_room(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}\"), :query_params => params)\n return unless res.successful?\n Room::Detail.new(res.data)\n end", "title": "" }, { "docid": "13fb936bed96365b10f74efbabb9f9a3", "score": "0.6652898", "text": "def index\n case current_type\n when 'owner'\n @rooms = owner_rooms\n when 'access'\n @rooms = access_rooms\n else\n @rooms = public_rooms\n end\n end", "title": "" }, { "docid": "3ffacb0bfecaaac58b6c505d0c7fb458", "score": "0.66428816", "text": "def fetch(room_id)\n url = NSURL.URLWithString \"#{settings.host}/rooms/#{room_id}.json\"\n puts \"Requesting #{settings.host}/#{room_id}.json\"\n request = ASIHTTPRequest.requestWithURL(url)\n request.setDelegate self\n request.addRequestHeader \"X-Talker-Token\", value:settings.token\n request.startAsynchronous\n end", "title": "" }, { "docid": "7f5cba80e6108d48ccde1e70632bb31e", "score": "0.6633048", "text": "def show\n @room = current_user.rooms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room.to_hash_with_users(current_user).to_json }\n end\n end", "title": "" }, { "docid": "47219624b8aaf81a789c4b97a29a4660", "score": "0.6577345", "text": "def get_rooms\n # DO NOT DELETE. Condition used for load testing\n @user_id = (params.has_key? :user_id) ? params[:user_id] : session[:user_id]\n @room_ids = Member.where(user_id: @user_id).pluck(:room_id)\n\n @rooms = Room.find(@room_ids)\n #render json: @rooms\n \n @roomList = []\n #@rooms.each { |room|\n for room in @rooms do\n #@room = Room.find_by(id: room_id)\n temp = {}\n temp.store(\"room_id\",room.id)\n temp.store(\"room_name\", room.name) \n temp.store(\"room_token\", room.token)\n @roomList.push(temp)\n end\n render json: {rooms: @roomList}, status: 200\n end", "title": "" }, { "docid": "af74e01fd87aaa5752d92ac950aa742b", "score": "0.6573105", "text": "def find \n @user = User.find(params[:user_id])\n @room = @user.rooms.where(:name => params[:name])\n render json: @room if stale?(etag: @room.all, last_modified: @room.maximum(:updated_at))\n end", "title": "" }, { "docid": "21ff7bf50fa60c36fd5a3eab8a499efd", "score": "0.6566599", "text": "def index\n @rooms = Room.all\n \n respond_to do |f|\n f.html\n end\n end", "title": "" }, { "docid": "a1611162901d03986cd2553e5c9d01ae", "score": "0.65555745", "text": "def show\n @request = Request.find(params[:id])\n\n if current_user.admin?\n @available_rooms = get_available_rooms @request\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "bd4c8f1549194b0119e8bdd4b5623738", "score": "0.65479994", "text": "def show\n @user=User.find(params[:user_id])\n @[email protected](params[:id])\n render json: @room if stale?(@room)\n end", "title": "" }, { "docid": "4cd7cb2342946e9a450d6bb9c40d0a7e", "score": "0.65412736", "text": "def index\n @user = User.find(params[:user_id])\n @rooms = @user.rooms.all\n render json: @rooms if stale?(etag: @rooms.all, last_modified: @rooms.maximum(:updated_at))\n end", "title": "" }, { "docid": "e17eda24e36aa0b959257be4c93353b7", "score": "0.65299153", "text": "def show\n @rooms = { \n items: Room.all, \n }\n if room = Room.find_by(id: params[:id])\n response_data = {\n room: room,\n messages: module_get_messages(room)\n }\n status= :ok\n else \n status= :unprocessable_entity\n end\n\n #puts \"#######################\"\n #puts @room.as_json(:include => @messages)\n #puts Room.includes(:messages.limit(2)).find(params[:id] || 1).as_json(:include => :messages)\n\n respond_to do |format|\n format.html\n format.json { render json: response_data, status: status }\n end\n end", "title": "" }, { "docid": "7c21c365f8af3e8d2fac9cdd349c7da3", "score": "0.64646673", "text": "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rooms }\n end\n end", "title": "" }, { "docid": "c54c1af63dd02c4e2293fcf91d8e4876", "score": "0.64377695", "text": "def get_room(id)\n @rooms[id]\n end", "title": "" }, { "docid": "3b7481df5a910ef3a4c4e1173c7b8874", "score": "0.64185673", "text": "def show\n @rooms = Room.all\n end", "title": "" }, { "docid": "18bee71ad444e6596f5de8c18cdddd39", "score": "0.641362", "text": "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "title": "" }, { "docid": "89d489059e1da609c9427d6d770ad8fb", "score": "0.64133716", "text": "def get_rooms(page)\n page.links.collect { |link| { :name => link.to_s, :uri => link.uri } if link.uri.to_s[\"#{uri.to_s}/room\"] }.reject { |room| room.nil? }\n end", "title": "" }, { "docid": "26c919d71f46e5c2e953d92b0b05a599", "score": "0.64043164", "text": "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "4c63679374b9c6c86e671a2d6918a2fc", "score": "0.63639146", "text": "def index\n @rooms = Room.all\n end", "title": "" }, { "docid": "ae8046c5f11d4f0e637d551b161924fc", "score": "0.6353536", "text": "def show\n @room = Room.find(params[:id])\n end", "title": "" }, { "docid": "ae8046c5f11d4f0e637d551b161924fc", "score": "0.6353536", "text": "def show\n @room = Room.find(params[:id])\n end", "title": "" }, { "docid": "1149bf7e60113549dd98245a1d5df213", "score": "0.63414234", "text": "def refresh\n @room = Room.find(params[:room_id])\n respond_to do |format|\n format.json { render :json => @room }\n format.html\n end\n end", "title": "" }, { "docid": "b179b13d9fdb927ca22ab81b67e955b6", "score": "0.63279504", "text": "def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "title": "" }, { "docid": "5f259bd9ce885b0af97386f7de17b9d0", "score": "0.6321462", "text": "def show\n respond_to do |format|\n if @room\n format.html { render :show }\n format.json { render :show, status: :ok, location: @room }\n else\n format.html { render :error, status: @error[:status] }\n format.json { render json: {error: @error[:message]}, status: @error[:status] }\n end\n end\n end", "title": "" }, { "docid": "4733df3b8cd201afb867e1ab48e861ee", "score": "0.6319408", "text": "def get_room \\\n name,\n options: nil,\n &block\n request = {\n name: name\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::GetRoomRequest\n @get_room.call(request, options, &block)\n end", "title": "" }, { "docid": "71a9958e59cbe3826eba432717e5840a", "score": "0.6317141", "text": "def index\n @restrooms = Restroom.all\n end", "title": "" }, { "docid": "85380810b50122540e6014c271fae615", "score": "0.6310401", "text": "def get_room_details(company, room_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms/' + room_id, params\n end", "title": "" }, { "docid": "b1a98aae0cb5bc6859329c94ac42c092", "score": "0.6302512", "text": "def index\n @hostel_rooms = HostelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hostel_rooms }\n end\n end", "title": "" }, { "docid": "08ae3609a243450e33905cd6d91a5d77", "score": "0.63021713", "text": "def show\n @hotel_room = HotelRoom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel_room }\n end\n end", "title": "" }, { "docid": "5ab50f1ff167adde4ff32d389d9812fe", "score": "0.6273148", "text": "def show\n @room = Room.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @room }\n format.js {}\n end\n end", "title": "" }, { "docid": "9d3830fe167e42401173906e469e256a", "score": "0.6271941", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "15c12e4f97b66b0e4a7ce6c669f339ca", "score": "0.6270211", "text": "def index\n @rooms = current_user.rooms.all\n end", "title": "" }, { "docid": "e316b60a2faf001689310f8126609989", "score": "0.6268854", "text": "def show\n @room = Room.includes(:owner).find(params.require(:id))\n if @room\n success(body: @room, options: { include: [:owner] })\n else\n not_found\n end\n end", "title": "" }, { "docid": "3b6bf0d53a0f8492cf3eb89a7e8bdf13", "score": "0.62608373", "text": "def index\n ota_rooms = Array.new\n if params[:room].nil? && params[:ota].nil?\n # 自分の施設情報だけを返す\n\n current_user.ota.select do |otum|\n otum.provider == 'default'\n end.each do |otum|\n ota_rooms.concat(otum.ota_rooms)\n end\n elsif params[:ota].nil?\n room = Room.find_by(id: params[:room].to_i)\n # 部屋IDが存在しない場合\n if room.nil?\n response = {\n status: 'NotFound',\n message: 'room not found'\n }\n return render json: response, status: 404\n end\n # 権限がない場合\n if current_user.id != room.user.id\n response = {\n status: 'NotFound',\n message: 'room not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(room.ota_rooms)\n elsif params[:room].nil?\n otum = Otum.find_by(id: params[:ota].to_i)\n # OTA IDが存在しない場合\n if otum.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # 権限がない場合\n if current_user.id != otum.user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(otum.ota_rooms)\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota_rooms not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota_rooms not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(facility.ota_rooms)\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota_rooms: ota_rooms.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end", "title": "" }, { "docid": "0d45de35f0a10991c14304d553fdfc91", "score": "0.62604606", "text": "def show\n @tddbc_room = Tddbc::Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tddbc_room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "13315ed42e3dfc238de766618f73436e", "score": "0.6233533", "text": "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "e48dca26deffad4f595aa020874732fb", "score": "0.6232333", "text": "def show\n @roombot = Roombot.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roombot }\n end\n end", "title": "" }, { "docid": "254e3b12469eae7c587e3086ace8cfe6", "score": "0.6225021", "text": "def index\n @hotel_rooms = HotelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hotel_rooms }\n end\n end", "title": "" }, { "docid": "5159b01ad08c67c181309cc6d6185848", "score": "0.62008095", "text": "def show\n @hostel_room = HostelRoom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostel_room }\n end\n end", "title": "" }, { "docid": "8dfc3d828634aa6f4726a480caf11134", "score": "0.61978614", "text": "def get_room_mate\n \tif !params[:room_mate_id].blank?\n \t\t@user = User.find_by_id params[:room_mate_id]\n \t\tif [email protected]?\n \t\t\trender :json => {:success => true, :message => \"Room mate found\", :user => @user}, :status => 200\n \t\telse\n \t\t\trender :json => {:success => false, :message => \"Room mate not found\"}, :status => :not_acceptable\n \t\tend\n\t\tend \t\n end", "title": "" }, { "docid": "832f04fc1122a7772cdb24799a8c954b", "score": "0.61724526", "text": "def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6e59de78c0411c8c94d65981790442b7", "score": "0.61481804", "text": "def index\n @rooms = Room.where(\"status != 'CANCELLED'\").order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end", "title": "" }, { "docid": "44a5bc09e2e6e170133e5390e4e91d7a", "score": "0.6142394", "text": "def index\n @rooms = Room.all.map do |rm|\n Room.cleanFetch(rm, current_user)\n end\n end", "title": "" }, { "docid": "25408e44d62cdda3c017e0dc045160db", "score": "0.6139453", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @room }\n end\n end", "title": "" }, { "docid": "25408e44d62cdda3c017e0dc045160db", "score": "0.6139453", "text": "def show\n @room = Room.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @room }\n end\n end", "title": "" }, { "docid": "43a2a6ea1c51f3048098724c495d0007", "score": "0.6137071", "text": "def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "title": "" }, { "docid": "1163d81d10067747b1d182dec8d901ec", "score": "0.61298007", "text": "def find_room uri\n payload = { \"uri\" => uri }.to_json\n data = self.post \"#{api_prefix}/rooms\", payload\n\n Room.new(self, data)\n end", "title": "" }, { "docid": "956b9dde861e527f021c04ef6c05eafe", "score": "0.61207193", "text": "def get_room_messages(company, room_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params\n end", "title": "" }, { "docid": "3d910624615e8861d59cae01468dec46", "score": "0.6107708", "text": "def show\n @rooms = @blueprint.rooms\n end", "title": "" }, { "docid": "fc5a9c97f361944cccd2cfa387830f34", "score": "0.6101991", "text": "def show\n @roomrate = Roomrate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roomrate }\n end\n end", "title": "" }, { "docid": "e93d50d4692fef70db5fbd11f6621ca4", "score": "0.6100615", "text": "def list_all_rooms\n return @rooms\n end", "title": "" }, { "docid": "0aa3fbd80622680780fcffc6ee81b875", "score": "0.6093998", "text": "def show\n buildingId = params[:id]\n @room = Room.where(building_id: buildingId)\n end", "title": "" }, { "docid": "2240a0b6f17cc14d50a595d010b5c977", "score": "0.609013", "text": "def index\n @rooms = Room.find(:all, :conditions => [\"site_id = ?\", params[:site_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rooms }\n end\n end", "title": "" }, { "docid": "b53a5b3eb4bc682ea66f08d3c4910ddd", "score": "0.608191", "text": "def index\n @request_rooms = RequestRoom.all\n end", "title": "" }, { "docid": "64df0dd4c67676b44bbd534f3dd38f34", "score": "0.6078957", "text": "def rooms\n Hpricot(get.body).search(\"//h2/a\").collect do |a|\n Room.new(self, room_id_from_url(a.attributes['href']), a.inner_html)\n end\n end", "title": "" }, { "docid": "8c3b7e5b06309ba8f1119a4a51e965ec", "score": "0.60744447", "text": "def index\n @rooms = Room.paginate(:page => params[:page])\n end", "title": "" }, { "docid": "e06000dac4f102b7b11fa21c0684dd7d", "score": "0.6061311", "text": "def fetch_rooms_values(lcode, dfrom, dto, rooms = nil, token = @token)\n if rooms != nil then\n response = server.call(\"fetch_rooms_values\", token, lcode, dfrom.strftime('%d/%m/%Y'), dto.strftime('%d/%m/%Y'), rooms)\n else\n response = server.call(\"fetch_rooms_values\", token, lcode, dfrom.strftime('%d/%m/%Y'), dto.strftime('%d/%m/%Y'))\n end\n\n handle_response(response, \"Unable to fetch room values\")\n end", "title": "" }, { "docid": "adaa47ff0e04181dd3a39672acb01ca3", "score": "0.60581964", "text": "def show\n @hostel = Hostel.find(params[:id])\n @rooms = @hostel.rooms\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hostel }\n end\n end", "title": "" }, { "docid": "ba3a32fe3a1b29cdbf9257b21cc3eb32", "score": "0.60423565", "text": "def show\n room = PublicRoom.find_by_escape_room_id(params[:id])\n if room.nil?\n render json: { success: false, message: 'Room needs to be public' }, status: :bad_request\n return\n end\n room_serv = RoomServices.new\n req_vertex = GetVerticesRequest.new(params[:id])\n res_vertex = room_serv.get_vertices(req_vertex)\n req_room_images = GetRoomImagesRequest.new(params[:id])\n res_room_images = room_serv.room_images(req_room_images)\n render json: { success_vertex: res_room_images.success, message_vertex: res_vertex.message,\n data_vertex: res_vertex.data, success_room_images: res_room_images.success,\n message_room_images: res_room_images.message,\n data_room_images: res_room_images.data }, status: :ok\n rescue StandardError\n render json: { success: false, message: 'Error internally' }, status: 500\n end", "title": "" }, { "docid": "2278937412d705c1bd2a7b796014724a", "score": "0.60331446", "text": "def new\n @restroom = Restroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restroom }\n end\n end", "title": "" }, { "docid": "2278937412d705c1bd2a7b796014724a", "score": "0.60331446", "text": "def new\n @restroom = Restroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restroom }\n end\n end", "title": "" }, { "docid": "f54d4224328d22bc13a1b3341de7941a", "score": "0.6026561", "text": "def show\n @serverroom = Serverroom.find(params[:id])\n @serverrack = Serverrack.new\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serverroom }\n end\n end", "title": "" }, { "docid": "55b663da2b0f39a63c7eec01966f01b8", "score": "0.6021755", "text": "def index\n @rooms = Room.all\n @rooms = @rooms.search(params[:search]) if params[:search].present?\n end", "title": "" }, { "docid": "8f38b3e0848718e9ca4c6bdb254e56eb", "score": "0.6008344", "text": "def new\n @room = Room.new\n\n render :json => @room \n end", "title": "" }, { "docid": "269fe06aba8d1444b9b96342e4a6904b", "score": "0.6003427", "text": "def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end", "title": "" }, { "docid": "1ff217342532cb42b28615ac5cb8d4c5", "score": "0.59876287", "text": "def get_room_by_application(company, application_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.get '/messages/v3/' + company + '/rooms/applications/' + application_id, params\n end", "title": "" }, { "docid": "a3b79c6f506a37e8adbb3bb6beb01e5f", "score": "0.597644", "text": "def show\n @class_room = ClassRoom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_room }\n end\n end", "title": "" }, { "docid": "8af702d8ce81b75b13b733754fffe6ed", "score": "0.597439", "text": "def show\n @room = Room.find(params[:id])\n\n config_opentok\n\n @tok_token = @opentok.generate_token :session_id =>\n @room.sessionId\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end", "title": "" }, { "docid": "6b505a4f05c7965cf7500a8151f18def", "score": "0.59444135", "text": "def show\n @screeningroom = Screeningroom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screeningroom }\n end\n end", "title": "" }, { "docid": "c7fd1e77ff20a51a06b7df34bdbbf1ec", "score": "0.59343565", "text": "def list_zoom_rooms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RoomsApi.list_zoom_rooms ...'\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !['Offline', 'Available', 'InMeeting', 'UnderConstruction'].include?(opts[:'status'])\n fail ArgumentError, 'invalid value for \"status\", must be one of Offline, Available, InMeeting, UnderConstruction'\n end\n if @api_client.config.client_side_validation && opts[:'type'] && !['ZoomRoom', 'SchedulingDisplayOnly', 'DigitalSignageOnly'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of ZoomRoom, SchedulingDisplayOnly, DigitalSignageOnly'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling RoomsApi.list_zoom_rooms, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/rooms'\n\n # query parameters\n query_params = {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'unassigned_rooms'] = opts[:'unassigned_rooms'] if !opts[:'unassigned_rooms'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n query_params[:'location_id'] = opts[:'location_id'] if !opts[:'location_id'].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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\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 => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoomsApi#list_zoom_rooms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
78fff4da966577d51993e411eccda396
Validates an mbox style mailbox and returns the number of messages it contains.
[ { "docid": "83d9f9aaef8a46726d53521101e4dd3f", "score": "0.70565665", "text": "def validate_mbox(filename, sentinel)\n mailcount = 0\n line_count = 1\n message_line_count = 0\n body_line_count = -1\n prevline = nil\n sentinel_match = true\n IO.foreach(filename) { |line|\n assert(line[-1] == ?\\n,\n \"Line #{line_count} #{line.inspect} does not end in a newline\")\n\n if (line_count == 1)\n assert_match(line, FROM_RE, 'invalid From_')\n end\n\n if ((line_count == 1 || prevline == \"\\n\") && line =~ /^From /)\n mailcount += 1\n message_line_count = 0\n assert(prevline.nil? || body_line_count >= 0, \"No body found\")\n body_line_count = -1\n unless sentinel.nil?\n assert(sentinel_match, \"RFilter did not contain sentinel \" +\n sentinel.inspect)\n sentinel_match = false\n end\n end\n\n if body_line_count < 0 && line =~ /^$/\n body_line_count = 0\n end\n\n unless sentinel.nil?\n if line =~ sentinel\n sentinel_match = true\n end\n end\n\n if (message_line_count == 1)\n assert_match(line, /^\\S+:/,\n \"Message at line #{line_count} does not begin \" +\n \"with headers\")\n end\n\n prevline = line\n line_count += 1\n message_line_count += 1\n body_line_count += 1 if body_line_count >= 0\n }\n assert(sentinel_match, \"RFilter did not contain sentinel \" +\n sentinel.inspect) unless sentinel.nil?\n return mailcount\n end", "title": "" } ]
[ { "docid": "4bff86f4325b363441edd6dadf492d8a", "score": "0.7197211", "text": "def mailbox_count\n return @mailbox_count\n end", "title": "" }, { "docid": "dcc7530e763a61c7d3b142e933304b60", "score": "0.691039", "text": "def count_in_mailbox_less_than_three?\n mailbox = Mailbox.find(sender_mailbox_id)\n if mailbox.mails.count > 2\n errors[:base] << 'Mailbox cannot have more than 2 mails'\n end\n end", "title": "" }, { "docid": "9493c2ab6c56056d0b9231cee30b157a", "score": "0.6834232", "text": "def count_messages(mailbox_id, type)\n end", "title": "" }, { "docid": "0f258e5c2ec8385ea7da51cc57db21f4", "score": "0.6615109", "text": "def get_total_number_of_messages_across_mbx\n ary = getHpks\n total_messages = 0\n ary.each do |key|\n mbxkey = 'mbx_' + key\n num_of_messages = rds.hlen(mbxkey) # HACK: uses impl specifics\n total_messages += num_of_messages.to_i\n end\n total_messages\n end", "title": "" }, { "docid": "6d114fd8ee1043c9424b59b3f3279cad", "score": "0.65291", "text": "def countMessages\n total = 0\n ary = getHpks\n ary.each do |hpk|\n mbx = Mailbox.new hpk\n count = mbx.count\n total += count\n end\n total_redis = rds.get(@config[:total_number_of_messages])\n _print_debug 'total mbx count = ', total if @debug\n _print_debug 'total redis key = ', total_redis if @debug\n # turn on manually when changing mailbox code\n # assert_equal(total.to_s,total_redis)\n end", "title": "" }, { "docid": "4aaa114168c649acc6d11b8b69a3a5e7", "score": "0.6475262", "text": "def validate_mbox(mailbox)\n lines = IO.readlines(mailbox)\n assert_match(FROM_RE, lines[0])\n lines.shift\n assert_equal(\"From: [email protected]\\n\", lines[0])\n assert_equal(\"To: [email protected]\\n\", lines[1])\n assert_equal(\"Subject: this is a test message\\n\", lines[2])\n assert_equal(\"\\n\", lines[3])\n assert_equal(\">From test\\n\", lines[4])\n assert_equal(\"\\n\", lines[5])\n assert_equal(nil, lines[6])\n end", "title": "" }, { "docid": "91515dbbfef9bf29da0e14977369b8e7", "score": "0.62463194", "text": "def sms_recipient_count\n return 0 unless sms_possible?\n @sms_recipient_count ||= recipients.count(&:can_get_sms?)\n end", "title": "" }, { "docid": "7ebd3c259771ae36d4b36db79a677ec0", "score": "0.6227252", "text": "def count\n inbox.size + outbox.size\n end", "title": "" }, { "docid": "d25b94ea10cf2caaef9d0847d3b57ca6", "score": "0.6225635", "text": "def count_conversations(mailbox, folder = :in)\n MailDataSystem::MailBox.count_conversations(mailbox, folder)\n end", "title": "" }, { "docid": "08e51dcef175aa73fa136cb0e6b35eac", "score": "0.62224936", "text": "def count_messages\n Mailboxer::Message.conversation(self).count\n end", "title": "" }, { "docid": "5ede16b737a9c3042e796be3d0b50c6b", "score": "0.61993337", "text": "def check_count_of_total_recipients_less_than_3?\n mailboxes.size <= 3\n end", "title": "" }, { "docid": "889136af2efed6551c0bbcb3a10787be", "score": "0.61810607", "text": "def get_all_unread\n number = 0\n self.mailbox.inbox.each do |conversation|\n conversation.messages.each do |message|\n if message.is_unread?(self)\n number +=1\n end\n end\n end\n number\n end", "title": "" }, { "docid": "3ae7dddb8a035de4e80503f96f9a692c", "score": "0.61404115", "text": "def mailbox_count=(value)\n @mailbox_count = value\n end", "title": "" }, { "docid": "29370384ea2766f482d6917859a8e9b2", "score": "0.60883015", "text": "def mbox2stats(f)\n begin\n mails = read_mbox(f)\n rescue => e\n return nil, e\n end\n errs = []\n messages = []\n order = 0\n mails.each do |message|\n mdata = {}\n mail = nil\n begin\n # Preserve message order in case it's important\n order += 1\n # Enforce linefeeds; makes Mail happy; borks binary attachments (not used in this script)\n mail = Mail.read_from_string(message.gsub(/\\r?\\n/, \"\\r\\n\"))\n mdata[:order] = order\n begin # HACK for cases where some values don't parse, try to get good enough values in rescue\n mdata[:from] = mail[:from].value\n mdata[:subject] = mail[:subject].value\n mdata[:listid] = mail[:List_Id].value\n mdata[:date] = mail.date.to_s\n rescue => _e\n mdata[:from] = mail[:from]\n mdata[:subject] = mail[:subject]\n mdata[:listid] = mail[:List_Id]\n mdata[:date] = mail.date.to_s\n mdata[:parseerr] = mail.errors\n end\n mdata[:messageid] = mail.message_id\n mdata[:inreplyto] = mail.in_reply_to\n if mail.multipart?\n text_part = mail.text_part.decoded.split(/\\r?\\n/)\n else\n text_part = mail.body.decoded.split(/\\r?\\n/)\n end\n ctr = 0 # Count text lines of nonblank, nonreply content\n links = 0 # Count number of apparent hyperlinks\n text_part.each do |l|\n case l\n when /\\A\\s*>/\n # Don't count reply lines, even when indented\n when /\\A\\s*\\z/\n # Don't count blank lines\n when /\\AOn.*wrote:\\z/\n # Don't count most common reply header\n when /\\A-----Original Message-----/\n # Stop counting if it seems like a forwarded message\n break\n # TODO: figure out if we're in a .sig block, and stop counting\n else\n links += 1 if l =~ URIRX\n ctr += 1\n end\n end\n mdata[:lines] = ctr\n mdata[:links] = links\n # Annotate various other precomputable data\n MailUtils.find_who_from(mdata)\n begin\n d = Time.parse(mdata[:date])\n mdata[:y] = d.year\n mdata[:m] = d.month\n mdata[:d] = d.day\n mdata[:w] = d.wday\n mdata[:h] = d.hour\n mdata[:z] = d.zone\n rescue => _e\n # no-op - not critical\n puts \"DEBUG: #{e.message} parsing: #{mdata[:date]}\"\n end\n regex = MailUtils::NONDISCUSSION_SUBJECTS[mdata[:listid]] # Use subject regex for this list (if any)\n if regex\n regex.each do |typ, rx|\n if mdata[:subject] =~ rx\n mdata[:nondiscuss] = typ\n break # regex.each\n end\n end\n end\n # Push our hash\n messages << mdata\n rescue => e\n errs << [e, mdata[:order]]\n end\n end\n return messages, errs\n end", "title": "" }, { "docid": "d8026aa33b9849df058059269cb667ab", "score": "0.6081412", "text": "def unread_message_count\n received_messages.unread.count\n end", "title": "" }, { "docid": "9e2f8a8ab720093477216b6128fc0c18", "score": "0.6050045", "text": "def get_total_number_of_messages\n ary = getHpks\n total_messages = 0\n ary.each do |key|\n mbxkey = 'mbx_' + key\n num_of_messages = rds.hlen(mbxkey)\n total_messages += num_of_messages.to_i\n end\n total_messages\n end", "title": "" }, { "docid": "80400d23268f8ba10c43c717635e2bd3", "score": "0.5989697", "text": "def message_count\n @messages.count\n end", "title": "" }, { "docid": "4c267bea75ebebe5cfbae972e16399f1", "score": "0.59808165", "text": "def mbox2stats(f)\n begin\n mails = read_mbox(f)\n rescue => e\n return nil, e\n end\n errs = []\n messages = []\n order = 0\n mails.each do |message|\n mdata = {}\n mail = nil\n begin\n # Preserve message order in case it's important\n order += 1\n # Enforce linefeeds; makes Mail happy; borks binary attachments (not used in this script)\n mail = Mail.read_from_string(message.gsub(/\\r?\\n/, \"\\r\\n\"))\n mdata[:order] = order\n begin # HACK for cases where some values don't parse, try to get good enough values in rescue\n mdata[:from] = mail[:from].value\n mdata[:subject] = mail[:subject].value\n mdata[:listid] = mail[:List_Id].value\n mdata[:date] = mail.date.to_s\n rescue => ee\n mdata[:from] = mail[:from]\n mdata[:subject] = mail[:subject]\n mdata[:listid] = mail[:List_Id]\n mdata[:date] = mail.date.to_s\n mdata[:parseerr] = mail.errors\n end\n mdata[:messageid] = mail.message_id\n mdata[:inreplyto] = mail.in_reply_to\n if mail.multipart?\n text_part = mail.text_part.decoded.split(/\\r?\\n/)\n else\n text_part = mail.body.decoded.split(/\\r?\\n/)\n end\n ctr = 0 # Count text lines of nonblank, nonreply content\n text_part.each do |l|\n case l\n when /\\A\\s*>/\n # Don't count reply lines, even when indented\n when /\\A\\s*\\z/\n # Don't count blank lines\n when /\\AOn.*wrote:\\z/\n # Don't count most common reply header\n when /\\A-----Original Message-----/\n # Stop counting if it seems like a forwarded message\n break\n else\n ctr += 1\n end\n end\n mdata[:lines] = ctr\n # Annotate various other precomputable data\n find_who_from mdata\n begin\n d = DateTime.parse(mdata[:date])\n mdata[:y] = d.year\n mdata[:m] = d.month\n mdata[:d] = d.day\n mdata[:w] = d.wday\n mdata[:h] = d.hour\n mdata[:z] = d.zone\n rescue => noop\n # no-op - not critical\n puts \"DEBUG: #{e.message} parsing: #{mdata[:date]}\"\n end\n regex = NONDISCUSSION_SUBJECTS[mdata[:listid]] # Use subject regex for this list (if any)\n if regex\n regex.each do |typ, rx|\n if mdata[:subject] =~ rx\n mdata[:nondiscuss] = typ\n break # regex.each\n end\n end\n end\n # Push our hash \n messages << mdata\n rescue => e\n errs << [e, mdata[:order]]\n end\n end\n return messages, errs\nend", "title": "" }, { "docid": "5cd986cad093bb7b03a5f73d3a4547da", "score": "0.59618485", "text": "def get_messages(mailbox, from=0, quantity=20, folder = :in)\n MailDataSystem::MailBox.find_messages(mailbox, from, quantity, folder)\n end", "title": "" }, { "docid": "022980ef1079d0b202244eb97a0752b6", "score": "0.5935873", "text": "def count(box)\n @imap.status(box, [\"MESSAGES\"])[\"MESSAGES\"]\n end", "title": "" }, { "docid": "7ed803b044785614a2cfbf70fbce7cd1", "score": "0.5922367", "text": "def process_command_mailboxes\n immediate_count = 0\n\n each_mailbox do |mailbox|\n dispatch_limit = process_command_messages(mailbox)\n break if dispatch_limit\n end\n end", "title": "" }, { "docid": "ce571013212ef379033b0f5a3d1431e4", "score": "0.5884555", "text": "def received_messages\n @number_of_messages = Message.all_unread_messages(current_user.id).length\n end", "title": "" }, { "docid": "526c1c01ae5fe3b76b44decec2467eef", "score": "0.5866845", "text": "def get_unseen_count\n begin\n # fetch raises an exception when the mailbox is empty\n @imap.status(@mailbox || \"INBOX\", [\"UNSEEN\"])[\"UNSEEN\"]\n rescue => e\n error \"failed to get count of unseen messages\"\n 0\n end\n end", "title": "" }, { "docid": "cbc115637dd593de30ad6baacdb8d5f7", "score": "0.5840426", "text": "def find_messages\n mailbox = @boxes.find { |box| @mailbox =~ /#{box}/ } # TODO: needs more work\n raise unless mailbox\n age = @cleanse[mailbox]\n before_date = (Time.now - 86400 * age).imapdate\n\n search [\n 'NOT', 'NEW',\n 'NOT', 'FLAGGED',\n 'BEFORE', before_date\n ], 'read, unflagged messages'\n end", "title": "" }, { "docid": "1f0d884df7fd931d9246ce04d1be2f0c", "score": "0.5755803", "text": "def get_invalid_mails_length\n invalid_mails = self.members.all(:conditions => ['campaign_member_status_type_id = ?', CampaignMemberStatusType.find_by_value('Invalid Email') ]).length\n if invalid_mails > 0\n invalid_mails.to_s\n else\n '0'\n end\n end", "title": "" }, { "docid": "09e5350fe3d406138901bc527806c574", "score": "0.5746185", "text": "def unread_inbox_count\n count_div = self.div(:text=>/Inbox/, :class=>\"lhnavigation_subnav_item_content\").div(:class=>\"lhnavigation_sublevelcount\")\n if count_div.present?\n count_div.text.to_i\n else\n 0\n end\n end", "title": "" }, { "docid": "6604cc97093ff455c7e7fa12f2aee1a3", "score": "0.5735911", "text": "def count_messages\n\t\treturn Message.conversation(self).count\n\tend", "title": "" }, { "docid": "332a17578101b4109608e7b3dffbeee8", "score": "0.5721448", "text": "def find_messages\n @box = @boxes.find { |box| @mailbox =~ /#{box}/ } # TODO: needs more work\n raise unless @box\n @email = @flag[@box]\n raise unless @email\n return [answered_in_curr, wrote_in_curr, responses_in_curr].flatten\n end", "title": "" }, { "docid": "bef7e9b62840d92dcb298e925083ac48", "score": "0.570937", "text": "def read_mailbox(name)\n messages = []\n # tmail crashes on charset madness\n assert_raises(TMail::SyntaxError) {\n parse_mailbox_with_tmail(name) { |m| messages << m }\n }\n \n messages = []\n # rmail parser should not crash\n assert_nothing_raised {\n parse_mailbox_with_rmail(name) { |m| messages << m }\n }\n \n messages\n end", "title": "" }, { "docid": "71371e8ec691a929433bdb4733d663b6", "score": "0.57054186", "text": "def size\n @messages.size\n end", "title": "" }, { "docid": "71371e8ec691a929433bdb4733d663b6", "score": "0.57054186", "text": "def size\n @messages.size\n end", "title": "" }, { "docid": "df0b99a8897e18431db8705383fffde2", "score": "0.5690116", "text": "def get_messages_number\n return self.task_messages.length\n end", "title": "" }, { "docid": "5707b25e046d4123ad09ea3ff0ea8549", "score": "0.56887287", "text": "def size\n @mutex.synchronize { @messages.size }\n end", "title": "" }, { "docid": "9284b530fc6184b51681edd949ef86ff", "score": "0.5667372", "text": "def count\n messages.count\n end", "title": "" }, { "docid": "dea9ba4b95af530da31da56a387e9037", "score": "0.55834866", "text": "def messages_count\r\n count = 0\r\n for m_hash in self.message_tree.values\r\n m_hash.values.each{ |v| count += 1 }\r\n end\r\n return count\r\n end", "title": "" }, { "docid": "539ac311309a3b0a8651f5d90fa5d620", "score": "0.5582958", "text": "def get_msg_count(text_msg)\n\n len = text_msg.length\n if (1..160).include?(len)\n count_of_msg = 1\n elsif (161..306).include?(len)\n count_of_msg = 2\n elsif (307..459).include?(len)\n count_of_msg = 3\n elsif (460..612).include?(len)\n count_of_msg = 4\n elsif (613..765).include?(len)\n count_of_msg = 5\n elsif (766..918).include?(len)\n count_of_msg = 6\n elsif (919..1000).include?(len)\n count_of_msg = 7\n end\n\n # returning count_of_msg\n return count_of_msg\n\n end", "title": "" }, { "docid": "16b8d1b252429989859fb7e244a42038", "score": "0.5579319", "text": "def size\n messages.size\n end", "title": "" }, { "docid": "03e6e4b338ffe787f14c595eb0397d1a", "score": "0.55725515", "text": "def count_messages\n return Message.conversation(self).count\n end", "title": "" }, { "docid": "58683d4e759fa521a5c78782307bbcb1", "score": "0.5515063", "text": "def total_messages_in_folder(folder_name)\n frm.table(:id=>\"msgForum:_id23:0:privateForums\").row(:text=>/#{Regexp.escape(folder_name)}/).span(:class=>\"textPanelFooter\", :index=>0).text =~ /\\d+/\n return $~.to_s\n end", "title": "" }, { "docid": "58683d4e759fa521a5c78782307bbcb1", "score": "0.5515063", "text": "def total_messages_in_folder(folder_name)\n frm.table(:id=>\"msgForum:_id23:0:privateForums\").row(:text=>/#{Regexp.escape(folder_name)}/).span(:class=>\"textPanelFooter\", :index=>0).text =~ /\\d+/\n return $~.to_s\n end", "title": "" }, { "docid": "f5136fc2675163be33d7c813fb69f7e9", "score": "0.54878926", "text": "def unread_message_count\n eval options[:class_name] + '.count(:conditions => [\"recipient_id = ? AND read_at IS NULL and recipient_deleted = ?\", self, false])'\n end", "title": "" }, { "docid": "53d07ca888d52048f5d8d9974afc8a28", "score": "0.5480812", "text": "def inbox_messages\n mailbox_messages('inbox')\n end", "title": "" }, { "docid": "f1ab13f6dd8df14e94139dd0eab21fd8", "score": "0.54621655", "text": "def message_count(file)\n test(?d, file) ? \n Dir.entries(file).delete_if {|x| x =~ /^\\./}.length :\n File.open(file, \"r\").read.scan(/^From /m).length\n end", "title": "" }, { "docid": "918c5e373aeeebb820b093ec79ee5f59", "score": "0.5439934", "text": "def message_number(full_data)\n if /\\w*\\s*\\d/ =~ full_data\n messagenum = full_data.gsub(/\\D/,\"\").to_i\n messages = Store.instance.get\n if messages.length >= messagenum && messagenum > 0\n return messagenum\n else\n return :invalid\n end\n else\n return :all\n end\n end", "title": "" }, { "docid": "cdcb0fbf9b1d9dece9c9a7bcf71f22f8", "score": "0.5439002", "text": "def get_unread_mail domain, username, password, inbox, past_emails\n count = 0\n temp_array = []\n imap = Net::IMAP.new(domain,993,true)\n imap.login(username,password)\n imap.select(inbox)\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n env = imap.fetch(message_id, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n @from[\"#{env.from[0].mailbox}@#{env.from[0].host}\"] += 1\n unless past_emails.include? message_id\n count += 1\n end\n temp_array << message_id\n end\n imap.logout()\n imap.disconnect()\n return count, temp_array\nend", "title": "" }, { "docid": "5557b49eb6fb0918d2c5393c6179156c", "score": "0.5413366", "text": "def message_count\n @message_count\n end", "title": "" }, { "docid": "ce3fb6281be59bc1bc8901a515babb44", "score": "0.5405795", "text": "def unread_message_count\n eval options[:class_name] + '.count(:conditions => [\"recipient_id = ? AND read_at IS NULL\", self])'\n end", "title": "" }, { "docid": "50b1f5469165e8926e6df994fd282c5b", "score": "0.5402823", "text": "def process_messages\n count = nil\n @server.message_handler.clear_last_msg!\n try{ @maxl.get_messages }.each do |msg|\n msg =~ /(\\w+) - (\\d+) - (.+)/\n level, msg_num, msg_text = $1, $2.to_i, $3\n msg_lvl = case level\n when /info/i then MessageHandler::MSG_LVL_INFO\n when /warn/i then MessageHandler::MSG_LVL_WARN\n when /error/i then MessageHandler::MSG_LVL_ERROR\n when /fatal/i then MessageHandler::MSG_LVL_FATAL\n when /debug/i then MessageHandler::MSG_LVL_DEBUG\n end\n @server.message_handler.process_message(msg_num, msg_lvl, msg_text)\n count = (/Records returned: \\[(\\d+)\\]/.match(msg_text)[1].to_i) if msg_num == 1241044\n end\n count\n end", "title": "" }, { "docid": "64c1a167c5ead98ad35bb807b8b74098", "score": "0.5396993", "text": "def message_count\n to_i description['MessageCount']\n end", "title": "" }, { "docid": "16a0a4f1038b330c2dd2fc5a70912de5", "score": "0.5392857", "text": "def total_messages\n folders.values.inject(0) { |sum, folder| sum += folder.size }\n end", "title": "" }, { "docid": "3f92153e3ac1faea9344953a060f37d4", "score": "0.5377678", "text": "def message_unread_count(member_to_check)\n self.events.where(read: false).nin(member_id: [member_to_check.id] ).count\n end", "title": "" }, { "docid": "cf4ba7e9e173d991edc3f381d0c69aa0", "score": "0.53768075", "text": "def unread_messages_count\n @navigator.element_text(UNREAD_MESSAGES_FINDER)\n end", "title": "" }, { "docid": "bdd1533182068c13f389e791428655dc", "score": "0.5355387", "text": "def message_count\n 0\n end", "title": "" }, { "docid": "bdd1533182068c13f389e791428655dc", "score": "0.5355387", "text": "def message_count\n 0\n end", "title": "" }, { "docid": "e769fe62e236107a832d6cf09cce4913", "score": "0.5346231", "text": "def unread_messages\n # We find the user conversations \n @user_conversations = Conversation.participating(self)\n # We create an empty array to stock the unread messages\n @unread_messages = []\n # For each conversation we check all the messages\n @user_conversations.each do |conversation|\n conversation.personal_messages.each do |message|\n # We stock in the array all the unread messages received by the user\n if message.read != true && message.user_id != self.id\n @unread_messages << message\n end\n end\n end\n # We return the number of elements in the array\n return @unread_messages.size\n end", "title": "" }, { "docid": "32476402c3195201b9b271d362944e9d", "score": "0.53249294", "text": "def count_errors\n content_errors.count(:conditions => {:msg_type => 'error'})\n end", "title": "" }, { "docid": "10608ffa050d40258dad4ca118e20124", "score": "0.53234196", "text": "def sent_messages_mailbox\n mailbox = self.mailboxes.where(:name => \"sent_messages_mailbox\").first\n mailbox || create_mailbox(\"sent_messages_mailbox\")\n end", "title": "" }, { "docid": "38b0ce5cd4cd9f530b24a3379c3923b1", "score": "0.52955264", "text": "def size\n @mails.size\n end", "title": "" }, { "docid": "1c86bc2b004aa6b2f9c99c5a2f452b62", "score": "0.52932954", "text": "def messages_count(group_id)\n get(\"/groups/#{group_id}/messages\")['count']\n end", "title": "" }, { "docid": "eaae0332c09fb9d1b896ab7ec6aedc07", "score": "0.52904826", "text": "def queued_messages\n @queue.length\n end", "title": "" }, { "docid": "e5b8f5419fcc3845d9336a40f9902b8d", "score": "0.527332", "text": "def count_unread_emails\n @unread_email = Email.where(:state => 'unread').count\n end", "title": "" }, { "docid": "330591a051ff3de10cadcef28e76344c", "score": "0.5272687", "text": "def subscriber_count\n c = 0\n @client.stats['queues'].keys.each do |k|\n next if k =~ /errors$/\n c += 1 if k =~ /^#{@name}\\+/\n end\n return c\n end", "title": "" }, { "docid": "184186883aea9f04e12de0418189d81d", "score": "0.5271281", "text": "def MessageNbr\n\t\tend", "title": "" }, { "docid": "a0a0396f3066edbc8bd546eb97be1294", "score": "0.52548325", "text": "def size\n full_messages.size\n end", "title": "" }, { "docid": "d6da9ebdbcafc960277cf6aa812408cf", "score": "0.52499545", "text": "def maximum_message_size\n\t\tsize = self.read( 'msgsize' )\n\t\treturn size ? size.split( ':' ).first.to_i : 0\n\tend", "title": "" }, { "docid": "2fbd28c7b17b02724b3211c0b8a94219", "score": "0.5249422", "text": "def unread_message_count(force_reload = false)\n if force_reload || @unread_message_count.nil?\n @unread_message_count = message_receipts.count(\n :id,\n :conditions => {\n :recipient => true,\n :unread => true\n }\n )\n end\n return @unread_message_count\n end", "title": "" }, { "docid": "c35591fe3c0246a82e6fb931cf56c3d7", "score": "0.52493364", "text": "def count(*args)\n emails(*args).size\n end", "title": "" }, { "docid": "c35591fe3c0246a82e6fb931cf56c3d7", "score": "0.52493364", "text": "def count(*args)\n emails(*args).size\n end", "title": "" }, { "docid": "efb1f889da5512f24c1821bd114ddfbf", "score": "0.5248597", "text": "def messages_count\n # @messages_count ||= success_messages.count + failure_messages.count\n @messages_count ||= all_messages.count\n end", "title": "" }, { "docid": "a4b7b291dee209b0091f8015f2283b54", "score": "0.5215014", "text": "def find_mailboxes\n mailboxes = @imap.list(@root, \"*\")\n\n if mailboxes.nil? then\n log \"Found no mailboxes under #{@root.inspect}, you may have an incorrect root\"\n return []\n end\n\n mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }\n mailboxes.map! { |mailbox| mailbox.name }\n\n @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/\n\n mailboxes.reject! { |mailbox| mailbox !~ @box_re }\n mailboxes = mailboxes.sort_by { |m| m.downcase }\n log \"Found #{mailboxes.length} mailboxes to search:\"\n mailboxes.each { |mailbox| log \"\\t#{mailbox}\" } if @verbose\n return mailboxes\n end", "title": "" }, { "docid": "927c260ddea54c8aa46a7d89960cb36e", "score": "0.52042156", "text": "def calcSmsSize(text)\n chars = text.bytesize\n messages = (chars - chars % MESSAGE_SIZE) / MESSAGE_SIZE\n chars = chars - messages * MESSAGE_SIZE\n [MESSAGE_SIZE - chars, messages + 1]\n end", "title": "" }, { "docid": "9f92e8155e71aa1e56a9331583b74378", "score": "0.51920927", "text": "def get_full_recipient_count(message)\n\n recipient_count = 0\n unless message.to_email_address.nil? || message.to_email_address.empty?\n recipient_count += message.to_email_address.length\n end\n\n unless message.cc_email_address.nil? || message.cc_email_address.empty?\n recipient_count += message.cc_email_address.length\n end\n\n unless message.bcc_email_address.nil? || message.bcc_email_address.empty?\n recipient_count += message.bcc_email_address.length\n end\n recipient_count\n\n end", "title": "" }, { "docid": "2a142bf91e8ad38a52ffb3bbda7f1661", "score": "0.51908916", "text": "def unread_message_count\n eval 'messages.count(:conditions => [\"recepient_id = ? AND read_at IS NULL\", self.beamer_id])'\n end", "title": "" }, { "docid": "2a142bf91e8ad38a52ffb3bbda7f1661", "score": "0.51908916", "text": "def unread_message_count\n eval 'messages.count(:conditions => [\"recepient_id = ? AND read_at IS NULL\", self.beamer_id])'\n end", "title": "" }, { "docid": "92b27fe6d129ea46df16093f9cf0f2d1", "score": "0.5190793", "text": "def getUnreadCount\n request \"/Message/getUnreadCount.json\"\n end", "title": "" }, { "docid": "d370ecddf15367033fcd93bbf7ae8b71", "score": "0.5173388", "text": "def unread_count_from_messages(messages)\n\t\tmessages.where(read: false, recipient: @current_user.type?).count\n\tend", "title": "" }, { "docid": "56f50e6ac9f790ce3f5b26c86eb72650", "score": "0.51668996", "text": "def wait_for_email_count(inbox_id, count, opts = {})\n data, _status_code, _headers = wait_for_email_count_with_http_info(inbox_id, count, opts)\n data\n end", "title": "" }, { "docid": "06caa8ce78c93f7fb0ed5117b39783dd", "score": "0.51588184", "text": "def unread_message_count\n count_div = self.div(:text=>/My Messages/, :class=>\"lhnavigation_item_content\").div(:class=>\"lhnavigation_levelcount\")\n if count_div.present?\n count_div.text.to_i\n else\n 0\n end\n end", "title": "" }, { "docid": "27b52b7f84a56c025094d3a6fd5ddefe", "score": "0.5157534", "text": "def unread_message_count(current_user)\n self.messages.where(\"user_id != ? AND read = ?\", current_user.id, false).count\n end", "title": "" }, { "docid": "fd881fd932363b14fc4f71697e4f26d6", "score": "0.5154761", "text": "def sent_messages\n sent_messages_mailbox.messages\n end", "title": "" }, { "docid": "253db49123330f904aa85449a6ce1ff4", "score": "0.51500934", "text": "def new_messages_count\r\n count = 0\r\n for m_hash in self.message_tree.values\r\n m_hash.values.each{ |v| count += 1 if !v }\r\n end\r\n count\r\n end", "title": "" }, { "docid": "572f66a1bb5ff2c4de02d612be59c89b", "score": "0.5149771", "text": "def n_mails; end", "title": "" }, { "docid": "25ef27d1ddb941e0f35a68ecc22b9022", "score": "0.5148402", "text": "def nombre_mails\n all_mails.count\n end", "title": "" }, { "docid": "25ef27d1ddb941e0f35a68ecc22b9022", "score": "0.5148402", "text": "def nombre_mails\n all_mails.count\n end", "title": "" }, { "docid": "d78a953a9387c243ecdaa5761381795f", "score": "0.51406896", "text": "def valid_message_length?\n valid = params[:contact_us][:body].size.between?(1,400)\n flash.now[:error] = \"Message body must be between 1 and 400 characters. Yours was \" << params[:contact_us][:body].size.to_s unless valid\n valid\n end", "title": "" }, { "docid": "2c9c3208b003cfe04046243ed7cb4d95", "score": "0.5124609", "text": "def size\n email_message.size\n end", "title": "" }, { "docid": "052baa2b620a54715215071ce7884307", "score": "0.51162726", "text": "def size\n _sent_messages.size\n end", "title": "" }, { "docid": "1cf1d028c71521dfdba7da0f1e912bcd", "score": "0.5110058", "text": "def count_tickets\n return films_booked().length\n end", "title": "" }, { "docid": "d5becab989b589e0afc3a449fb1607a1", "score": "0.5091979", "text": "def mailboxes\n cmd = {\n \"cmd\" => \"listMailboxes\",\n \"token\" => @token\n }\n result = Hpricot.XML(@connection.post(@api_url,to_params(cmd)).body)\n # usually lists were keyed w/ a name field. Mailboxes just\n # weren't working for me so I'm going with ixMailbox value\n return list_process(result,\"mailbox\",\"ixMailbox\")\n end", "title": "" }, { "docid": "f0fd530c92ce866f07e89c4a3dc24ff9", "score": "0.50914997", "text": "def total_unread_msg_count\n conversation_users.sum(:unread_messages_count)\n end", "title": "" }, { "docid": "4209e949bf7feb89552bc0237636b9e2", "score": "0.5089581", "text": "def sms_length\n escaped = Regexp.escape('€|^{}[]~\\\\')\n pattern = Regexp.new( \"[\"+escaped+\"]\" )\n\n self.length + self.scan(pattern).length\n end", "title": "" }, { "docid": "23d440052436317e2503182dfad1cd63", "score": "0.50892913", "text": "def inbox()\n messages = self.system_messages.find(:all, :conditions => \"queue = 'inbox'\", :order => \"id\")\n return(messages)\n end", "title": "" }, { "docid": "77b44bd27c3dd91ad3f83c40b76a9349", "score": "0.5078562", "text": "def mailbox_status(mailbox)\n do_action({:action => :mailboxstatus, :mailbox => mailbox})\n end", "title": "" }, { "docid": "f7731ef9048739704e2b5adab06fae1e", "score": "0.50568694", "text": "def list_mailboxes\n log 'loading mailboxes...'\n @mailboxes = (@imap.list(\"\", \"*\") || []).select {|struct| struct.attr.none? {|a| a == :Noselect}}. map {|struct| struct.name}.uniq\n log \"Loaded mailboxes: #{@mailboxes.inspect}\"\n end", "title": "" }, { "docid": "fefb6962e61182e54891f92e70a2e30a", "score": "0.504809", "text": "def unread_message(onlynum = true)\n if onlynum\n unread_messages.count(:select => 'id')\n else\n unread_messages.find(:all)\n end\n end", "title": "" }, { "docid": "102b991c00f49aa7111a2ab79039cb9f", "score": "0.50475144", "text": "def index\n @conversations ||= @mailbox.inbox.page(params[:page]).per_page(25)\n @conversationscount ||= current_user.mailbox.inbox.all\n end", "title": "" }, { "docid": "098cb3390cc4c4a513c93f7f521c9b8e", "score": "0.5044871", "text": "def messages\n return @messages if @messages\n return [] unless @mbox and File.exist?(@mbox)\n\n mbox = File.read(@mbox)\n\n if @mbox.end_with? '.gz'\n stream = StringIO.new(mbox)\n reader = Zlib::GzipReader.new(stream)\n mbox = reader.read\n reader.close\n stream.close rescue nil\n end\n\n mbox.force_encoding Encoding::ASCII_8BIT\n\n # split into individual messages\n @messages = mbox.split(/^From .*/)\n @messages.shift\n\n @messages\n end", "title": "" }, { "docid": "c34d3f57faee504a21f38ae41adc6f8d", "score": "0.5032484", "text": "def amount_of_failed_jobs()\n # returning the amount of elements in '@retry_jobs_queue'\n return @retry_jobs_queue.size()\n end", "title": "" }, { "docid": "a02b6e4cc7a1e312756ef1d58c3f2ef1", "score": "0.5027266", "text": "def unread_message_count\n eval 'messages.count(:conditions => [\"recepient = ? AND read_at IS NULL\", self.sender])'\n end", "title": "" }, { "docid": "7a95d7ed9df5a004a5acefa97db9a210", "score": "0.50258857", "text": "def test_check_message_count\n assert_equal 2, Message.count\n end", "title": "" } ]
53f71441024d4d2c51d55ba4083f1459
Get the links which can be shown as multimedia content
[ { "docid": "34de83b4ed758f371c862f50cc443833", "score": "0.8396384", "text": "def multimedia_content\n return [] if more_info_urls.blank?\n\n multimedia = more_info_urls.map do |link|\n auto_html(link) {\n youtube(width: 360)\n vimeo\n audio\n soundcloud(width: '100%', height: 315, show_artwork: true, show_comments: true)\n image\n }\n end\n\n # Links with multimedia without the normal links\n multimedia -= more_info_urls\n end", "title": "" } ]
[ { "docid": "58a17aa503ff00a7006d0a601dd6e1ce", "score": "0.73462677", "text": "def get_content_links\n content_links = []\n content_links = get_links('.*content\\/.*')\n return content_links\n end", "title": "" }, { "docid": "c3bd622468739b9207617abf2a2a1faf", "score": "0.6994293", "text": "def urls\n urls = []\n response = Typhoeus::Request.get(@media_selector_url)\n selector_xml = Nokogiri::XML.parse response.body\n selector_xml.css(\"media[service='iplayer_intl_stream_wma_uk_concrete']\").each do |media|\n playlist = media.css(\"connection\").first['href']\n\n response = Typhoeus::Request.get(playlist)\n asx_xml = Nokogiri::XML.parse response.body\n urls = asx_xml.css(\"Entry ref\").map { |ref| ref[\"href\"] }\n end\n urls\n end", "title": "" }, { "docid": "c792ad013a188216bd8a1a929fa70f1c", "score": "0.69821113", "text": "def links\n links_to_image_pages.map do |url|\n doc = document(\"http://akas.imdb.com#{url}\")\n {\n url: doc.css(\"img#primary-img\").first['src'],\n description: doc.css(\"div#photo-caption\").first.text\n } rescue nil\n end.compact\n end", "title": "" }, { "docid": "48978b0d1042d032f03285d779ec531f", "score": "0.6837586", "text": "def non_fulltext_links\n links = []\n other_customlinks = @record.fetch('CustomLinks',{})\n if other_customlinks.count > 0\n other_customlinks.each do |other_customlink|\n link_url = other_customlink['Url']\n link_url = add_protocol(link_url)\n link_label = other_customlink['Text']\n link_icon = other_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-other', expires: false})\n end\n end\n\n links\n end", "title": "" }, { "docid": "d7e36662197888bce42956a8b7d7b065", "score": "0.68093306", "text": "def getlinks\n @shortlinks = [\"in\", \"br\"] #, \"up\"]\n @shortlinks_special = [\"in\", \"br\", \"up\"]\n @links = [\"index\", \"browse\", \"update\"]\n @link_names = [\"Description\", \"Browse Database\", \"Update Database\"]\n @link_text = [\"Description\", \"Browse the database\", \"Update the database\"]\n end", "title": "" }, { "docid": "9efab0764969001ed81c4c5f1f493d10", "score": "0.6765778", "text": "def links\n Link.for_passage(self.id)\n end", "title": "" }, { "docid": "f722451248d56728d37f3eb2af45bd1d", "score": "0.6730213", "text": "def get_links()\n\t\t\tget_document(@tag_type[0])\n\t\tend", "title": "" }, { "docid": "ccced23042b8c21e69f18a981c0ba17f", "score": "0.66827756", "text": "def related_content\n list = []\n self.div(:class=>\"relatedcontent_list\").links.each do |link|\n list << link.title\n end\n return list\n end", "title": "" }, { "docid": "668ebd8d0075979e05fb20e7f0f1a869", "score": "0.66824955", "text": "def raw_links\n return [] unless @source.present?\n return @raw_links if @raw_links.present?\n\n # Don't include @mentions in the link count\n @raw_links = []\n\n cooked_document.search(\"a\").each do |l|\n next if l.attributes['href'].nil? || link_is_a_mention?(l)\n url = l.attributes['href'].to_s\n @raw_links << url\n end\n\n @raw_links\n end", "title": "" }, { "docid": "666004de9ca086e09dd95ca190657ba6", "score": "0.66807264", "text": "def links\n each_link.to_a\n end", "title": "" }, { "docid": "9a85e763a6da667b0cd3dca8c4c42b96", "score": "0.66376853", "text": "def movie_links\n agent = Mechanize.new\n page = agent.get(IMDB_URL)\n page.links_with(css: 'td.titleColumn a').map { |link| shorten_link(page.uri.merge(link.href).to_s) }\n end", "title": "" }, { "docid": "26a4867c30665d8f6861a7e627c46b48", "score": "0.6603091", "text": "def links; @links; end", "title": "" }, { "docid": "c06eb76b29e4c13c2f0d393f8531b536", "score": "0.6600981", "text": "def bechdel_website_movie_urls\n puts \"Entering bechdel_website_movie_urls method\"\n page = homepage\n links = page.css(\"a\")\n movie_links = []\n links.each do |link|\n if !(link.attributes[\"href\"]).nil? && (link.attributes[\"href\"].value.start_with?(\"/view\"))\n partial_link = link.attributes[\"href\"].value\n full_link = \"http://bechdeltest.com#{partial_link}\"\n movie_links << full_link\n end\n end\n movie_links.uniq!\n return movie_links\n end", "title": "" }, { "docid": "5b5127454d47f8c978136d7aa3c07f78", "score": "0.65910316", "text": "def links\n @links\n end", "title": "" }, { "docid": "81809404361c7b4ab96422795ea6e566", "score": "0.65795857", "text": "def extract_links\n unless self.content.blank?\n links = []\n results = self.content.scan(/href=\"(.*?)\"/)\n results.each do |result|\n logger.info \"Extract result: \" + result[0]\n links << result[0].to_s\n end\n links.flatten\n \n end \n end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.6578945", "text": "def links; end", "title": "" }, { "docid": "cd5074f41c846717426f072f20a3f46c", "score": "0.65680844", "text": "def get_description_links\n f = usmle_step + '(.*)_content'\n return get_links(f)\n end", "title": "" }, { "docid": "3be286054db67c8d1dc461b66d711d08", "score": "0.65606856", "text": "def get_links(content) \n #pull any a tags and save to results array\n results = Array.new\n # in certain situations, there is no links method\n # not sure why, looks like the it happens when the document is not html/xml\n if content.respond_to?('links')\n content.links.each do |link|\n href = link.href\n # concerned about links for deletion rather than buttons\n #this is not a very good solution\n if href and ( link.text.downcase != \"delete\" or link.text.downcase != \"destroy\")\n # if link starts with / we are fine\n if href.length >= 1 and href[1..1] == \"/\"\n results.push(href)\n # if link starts with ./, remove the dot\n elsif href.length >= 2 and href[1..2] == \"./\"\n result.push(href[2..-1])\n # if link starts with the url, remove it \n elsif href.match(self.url)\n href.gsub!(self.url, '')\n results.push(href) \n end\n # otherwise, don't use the link\n end\n end\n end\n #return the url results array\n return results\n end", "title": "" }, { "docid": "34ee64fb9b2c812ae3349b02a68b8833", "score": "0.6533449", "text": "def edit_media_links #media_resource_links\n Utility.find_links_all_types(links, \"edit-media\")\n end", "title": "" }, { "docid": "ab02693de1a006e96f0a6e4eba0007f5", "score": "0.653286", "text": "def links\n read\n @links\n end", "title": "" }, { "docid": "004541c1cdaca824755639c038e83537", "score": "0.65200293", "text": "def urls\n links.map { |link| to_absolute(link) }.compact\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.65085083", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.65085083", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.65085083", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.65085083", "text": "def links\n return @links\n end", "title": "" }, { "docid": "c9b12b427d41ba852d0a115afe5a7349", "score": "0.64860344", "text": "def link_list\n if (links = @doc.at(\"div.related-items ul\")).nil?\n @logger.write \"Www_economist_com: Could not fetch links.\\n\"\n return [@uri.to_s]\n else\n links = links/\"li a\" # get the right block of links\n end\n #FIXME SP's want last item in links (Offer to Readers) dropped?\n #links = links[0..-2] # drop the last element, Offer to Readers (sloppy)\n hrefs = links.collect { |l| l.attributes['href'] } # return list of href attributes\n hrefs.insert (0, @uri.to_s) unless (hrefs.first == @uri.to_s)\n hrefs # return\n end", "title": "" }, { "docid": "584f5d34d545f109f9677c416e9f6d0d", "score": "0.64827734", "text": "def links\n data['links']\n end", "title": "" }, { "docid": "584f5d34d545f109f9677c416e9f6d0d", "score": "0.64827734", "text": "def links\n data['links']\n end", "title": "" }, { "docid": "fab930ece7bf8c6cfd8f9ab40b68373c", "score": "0.6465005", "text": "def links\n some_links = self[\"link\"]\n return nil unless some_links\n some_links = [some_links] unless some_links.kind_of? Array\n LinkCollection.new(some_links)\n end", "title": "" }, { "docid": "5a165f44a0ac522838579e461b47f4f7", "score": "0.6462072", "text": "def external_media_classes\n [CollectionobjectLink, FlickrLink, GoogledocsLink, YoutubeLink, VimeoLink, SoundcloudLink, LocalFile, CollectiveaccessLink]\n end", "title": "" }, { "docid": "ed65907cc6d3e9f80a05e2e02bdd6edf", "score": "0.6443685", "text": "def parse_related_links\n return (@html.css(\"div.entry-content\").css(\"p\").css(\"a\").map{|link| link['href']}.compact.reject{|link| !link.include?(\"http\")}-parse_pdf_link).uniq\n end", "title": "" }, { "docid": "38fcb3ee44b7133eb79e8cd5a45c1b4e", "score": "0.64373004", "text": "def links\n @links.to_a\n end", "title": "" }, { "docid": "3eb77b3a32e01ea3efeafe01cfad1001", "score": "0.6406462", "text": "def featured_content_list\n list = []\n self.div(:id=>\"featuredcontent_content_container\").links(:class=>/featuredcontent_content_title/).each do |link|\n list << link.text\n end\n return list\n end", "title": "" }, { "docid": "50252415a211dfb2d5bb3a1a994d522a", "score": "0.63993794", "text": "def external_links view\n all_links = view.page.links_with(:href => /http/)\n\n internal_links = view.page.links_with(:href => /mahara/)\n internal_links += view.page.links_with(:href => /^\\.\\./)\n\n return all_links - internal_links\n end", "title": "" }, { "docid": "4ca8c579148a075fa92c7fd6131e4beb", "score": "0.6376749", "text": "def links\n @links.values\n end", "title": "" }, { "docid": "aa892084e3d165e1b737b8c8e2ad7596", "score": "0.637044", "text": "def links\n @links ||= []\n end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.63296604", "text": "def hyperlinks; end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.63296604", "text": "def hyperlinks; end", "title": "" }, { "docid": "20d7e2acd1bae3a7c2dd75b5a56bd0ed", "score": "0.6318454", "text": "def get_page_links\n\t\t\tpages = []\n\t\t\tsource = getHtml(\"/manga/#{@manga_name}/#{@manga_chapter}\")\n\t\t\t\n\t\t\t# Get the links in <script> tag\n\t\t\tsource = source.match(/(pages = |images = ).*(?<=\\])/).to_s\n\t\t\tsource = source.scan(/(?=src='|\"url\\\":\\\")(.*?)(images|mangas_files)(.*?)(?<='|\")/)\n\t\t\tsource.each do |page| # Não to pegrando o do pag mas aparentemente ta funcionando mesmo assim\n\t\t\t\tpage = page[0] + page[1] + page[2]\n\t\t\t\tpage = page.gsub(\"src=\", '').gsub(\"'\", '')\n\t\t\t\tpage = page.gsub(\"\\\"url\\\":\\\"\", '').gsub(\"\\\"\", '')\n\t\t\t\tpage = page.gsub(\"\\\\/\", '/').gsub(\"https://\", '')#\n\t\t\t\tpage = URI.encode(page) # depreciated\n\t\t\t\tpages.push(page)\n\t\t\tend\n\t\t\t\n\t\t\treturn pages\n\t\tend", "title": "" }, { "docid": "6e8c846cac51cdb5e8b59d550fbcd899", "score": "0.6314764", "text": "def links_feed\n end", "title": "" }, { "docid": "868da66f3b558d030cf20fb7a30cc37e", "score": "0.6311181", "text": "def links\n return @links if @links\n return false if !@source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match| #filter some malformed URLS that come in, this is meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.host, link).path\n end.uniq\n end", "title": "" }, { "docid": "57ead41bf25ade2629a499153b133a96", "score": "0.63041824", "text": "def links\n note_contents.scan(/\\[[^\\]]+\\]\\(:\\/[^)]+\\)/)\n end", "title": "" }, { "docid": "a31e80df4cda25890c20ad5a7cf3ff3a", "score": "0.6298264", "text": "def getLinks\n case @board\n when \"4chan\"\n @thread = @url.gsub(/.*res\\/([0-9]*)/, '\\1')\n @domain = \"images.4chan.org\"\n @links = getHTML.scan(/File: <a href\\=\"\\/\\/images.4chan.org\\/[a-z0-9]*\\/src\\/[0-9]*.\\w{3,4}\"/)\n @links = @links.map {|link| link.gsub(/.*\"\\/\\/(.*)\"/, '\\1')}\n when \"2chan\"\n @thread = @url.gsub(/.*res\\/([0-9]*)\\.htm/, '\\1')\n @links = getHTML.scan(/<br><a href\\=\"http:\\/\\/\\w{3}\\.2chan\\.net\\/[a-z0-9]*\\/[0-9]*\\/src\\/[0-9]*.\\w{3,4}\" target/)\n @links = @links.map {|link| link.gsub(/.*\"http:\\/\\/(.*)\" target/, '\\1')}\n @domain = @links[0].gsub(/(.*\\.2chan\\.net).*/, '\\1')\n else\n return NIL\n end\n # Folder where the images will be saved\n #@dir += @board + '_' + @thread\n return @links\n end", "title": "" }, { "docid": "86318739cd84807037d31dfb47a4d608", "score": "0.62959176", "text": "def composers\n links_to_people doc.search(\"[itemprop='musicBy']/a\")\n end", "title": "" }, { "docid": "347bbbfce2c8ec6ad871b6fa0da2d4f5", "score": "0.6292576", "text": "def links\n @links ||= []\n end", "title": "" }, { "docid": "33e5cdae84c9cf4bcfea467417015209", "score": "0.62889737", "text": "def get_main_links\n main_links = []\n parser = @main_links_page.css(\"ol a\").select {|link| link[:href].include? 'http://comentarios1.folha.com.br/comentarios/'}\n parser.each {|url| main_links.push url[:href]}\n # return the links\n main_links\n end", "title": "" }, { "docid": "9d4922a7c7ef7b6c6770e52a1c1d1c14", "score": "0.6275863", "text": "def find_link_mp4 links\n links.inject([]) do |result, link|\n result << check_link_video(link)\n end\n end", "title": "" }, { "docid": "360976ee6119d9ac66d1fbd87d6ece61", "score": "0.6273939", "text": "def raw_links\n return [] unless @raw.present?\n return @raw_links if @raw_links.present?\n\n @raw_links = []\n cooked_stripped.css(\"a\").each do |l|\n # Don't include @mentions in the link count\n next if link_is_a_mention?(l)\n @raw_links << l['href'].to_s\n end\n\n @raw_links\n end", "title": "" }, { "docid": "d4476c3a46ce116fdc849e731bdd73e2", "score": "0.62709284", "text": "def links\n nil\n end", "title": "" }, { "docid": "1bed3d0282dc196d264aef03db3a60be", "score": "0.62632465", "text": "def all_links\n fulltext_links + non_fulltext_links\n end", "title": "" }, { "docid": "df7003ae63344c3e8cc7ef81c9dea11b", "score": "0.62618726", "text": "def get_links\n @links.get_all\n end", "title": "" }, { "docid": "e3d220082fab4900cf79dcb540a456d4", "score": "0.624883", "text": "def links\n links = []\n\n # 1. Related_URL\n if dif.Related_URL?\n\n dif.Related_URL.each do | link |\n\n if link.URL_Content_Type? and link.URL_Content_Type.Type?\n dif_type = link.URL_Content_Type.Type\n else\n dif_type = nil\n end\n\n rel = case dif_type\n when \"GET DATA\" then \"data\"\n when \"VIEW PROJECT HOME PAGE\" then \"project\"\n when \"VIEW EXTENDED METADATA\" then \"metadata\"\n when \"GET SERVICE\" then \"service\"\n when \"VIEW RELATED INFORMATION\", \"\", nil then \"related\"\n else dif_type\n end\n\n link.URL.each do | url |\n\n links << {\n \"rel\" => rel,\n \"href\" => url,\n \"title\" => link.Description,\n \"type\" => \"text/html\",\n }\n end\n end\n end\n\n # 2. Link to parent metadata\n unless object.Parent_DIF.nil?\n dif.Parent_DIF.each do | parent |\n\n links << {\n \"rel\" => \"parent\",\n \"href\" => base+uuid(self.class.uri(parent))+\".json\",\n \"type\" => \"application/json\"\n }\n\n end\n end\n\n # 3. Links to DOI and \"Online Resource\" (metadata)\n # @todo\n\n if dif.Entry_ID =~ /^(org[.|-]polarresearch\\-)/\n links << {\n \"rel\" => \"via\",\n \"href\" => \"http://risapi.data.npolar.no/oai?verb=GetRecord&metadataPrefix=dif&identifier=oai:ris.npolar.no:#{dif.Entry_ID}\",\n \"type\" => \"application/json\"\n }\n end\n\n # Links to GCMD project on api.npolar.no\n #unless dif.Project.nil?\n # projects = Gcmd::Concepts.new.tuples(\"projects\")\n #\n # links += dif.Project.map {|p|\n # id, label = projects.select { |tup | tup[1] == p[\"Short_Name\"]}[0]\n # unless id.nil?\n # link(\"/gcmd/concept/#{id}.json\", \"project\", label, \"application/json\")\n # else\n # [] #link(\"/gcmd/concept/?q=#{label}&title=false&fields=*&format=json\", \"project\", label, \"application/json\")\n # end\n #\n # }\n #end\n\n links\n end", "title": "" }, { "docid": "dd40fb4895a1d558c590296ba0898534", "score": "0.6235024", "text": "def _links\n @links\n end", "title": "" }, { "docid": "541711c575fe674ed5a9584740a329c3", "score": "0.62332124", "text": "def public_pages\n list = []\n self.div(:id=>\"lhnavigation_public_pages\").links.each do |link|\n list << link.text\n end\n return list\n end", "title": "" }, { "docid": "73ab0477e07c9810c589d0689a9e2656", "score": "0.6231623", "text": "def build_links_for_this_media_type(transition)\n link = if transition.templated?\n { href: transition.templated_uri, templated: true }\n else\n { href: transition.uri }\n end\n [:name, :profile].each { |key| link[key] = transition[key] if transition.has_key?(key) }\n link\n end", "title": "" }, { "docid": "ebe40876366da44ce3d4d6700e948c5e", "score": "0.62197345", "text": "def all_links\n []\n end", "title": "" }, { "docid": "22b40b1ce217b15f8e9452874766e813", "score": "0.62188125", "text": "def all_links\n links = all_stored.map do |item|\n \":#{item.first.to_s} - #{item.last.to_s} \\n\"\n end\n links.each_slice(6).to_a.map do |item|\n item.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "273b8183a97ebe0d2cac99a2324e6572", "score": "0.6218676", "text": "def get_intro_links\n return get_links(usmle_step)\n end", "title": "" }, { "docid": "a52cf3fabf83d4dafca8a4d1dd6d7550", "score": "0.6218175", "text": "def get_public_links\r\n Link.where(\"level = 1\")\r\n end", "title": "" }, { "docid": "5935fefe38306f05720a72c7ad096a95", "score": "0.6207742", "text": "def fulltext_links\n\n result = []\n\n items = Array.wrap(@record['Items'])\n ebsco_links = Array.wrap(@record.dig('FullText', 'Links'))\n custom_links = Array.wrap(@record.dig('FullText', 'CustomLinks'))\n\n result +=\n ebsco_links.map do |link|\n next unless link['Type'] == 'pdflink'\n @eds_pdf_fulltext_available = true\n make_link(__method__, 'pdf', true, link['Url'])\n end\n\n result +=\n ebsco_links.map do |link|\n next unless link['Type'] == (type = 'ebook-pdf')\n @eds_ebook_pdf_fulltext_available = true\n make_link(__method__, type, true, link['Url'])\n end\n\n result +=\n ebsco_links.map do |link|\n next unless link['Type'] == (type = 'ebook-epub')\n @eds_ebook_epub_fulltext_available = true\n make_link(__method__, type, true, link['Url'])\n end\n\n result +=\n items.map do |item|\n next unless item['Group'] == 'URL'\n data = item['Data']\n label = item['Label']\n link_term = 'linkTerm=&quot;'\n if data.include?(link_term)\n url_start = data.index(link_term) + 15\n link_url = data[url_start..-1]\n url_end = link_url.index('&quot;') - 1\n link_url = link_url[0..url_end]\n unless (link_label = label)\n label_start = data.index('link&gt;') + 8\n link_label = data[label_start..-1].strip\n end\n else\n link_url = data\n link_label = label\n end\n make_link(__method__, 'cataloglink', false, link_url, link_label)\n end\n\n result +=\n ebsco_links.map do |link|\n next unless link['Type'] == 'other'\n @eds_pdf_fulltext_available = true\n make_link(__method__, 'smartlinks', false, link['Url'])\n end\n\n result +=\n custom_links.map do |link|\n make_link(__method__, 'customlink-fulltext', false, link)\n end\n\n result << make_link(__method__, 'html', false) if html_fulltext_available\n\n result.compact\n\n end", "title": "" }, { "docid": "deea3814bbd472593055836da6bcddd0", "score": "0.61906606", "text": "def artist_wiki_links_text\n artist_wiki_links.collect{|v| v.reference_text }.join(\",\")\n end", "title": "" }, { "docid": "deea3814bbd472593055836da6bcddd0", "score": "0.61906606", "text": "def artist_wiki_links_text\n artist_wiki_links.collect{|v| v.reference_text }.join(\",\")\n end", "title": "" }, { "docid": "ba7ed2e13fe463065d20a777d8fb4990", "score": "0.6187472", "text": "def hyperlinks\n links = images.select { |a| a.hyperlink.is_a?(Hyperlink) }\n links.map(&:hyperlink)\n end", "title": "" }, { "docid": "e43309296fd5e3f3ceee98129e3271aa", "score": "0.61845726", "text": "def links(mode='yahoo')\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n doc.search(\"//a[@href]\").each do |a|\n if mode == 'yahoo'\n u = a['href'].downcase\n else\n u = a['href']\n end\n next if u.nil? or u.empty?\n #abs = to_absolute(u) rescue next\n abs = to_abs(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end", "title": "" }, { "docid": "6c1dedd8fb61ec6f7eb7765d28f20410", "score": "0.61787707", "text": "def sharing_links\n url = ERB::Util.url_encode request.original_url.split('/', 3)[2]\n\n tag.div class: 'sharing_links' do\n concat tag.div I18n.translate('articles.share'), class: 'sharing_links__title'\n sharing_urls.each do |type, link|\n concat tag.a (tag.span class: \"icon icon--#{type} icon\"), class: 'sharing_links__item', href: link.gsub('%{url}', url)\n end\n end\n end", "title": "" }, { "docid": "d0e71a9bd224d0270d0c582822cd5c28", "score": "0.6167976", "text": "def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n next if HASH_RE =~ link\n Link.new(@t.scheme, host_with_port, link, @url).path\n end.compact.uniq\n end", "title": "" }, { "docid": "68c05b72c2777ddd8b0e75b5b3eef5a1", "score": "0.6166276", "text": "def links\n collection.map(&:link).join(', ')\n end", "title": "" }, { "docid": "ab4b8d7221ae4b35ff4941a80b9979a7", "score": "0.615328", "text": "def extract_links(page)\n page.links(@source[:archive_patterns])\n end", "title": "" }, { "docid": "06aa9ab17f0faf92cacb0f4ca3cc723e", "score": "0.61381847", "text": "def extract_links(doc)\n {'a' => 'href', 'area' => 'href', 'frame' => 'src'}.map do |tag, attr|\n (doc/tag).map do |tag|\n value = tag[attr]\n CGI.unescapeHTML(value) if value && value !~ /^#/\n end\n end.flatten.compact\n end", "title": "" }, { "docid": "1148e03980dfc028680652cf490bf5a9", "score": "0.6128625", "text": "def render_links(content)\n auto_link(content, :html => { :target => '_blank' }) do |text|\n # .sub(...) only replaces the visualized text\n # .sub!(...) replaces the actual link AND the visualized text\n text.sub(/^https?\\:\\/\\//, '')\n end\n end", "title": "" }, { "docid": "cefa1e56f2b4700a6986918935b8462d", "score": "0.612837", "text": "def extract_links(post)\n TopicLink.extract_from(post)\n QuotedPost.extract_from(post)\n end", "title": "" }, { "docid": "35bdaad01983dfcef9fc9b106783f097", "score": "0.6123293", "text": "def pm_subjects\n anchor_objects = frm.links.find_all { |link| link.href=~/pm.read.+page/ }\n subjects = []\n anchor_objects.each { |link| subjects << link.text }\n return subjects \n end", "title": "" }, { "docid": "35bdaad01983dfcef9fc9b106783f097", "score": "0.6123293", "text": "def pm_subjects\n anchor_objects = frm.links.find_all { |link| link.href=~/pm.read.+page/ }\n subjects = []\n anchor_objects.each { |link| subjects << link.text }\n return subjects \n end", "title": "" }, { "docid": "cd3b5bbd06466d290fee7017a1943214", "score": "0.6122778", "text": "def non_fulltext_links\n Array.wrap(@record['CustomLinks']).map { |link|\n make_link(__method__, 'customlink-other', false, link)\n }.compact\n end", "title": "" }, { "docid": "cd3b5bbd06466d290fee7017a1943214", "score": "0.6122778", "text": "def non_fulltext_links\n Array.wrap(@record['CustomLinks']).map { |link|\n make_link(__method__, 'customlink-other', false, link)\n }.compact\n end", "title": "" }, { "docid": "ccca4d322a231e9c07175a4f16577d99", "score": "0.61227566", "text": "def links\n hpricot_doc.search(\"a[@href]\").map do |a|\n normalize_url(a.attributes[\"href\"])\n end.uniq.reject { |b| rejected_url?(b) }\n end", "title": "" }, { "docid": "a5344de283bc6b2f9a10645c96460b15", "score": "0.6121573", "text": "def links\n @text.gsub!(URI.regexp) do |*match|\n url=$&\n url =~ /[a-zA-Z]+:\\/\\// ? \"<a target='_blank' href='#{url}'>#{url}</a>\" : url\n end\n end", "title": "" }, { "docid": "28735da6506cceb1aaaa1e4689d81961", "score": "0.61182475", "text": "def get_all_links()\n return get_string_array(\"getAllLinks\", [])\n end", "title": "" }, { "docid": "9b22892a5026e3567ccb0277bfb81fc9", "score": "0.6116878", "text": "def get_links(url, size = 'full')\n page = get_content url\n contents = seperate_html page\n seperate_to_links contents, size\n end", "title": "" }, { "docid": "01708a0fae1127b09b583cb1929ca385", "score": "0.6110782", "text": "def links\n links = extract_attribute_values('//a/@href').uniq\n links.select do |link|\n !file_link?(link) && internal_link?(link)\n end\n end", "title": "" }, { "docid": "532cf69c2b155475cec713b77f243bca", "score": "0.61071086", "text": "def links\n @links ||= fragment.find_all(\"a[href]\").map { |a| a[\"href\"] }.uniq\n end", "title": "" }, { "docid": "f99b662084372259f2abdf26a83e8018", "score": "0.6106522", "text": "def get_links(url)\n\t\tlinks = Set.new []\n\n\t\tbegin\n\t\t\tcontent_a = get_content(url)\n\t\t\t# puts 'here'\n\t\t\tif content_a.to_a()[0] != \"url\"\n\t\t # puts 'there with ' + content_a.to_a()[0]\n\t\t url = content_a.to_a()[0]\n\t\t content = content_a.to_a()[1]\n\t\t \n # don't forget to add the document URI itself\n\t\t # this is important, if this URI isn't mentioned in the content somewhere\n\t\t if (! url.index(@main_url).nil?) && content.index(\" href=\\\"\")\n\t\t parsed_url = URI.parse(url)\n\t\t html_u = parsed_url.scheme + \"://\" + parsed_url.host + parsed_url.path\n\t\t puts 'add html document uri ' + html_u\n\t\t links.add(html_u)\n\t\t end\n\t\t \n\t\t\t while content.index(\" href=\\\"\")\n\t\t\t i_href = content.index(\" href=\\\"\")\n\t\t\t \n\t\t\t l_href = content.index(\"\\\"\", i_href + 7)\n\t\t\t \n\t\t\t if i_href && l_href\n\t\t\t link = content[(i_href+7)..(l_href-1)]\n\t\t\t content = content.gsub(content[i_href..l_href], \"\")\n\t\t\t link = fix_link(link, url)\n\t\t\t \n\t\t\t if contains_main_url(link)\n\t\t\t # puts 'add link ' + link\n\t\t\t u = URI.parse(link)\n\t\t\t document_u = u.scheme + \"://\" + u.host + u.path\n\t\t\t if ! document_u.index(@main_url).nil?\n\t\t\t # puts 'add document uri ' + document_u\n\t\t\t end\n\t\t\t links.add(document_u)\n\t\t\t end\n\t\t\t end\n\t\t\t end\n\t\t end \n\t\trescue => e\n\t\t\tif @view\n\t\t\t\[email protected]_exception(e)\n\t\t\tend\n\t\tend\n\n\t\treturn links\n\tend", "title": "" }, { "docid": "e148eadfa72e5e0f796685063c1fc0ef", "score": "0.6101073", "text": "def search_links(electronic_access)\n urls = []\n unless electronic_access.nil?\n links_hash = JSON.parse(electronic_access)\n links_hash.first(2).each do |url, text|\n link = link_to(text.first, EzProxyService.ez_proxy_url(url), target: '_blank', rel: 'noopener')\n link = \"#{text[1]}: \".html_safe + link if text[1]\n urls << content_tag(:div, link, class: 'library-location')\n end\n end\n urls\n end", "title": "" }, { "docid": "09d038fcf49a70919e3f15f25d9f313c", "score": "0.60983735", "text": "def get_art_link\r\n\t\tlinks = comment.at_css('.md p a') == nil ? nil : links = comment.at_css('.md p a').attributes[\"href\"].value\r\n\t\tunless links == nil\r\n\t\t\tif links.include?(\"i.imgur\")\r\n\t\t\t\tlinks =~ /\\.(png|jpg|gif)/ ? links : links.insert(-1, \".jpg\")\r\n\t\t\telsif links.include?(\"imgur\")\r\n\t\t\t\tlink_gallery = Nokogiri::HTML(open(links))\r\n\t\t\t\timg_link = link_gallery.css('link').select{|this_link| this_link[\"rel\"]==\"image_src\" }[0][\"href\"]\r\n\t\t\telse\r\n\t\t\t\tlinks\r\n\t\t\tend\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "b14d763ff87336f3c31f9e99f39cfdf9", "score": "0.6096964", "text": "def links # this is _not_ called by rendering as we go via ::links_config.\n tuples = (@links||[]).collect { |link| [link.rel, link] }\n # tuples.to_h\n ::Hash[tuples] # TODO: tuples.to_h when dropping < 2.1.\n end", "title": "" }, { "docid": "4cbadc2c573462746767dad2b3ac02d9", "score": "0.60951954", "text": "def content_urls\n return [] unless @resource.file_view\n\n @resource.data_files.present_files.map { |f| Rails.application.routes.url_helpers.download_stream_url(f.id) }\n end", "title": "" }, { "docid": "4f22d2e9a6964a79dff0e6c8a55509a6", "score": "0.60927933", "text": "def all_links\n Link.all #the query returns all links\n end", "title": "" }, { "docid": "914373172fcece6bddb5d3f2b6ced063", "score": "0.60814023", "text": "def get_links(items)\n images=Array.new\n items.each do |item|\n images.push([item.image.url(:thumb),item_path(item),item.name])\n end\n return images\n end", "title": "" }, { "docid": "f1517b6f9da7f733ea736c7f55b600d6", "score": "0.6080838", "text": "def get_full_text_links_from_document(document)\n full_text_links = []\n\n fulltext_url_display = document.get('url_fulltext_display', :sep => nil)\n\n unless fulltext_url_display.nil?\n fulltext_url_display.each do |url_display| \n if url_display.include? \"|\"\n url_label = url_display.split(\"|\") \n full_text_links << \"<a href='#{url_label.first}'>#{url_label.last}</a>\"\n else\n full_text_links << \"<a href='#{url_display}'>Access this resource online</a>\"\n end\n end\n end\n\n return full_text_links\n end", "title": "" }, { "docid": "7ef8c414be506b9cf3a66fa386cfacf1", "score": "0.60792524", "text": "def fulltext_links\n\n links = []\n\n ebscolinks = @record.fetch('FullText',{}).fetch('Links',{})\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'pdflink'\n link_label = 'PDF Full Text'\n link_icon = 'PDF Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'pdf', expires: true})\n @eds_pdf_fulltext_available = true\n end\n end\n end\n\n # commenting out for now, not sure how 'detail' urls are useful in a blacklight context?\n # htmlfulltextcheck = @record.fetch('FullText',{}).fetch('Text',{}).fetch('Availability',{})\n # if htmlfulltextcheck == '1'\n # link_url = 'detail'\n # link_label = 'Full Text in Browser'\n # link_icon = 'Full Text in Browser Icon'\n # links.push({url: link_url, label: link_label, icon: link_icon, type: 'html'})\n # end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'ebook-pdf'\n link_label = 'PDF eBook Full Text'\n link_icon = 'PDF eBook Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'ebook-pdf', expires: true})\n @eds_ebook_pdf_fulltext_available = true\n end\n end\n end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'ebook-epub'\n link_label = 'ePub eBook Full Text'\n link_icon = 'ePub eBook Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'ebook-epub', expires: true})\n @eds_ebook_epub_fulltext_available = true\n end\n end\n end\n\n items = @record.fetch('Items',{})\n if items.count > 0\n items.each do |item|\n if item['Group'] == 'URL'\n if item['Data'].include? 'linkTerm=&quot;'\n link_start = item['Data'].index('linkTerm=&quot;')+15\n link_url = item['Data'][link_start..-1]\n link_end = link_url.index('&quot;')-1\n link_url = link_url[0..link_end]\n if item['Label']\n link_label = item['Label']\n else\n link_label_start = item['Data'].index('link&gt;')+8\n link_label = item['Data'][link_label_start..-1]\n link_label = link_label.strip\n end\n else\n link_url = item['Data']\n link_label = item['Label']\n end\n link_icon = 'Catalog Link Icon'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'cataloglink', expires: false})\n end\n end\n end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'other'\n link_label = 'Linked Full Text'\n link_icon = 'Linked Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'smartlinks', expires: false})\n @eds_pdf_fulltext_available = true\n end\n end\n end\n\n ft_customlinks = @record.fetch('FullText',{}).fetch('CustomLinks',{})\n if ft_customlinks.count > 0\n ft_customlinks.each do |ft_customlink|\n link_url = ft_customlink['Url']\n link_url = add_protocol(link_url)\n link_label = ft_customlink['Text']\n link_icon = ft_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-fulltext', expires: false})\n end\n end\n\n links\n end", "title": "" }, { "docid": "cefac7f5324b008cde8e0ced27569b82", "score": "0.6076444", "text": "def search_links(electronic_access)\n urls = []\n unless electronic_access.nil?\n links_hash = JSON.parse(electronic_access)\n links_hash.first(2).each do |url, text|\n link = link_to(text.first, \"#{ENV['proxy_base']}#{url}\", target: '_blank')\n link = \"#{text[1]}: \".html_safe + link if text[1]\n urls << content_tag(:div, link, class: 'library-location')\n end\n end\n urls\n end", "title": "" }, { "docid": "fc303e529614f64aeb48d4824053d4ca", "score": "0.6057281", "text": "def links_to_content_articles(*vals)\n Array(vals).map{|v| }\nend", "title": "" }, { "docid": "7f071c098ef97c692d669875d33264d1", "score": "0.6056971", "text": "def offer_overview_links\n links = @page.css('.claLeft.claNoPrint a').map { |anchor| anchor.attributes['href'].value }\n links.select { |link| link.include? 'angebot' }\n end", "title": "" } ]
077b2bc6b8116a2b6a9c3fac98d9db9e
============ = AWS KEYS = ============ aws vars
[ { "docid": "913a1009ac91657f54b24a9bbc0debdb", "score": "0.5489686", "text": "def aws_access_id\n AWS_ACCESS_ID\n end", "title": "" } ]
[ { "docid": "6010eac99119044591a1fb74beadb1d3", "score": "0.6447641", "text": "def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n end", "title": "" }, { "docid": "a66cbc361c36918840669465244bb858", "score": "0.6409877", "text": "def fle_aws_key\n ENV['MONGO_RUBY_DRIVER_AWS_KEY']\n end", "title": "" }, { "docid": "6f416f50a3370c7381a7bcea41b64f8b", "score": "0.63720286", "text": "def sends_aws_keys settings\n settings[:user_data][:attributes][:aws] ||= {}\n settings[:user_data][:attributes][:aws][:access_key] ||= Settings[:access_key]\n settings[:user_data][:attributes][:aws][:secret_access_key] ||= Settings[:secret_access_key]\n settings[:user_data][:attributes][:aws][:aws_region] ||= Settings[:aws_region]\nend", "title": "" }, { "docid": "511080e4daae9e02f9704f3705429682", "score": "0.63593936", "text": "def require_aws_keys()\n unless verify_aws_keys()\n error(NO_AWS_KEYS_ERROR_MESSAGE)\n end\n end", "title": "" }, { "docid": "e118ab3ec20a6a7ba157b384013401f5", "score": "0.6210919", "text": "def prod_s3_credentials\n {:bucket => \"alphadelta-pro\", :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET_KEY'] }\n end", "title": "" }, { "docid": "2351752c0fa0de44c51b4054019f0265", "score": "0.6127182", "text": "def tf_vars_aws\n {\n aws_region: provider.region,\n route53_zone_main_name: infra.dns.domain,\n route53_zone_this_name: infra.dns.subdomain,\n ec2_instance_type: provider.instance.type,\n ec2_key_pair: provider.instance.key_pair,\n ec2_tags: provider.instance.tags,\n ec2_ami_distro: provider.instance.ami_distro\n # lambda_filename: infra.lambda_filename\n }\n end", "title": "" }, { "docid": "829dd634e71aa932d696e95bcebf76e9", "score": "0.6115588", "text": "def fle_aws_temp_key\n ENV['CSFLE_AWS_TEMP_ACCESS_KEY_ID']\n end", "title": "" }, { "docid": "60b09c54fca3aa404aaa0fdcb514c728", "score": "0.61136955", "text": "def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend", "title": "" }, { "docid": "3b7e15598403ea2c586d4b1a4516772a", "score": "0.6103268", "text": "def aws_access_key_id\n aws_ssm_parameter_store && aws_ssm_parameter_store[:access_key_id]\n end", "title": "" }, { "docid": "3e048c3082fa1235041fc863db02837f", "score": "0.6067197", "text": "def verify_aws_keys()\n if (not (ENV['AWS_ACCESS_KEY'] and ENV['AWS_SECRET_KEY'])) then\n if not ENV['MORTAR_IGNORE_AWS_KEYS']\n return false\n else\n return true\n end\n else\n return true\n end\n end", "title": "" }, { "docid": "79a312f88de71441eb12f55e288ac097", "score": "0.60027254", "text": "def access_key\n return Brevidy::Application::S3_ACCESS_KEY_ID\n end", "title": "" }, { "docid": "3b54b517523b68fe4dc1e6f783d3e8f0", "score": "0.5992029", "text": "def config\n {\n :APP_NAME => APP_NAME,\n :APP_ENV => APP_ENV,\n :AWS_ACCESS_KEY_ID => AMI_ACCESS_KEY_ID,\n :AWS_SECRET_ACCESS_KEY => AMI_SECRET_ACCESS_KEY\n }\nend", "title": "" }, { "docid": "a49720d27695a257336de1a114dfc0b6", "score": "0.59909296", "text": "def aws_access_key(arg = nil)\n if arg.nil? && @aws_access_key.nil?\n @aws_access_key_id\n else\n set_or_return(:aws_access_key, arg, kind_of: String)\n end\nend", "title": "" }, { "docid": "679d1709428f0788ec4795188c75f48e", "score": "0.5985358", "text": "def aws_key size\n id.to_s + \"-#{size.to_s}\"\n end", "title": "" }, { "docid": "33514546a58111c5c54df6d8a2f8878d", "score": "0.59738296", "text": "def code_s3_key\n \"code_s3_key_placeholder\"\n end", "title": "" }, { "docid": "d069e2169f9c782aa5f49e20aea69a08", "score": "0.5900905", "text": "def fixup_aws_environment_variables\n unless node['aws']['aws_access_key_id'].nil?\n ENV['AWS_ACCESS_KEY_ID'] = node['aws']['aws_access_key_id']\n ENV['AWS_SECRET_ACCESS_KEY'] = node['aws']['aws_secret_access_key']\n end\n ENV['AWS_REGION'] = node['aws']['region'] unless node['aws']['region'].nil?\nend", "title": "" }, { "docid": "39be6c9bfe211d2cf3f865956831b249", "score": "0.58764297", "text": "def old_test_aws_keys (key, secret)\n\n creds = {\n :access_key_id => key,\n :secret_access_key => secret\n }\n\n result = {\n :access_key_id => key,\n :secret_access_key => secret,\n :valid => false,\n :s3_active => false,\n :ec2_active => false,\n :s3_buckets => nil,\n :ec2_instances => nil,\n :s3_error => nil,\n :ec2_error => nil,\n }\n\n begin\n result[:s3_buckets] = AWS::S3.new(creds).buckets.count\n result[:s3_active] = true\n result[:valid] = true\n rescue AWS::S3::Errors::InvalidAccessKeyId => e\n result[:s3_error] = e.to_s\n rescue AWS::S3::Errors::SignatureDoesNotMatch => e\n result[:s3_error] = e.to_s\n rescue AWS::S3::Errors::AccessDenied => e\n result[:s3_error] = e.to_s\n result[:valid] = true\n rescue AWS::S3::Errors::NotSignedUp => e\n result[:s3_error] = e.to_s\n result[:valid] = true\n end\n\n begin\n result[:ec2_instances] = AWS::EC2.new(creds).instances.count\n result[:ec2_active] = true\n result[:valid] = true\n rescue AWS::EC2::Errors::AuthFailure => e\n result[:ec2_error] = e.to_s\n rescue AWS::EC2::Errors::InvalidAccessKeyId => e\n result[:ec2_error] = e.to_s\n rescue AWS::EC2::Errors::SignatureDoesNotMatch => e\n result[:ec2_error] = e.to_s\n rescue AWS::EC2::Errors::UnauthorizedOperation => e\n result[:ec2_error] = e.to_s\n result[:valid] = true\n rescue AWS::EC2::Errors::OptInRequired => e\n result[:ec2_error] = e.to_s\n result[:valid] = true\n end\n result\nend", "title": "" }, { "docid": "7ff1eb600a8f393d8a4a712099bbf7f0", "score": "0.58717394", "text": "def key_files; end", "title": "" }, { "docid": "fbab1d47f7bb35b01b1e4e89e9a651f3", "score": "0.5862253", "text": "def aws_access_key_attribute\n\t\t\"provider_account_#{Digest::MD5.hexdigest(name || 'unknown')}_aws_access_key\"\n\tend", "title": "" }, { "docid": "37ea91bbe3e67be7a9a8249cffaa836a", "score": "0.5801768", "text": "def env_key; end", "title": "" }, { "docid": "8604a5b391c620667abef2412ddd118d", "score": "0.5795612", "text": "def aws_credentials\n {}\n end", "title": "" }, { "docid": "1a633c0cbe8358897a902d03535aa67f", "score": "0.5784612", "text": "def list_keys(iam, user_name)\r\n begin \r\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\r\n\r\n if list_access_keys_response.access_key_metadata.count == 0\r\n puts \"No access keys.\"\r\n else\r\n puts \"Access keys:\"\r\n list_access_keys_response.access_key_metadata.each do |key_metadata|\r\n puts \" Access key ID: #{key_metadata.access_key_id}\"\r\n end\r\n end\r\n \r\n rescue Aws::IAM::Errors::NoSuchEntity\r\n puts \"Cannot find user '#{user_name}'.\"\r\n exit(false)\r\n end \r\nend", "title": "" }, { "docid": "9c9246f3e3dc2273a98dac21995b4aac", "score": "0.5731474", "text": "def aws_access_key_id\n if @aws_access_key_id\n return @aws_access_key_id\n elsif !ENV.has_key?('AWS_ACCESS_KEY_ID')\n raise FogSettingError, \"access key id must be set in ENV or configure block\"\n end\n @aws_access_key_id ||= ENV['AWS_ACCESS_KEY_ID']\n end", "title": "" }, { "docid": "9ae404efa5f5cdaaa3c5f50dfb570d5a", "score": "0.57303023", "text": "def secret_key; end", "title": "" }, { "docid": "627498116a25b66608405880775fd61a", "score": "0.57102424", "text": "def client_params\n @client_params ||= Aws::S3::Client.new.config.to_h.keys\n end", "title": "" }, { "docid": "5045602d530964d0f9300582697d65d0", "score": "0.570749", "text": "def client_params\n params = { region: 'ap-southeast-1',\n access_key_id: x_access_key_id,\n secret_access_key: x_secret_access_key }\n\n params[:endpoint] = ENV['AWS_ENDPOINT'] unless ENV['AWS_ENDPOINT'].nil?\n params\n end", "title": "" }, { "docid": "ebe30bcb898ec001a8d5d87a38970609", "score": "0.56765187", "text": "def describe_key_pairs(list=[])\n @ec2.describe_key_pairs(list).collect! do |key|\n {:aws_key_name => key.keyName,\n :aws_fingerprint => key.keyFingerprint }\n end\n rescue Exception\n on_query_exception('describe_key_pairs')\n end", "title": "" }, { "docid": "080c1698dc57d250114196fd40cdf4ca", "score": "0.5671823", "text": "def aws_config\n Hash(\n region: AwsSettings.instance.region,\n bucket: AwsSettings.instance.bucket,\n identity_id: AwsSettings.instance.identity_id,\n identity_pool_id: AwsSettings.instance.identity_pool_id,\n ).merge( StorageService.paths )\n end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.5666658", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.5666658", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.5666658", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.5666658", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.5666658", "text": "def keypair; end", "title": "" }, { "docid": "61a7d074f5674cec0790681137d96f3c", "score": "0.5652488", "text": "def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end", "title": "" }, { "docid": "2fe85a6d9a57e7fcd16c37b85b6d2815", "score": "0.56475425", "text": "def secret_access_key\n return Brevidy::Application::S3_SECRET_ACCESS_KEY\n end", "title": "" }, { "docid": "e120efc983bc9c863e561fd850fb478e", "score": "0.5644401", "text": "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "title": "" }, { "docid": "e120efc983bc9c863e561fd850fb478e", "score": "0.5644401", "text": "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "title": "" }, { "docid": "ae46c572f3d5a0bb7ef1d67921af9a2b", "score": "0.56406343", "text": "def list_keys()\n # TODO\n end", "title": "" }, { "docid": "dee13689e55fe4d745de0af737e13603", "score": "0.56393087", "text": "def bucket_and_key(url)\n if url =~ /s3:\\/\\/([^\\/]+)\\/?(.*)/\n bucket = $1\n key = $2\n elsif url =~ /([^:]+):(.*)/\n bucket = $1\n key = $2\n end\n [bucket, key]\n end", "title": "" }, { "docid": "2db26f9e05992ad6d0f890a5dee25050", "score": "0.5609741", "text": "def service_key\n SERVICE_KEY\n end", "title": "" }, { "docid": "4612319c78e8a8b6595541d25acb5a34", "score": "0.56059045", "text": "def exchange_keys; end", "title": "" }, { "docid": "4612319c78e8a8b6595541d25acb5a34", "score": "0.56059045", "text": "def exchange_keys; end", "title": "" }, { "docid": "aa355eca3ef27acb372597e698f3176f", "score": "0.55919105", "text": "def synckey(item)\n key = @itemkey.to_sym\n item[key]\n end", "title": "" }, { "docid": "1e47fc57c3741366d9322d285fe5e399", "score": "0.5576349", "text": "def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end", "title": "" }, { "docid": "e820f93f8289def052bc4a4922790826", "score": "0.557193", "text": "def keys\n return @keys if @keys\n keys = py \"keys.py\"\n keys = parse_keys keys\n @keys = keys\n end", "title": "" }, { "docid": "2fe8dec569194e4a30759382b91fe300", "score": "0.5568647", "text": "def list_keys(iam, user_name)\n begin\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\n\n if list_access_keys_response.access_key_metadata.count == 0\n puts \"No access keys.\"\n else\n puts \"Access keys:\"\n list_access_keys_response.access_key_metadata.each do |key_metadata|\n puts \" Access key ID: #{key_metadata.access_key_id}\"\n end\n end\n\n rescue Aws::IAM::Errors::NoSuchEntity\n puts \"Cannot find user '#{user_name}'.\"\n exit(false)\n end\nend", "title": "" }, { "docid": "72efea953c5fddb2fd4cf02502658e94", "score": "0.55662096", "text": "def sauce_key\n env = ENV['SAUCE_ACCESS_KEY']\n (env && !env.empty?) ? env : nil\nend", "title": "" }, { "docid": "3e85612a8ef598ce23262ed2da25b9e9", "score": "0.55612844", "text": "def keys(arg = nil)\n if arg.nil?\n storage.keys\n else\n with_interest(arg).map { |key, _, _| key }\n end\n end", "title": "" }, { "docid": "01c18f1770bd57b0bb9594bf9e0f95cd", "score": "0.55556476", "text": "def secret_key_base; end", "title": "" }, { "docid": "01c18f1770bd57b0bb9594bf9e0f95cd", "score": "0.55556476", "text": "def secret_key_base; end", "title": "" }, { "docid": "01c18f1770bd57b0bb9594bf9e0f95cd", "score": "0.55556476", "text": "def secret_key_base; end", "title": "" }, { "docid": "01c18f1770bd57b0bb9594bf9e0f95cd", "score": "0.55556476", "text": "def secret_key_base; end", "title": "" }, { "docid": "5ab3be233790bea32db85f6185e36a90", "score": "0.555046", "text": "def do_bucket_key(bucket_name, object_name, options)\n access_key_id, secret_access_key, security_token = if ENV.has_key? \"AWS_SESSION_TOKEN\"\n get_temporary_keys_from_environment\n else\n get_temporary_keys_via_sts\n end\n\n expiration = options[:expires].to_i\n\n string_to_sign = \"GET\\n\\n\\n#{expiration}\\nx-amz-security-token:#{security_token}\\n/#{bucket_name}/#{object_name}\"\n\n signature = CGI.escape(\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret_access_key,\n string_to_sign,\n )\n ).gsub(\"\\n\",\"\")\n )\n\n object_url = if options[:path_style]\n \"https://s3.amazonaws.com/#{bucket_name}/#{object_name}\"\n elsif options[:insecure]\n \"http://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n else\n \"https://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n end\n\n url = object_url + \"?AWSAccessKeyId=#{access_key_id}&Expires=#{expiration}&Signature=#{signature}&x-amz-security-token=#{CGI.escape(security_token)}\"\n\n puts url\nend", "title": "" }, { "docid": "e30368cd82df6fe5c9ab6d939d5051b7", "score": "0.55501395", "text": "def key_data; end", "title": "" }, { "docid": "e30368cd82df6fe5c9ab6d939d5051b7", "score": "0.55501395", "text": "def key_data; end", "title": "" }, { "docid": "7c3a917d00421178a55e0f4497e9b5c3", "score": "0.5548942", "text": "def keys(bucket_name, options = {})\n paramters = {}\n paramters['prefix'] = options[:prefix] if options[:prefix]\n paramters['marker'] = options[:marker] if options[:marker]\n paramters['max_keys'] = options[:max_keys] if options[:max_keys]\n paramters['prefix'] = options[:prefix] if options[:prefix]\n\n response = send_s3_request('GET', :bucket => bucket_name, :paramters => paramters)\n parser = Awsum::S3::ObjectParser.new(self)\n parser.parse(response.body)\n end", "title": "" }, { "docid": "bf06b2dac5cd6ccc9ba041283ea6b67f", "score": "0.5547392", "text": "def keys\n jiak.client.keys(jiak.bucket)\n end", "title": "" }, { "docid": "50bf818e50edee41643c226dcaa2069f", "score": "0.5545132", "text": "def generate_keys()\n bobhi = read_key(\"key_bobhi345.txt\")\n floatlift = read_key(\"key_FloatLift.txt\")\n sirbob = read_key(\"key_sirbob3.txt\")\n api = read_key(\"key_JustForTheApiLul.txt\")\n return [bobhi, floatlift, sirbob, api]\nend", "title": "" }, { "docid": "be49b3345d1a1b21b3851ebfa89c39dc", "score": "0.5532775", "text": "def keys\n doc = JSON.parse get('/api/v1/ssh_keys')\n doc[\"ssh_keys\"]\n end", "title": "" }, { "docid": "eed1d4265250cf4babf4603392724ad0", "score": "0.5523338", "text": "def describe_key_pairs(ec2_client)\n result = ec2_client.describe_key_pairs\n if result.key_pairs.count.zero?\n puts \"No key pairs found.\"\n else\n puts \"Key pair names:\"\n result.key_pairs.each do |key_pair|\n puts key_pair.key_name\n end\n end\nrescue StandardError => e\n puts \"Error getting information about key pairs: #{e.message}\"\nend", "title": "" }, { "docid": "f6a30becd073548a1e3f2dd7be9583b9", "score": "0.5503425", "text": "def aws_secret_access_key \n if @aws_secret_access_key\n return @aws_secret_access_key\n elsif !ENV.has_key?('AWS_SECRET_ACCESS_KEY')\n raise FogSettingError, \"secret access key must be set in ENV or configure block\"\n end\n @aws_secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']\n end", "title": "" }, { "docid": "47beb3412a0e9b02d861f9b70dd0d0b3", "score": "0.5500893", "text": "def host_key; end", "title": "" }, { "docid": "e27477a848783a1efcb9d46fd44aa067", "score": "0.55000234", "text": "def setup_ssh_key(node_name)\n network_settings = @network_settings.node_settings(node_name)\n { 'whoami' => network_settings['whoami'],\n 'network' => network_settings['network'],\n 'keyfile' => network_settings['keyfile'],\n 'name' => node_name }\n end", "title": "" }, { "docid": "202e38c716c0e6d51f8693ae9da9cfac", "score": "0.5485631", "text": "def secret_key\n \"\"\n end", "title": "" }, { "docid": "a7d7e72daa82a63ccadaba70275ce862", "score": "0.54817206", "text": "def secret_key_base=(_arg0); end", "title": "" }, { "docid": "a7d7e72daa82a63ccadaba70275ce862", "score": "0.54817206", "text": "def secret_key_base=(_arg0); end", "title": "" }, { "docid": "991cc1dee5b3456c091b62651db1f868", "score": "0.5478945", "text": "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "title": "" }, { "docid": "a82fcdec41b4d0a09d05e0273c69b773", "score": "0.54697984", "text": "def credential_keys\n %w(seal certificate) & valid_keys\n end", "title": "" }, { "docid": "e812267a0849c7a5818a59854ca34946", "score": "0.54592025", "text": "def sb_access_key\n ENV['AZURE_SERVICEBUS_ACCESS_KEY']\n end", "title": "" }, { "docid": "621615ac77394785a48d97ebbd21fc52", "score": "0.54590625", "text": "def private_env_vars\n {\n 'DISCONTINUE_API' => \"http://#{ENV['MACHINE_IP']}:8080\",\n 'AWS_REGION' => build.build_config.aws_region,\n 'S3_BUCKET' => build.build_config.aws_cache_bucket,\n 'AWS_ACCESS_KEY_ID' => build.build_config.aws_access_key,\n 'AWS_SECRET_ACCESS_KEY' => build.build_config.aws_access_secret,\n }\n end", "title": "" }, { "docid": "23b4c49cedc930ba7f20596d29f0f885", "score": "0.5451605", "text": "def list_access_keys(iam, user_name)\n response = iam.list_access_keys(user_name: user_name)\n\n if response.access_key_metadata.count.positive?\n puts \"Access key IDs:\"\n response.access_key_metadata.each do |key_metadata|\n puts \" #{key_metadata.access_key_id}\"\n end\n else\n puts \"No access keys found for user '#{user_name}'.\"\n end\nrescue Aws::IAM::Errors::NoSuchEntity\n puts \"Error listing access keys: cannot find user '#{user_name}'.\"\n exit 1\nrescue StandardError => e\n puts \"Error listing access keys: #{e.message}\"\nend", "title": "" }, { "docid": "f7a9dd6211e4da89e3f5f074f076367c", "score": "0.5451421", "text": "def ask_for_credentials\n puts \"Enter your AWS credentials.\"\n\n print \"Access Key ID: \"\n user = ask\n\n print \"Secret Access Key: \"\n password = ask_for_password\n\n return [user, password]\n end", "title": "" }, { "docid": "65fde73c127f86d250adf1bb7668f892", "score": "0.5448317", "text": "def get_key_list\n read(Common::KEY) || Hash.new\n end", "title": "" }, { "docid": "0e252cdaf17f51846a21f88af727f73a", "score": "0.54392695", "text": "def keys(*args)\n @params.keys(*args)\n end", "title": "" }, { "docid": "0e252cdaf17f51846a21f88af727f73a", "score": "0.54392695", "text": "def keys(*args)\n @params.keys(*args)\n end", "title": "" }, { "docid": "ed2836794d482c4b6c1b119015745678", "score": "0.54379636", "text": "def connect_to_s3()\n\n Aws::S3::Client.new(\n access_key_id: ENV['S3_KEY'],\n secret_access_key: ENV['S3_SECRET'],\n region: ENV['AWS_REGION'],\n force_path_style: ENV['PATH_STYLE']\n )\n \nend", "title": "" }, { "docid": "ad2b745f0e5da978a8961eeb08336fde", "score": "0.5437934", "text": "def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end", "title": "" }, { "docid": "a193f6b3665168d3f5c69ece1ebd7bc0", "score": "0.54336876", "text": "def get_keys\n @encryption_io.get_keys\n end", "title": "" }, { "docid": "97a49ccca4607499e6eda2fee8d97381", "score": "0.54245013", "text": "def strong_params_keys\n [key]\n end", "title": "" }, { "docid": "1cad30f43e69aaa89da92ea6ff2ea507", "score": "0.5419014", "text": "def keys\n [ name ]\n end", "title": "" }, { "docid": "2bc2129b6c863eaf45805661ec324643", "score": "0.54144657", "text": "def [](aws_name)\n registry[aws_name]\n end", "title": "" }, { "docid": "04c8328e1651fe416f66ec82bffa8d47", "score": "0.5409883", "text": "def key_types; end", "title": "" }, { "docid": "04c8328e1651fe416f66ec82bffa8d47", "score": "0.5409883", "text": "def key_types; end", "title": "" }, { "docid": "4aa40fc14ff899d17b441facaa7cec17", "score": "0.54094434", "text": "def get_ssh_keys\n get(\"tenants/#{tenant}\")[\"sshKeys\"]\n end", "title": "" }, { "docid": "b33817b4ca5570354aae6d2be4c1de95", "score": "0.5399796", "text": "def list_prepared_dumps\n require 's3'\n service = S3::Service.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key)\n bucket = service.buckets.find(\"cocoapods-org-testing-dumps\")\n bucket.objects.each do |obj|\n puts obj.key\n end\n end", "title": "" }, { "docid": "9a6bf49fe6118c34072f7924a58ad4c7", "score": "0.53936964", "text": "def key_field\n 'key'\n end", "title": "" }, { "docid": "2572b7082ee8c02c329abc9db236cba0", "score": "0.53903586", "text": "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n kms_master_key_id = '9041e78c-7a20-4db3-929e-828abEXAMPLE'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if default_bucket_encryption_sse_cmk_set?(\r\n s3_client,\r\n bucket_name,\r\n kms_master_key_id\r\n )\r\n puts 'Default encryption state set.'\r\n else\r\n puts 'Default encryption state not set.'\r\n end\r\nend", "title": "" }, { "docid": "7eb80c5492415b071b657a441f9f1143", "score": "0.5384631", "text": "def secrets=(_arg0); end", "title": "" }, { "docid": "7eb80c5492415b071b657a441f9f1143", "score": "0.5384631", "text": "def secrets=(_arg0); end", "title": "" }, { "docid": "ec161be72f39524ea525286cc445a588", "score": "0.53730917", "text": "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "title": "" }, { "docid": "ec161be72f39524ea525286cc445a588", "score": "0.53730917", "text": "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "title": "" }, { "docid": "10a6a1f98eee80935b45c2a539e8aa96", "score": "0.5369713", "text": "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "title": "" }, { "docid": "7f6d1847fe8291144301a8cb80ec0620", "score": "0.5367547", "text": "def read_key; end", "title": "" }, { "docid": "e8c83563d98bdae7e9875a3a28619bf2", "score": "0.536523", "text": "def ssh_keys(env, ids_only = false)\n account = env[:sl_client][\"SoftLayer_Account\"]\n acc_keys = sl_warden { account.object_mask(\"mask[id,label]\").getSshKeys }\n key_ids = []\n Array(env[:machine].provider_config.ssh_key).each do |key|\n pattern = key.is_a?(String) ? \"label\" : \"id\"\n key_hash = acc_keys.find { |acc_key| acc_key[pattern] == key }\n raise Errors::SLSshKeyNotFound, :key => key unless key_hash\n key_ids << key_hash[\"id\"]\n end\n return (ids_only ? key_ids : key_ids.map { |key_id| { :id => key_id } })\n end", "title": "" }, { "docid": "be796f2cf47426d670cdce5e227af9f6", "score": "0.5363687", "text": "def swf_access_key\n return Brevidy::Application::S3_ACCESS_KEY_ID\n end", "title": "" }, { "docid": "0696dea598ff93713bd080087d67468b", "score": "0.53607666", "text": "def keys\n end", "title": "" }, { "docid": "08b0601298b999b3e59bd698aec6c4e3", "score": "0.5353842", "text": "def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end", "title": "" }, { "docid": "adc754301ba2fed7960224e039ec77aa", "score": "0.53473365", "text": "def bucket; ::AWS::S3.new({ secure: true }).buckets[DC::SECRETS['bucket']]; end", "title": "" }, { "docid": "936e65259bbda067e75e659cce8bfba6", "score": "0.5345546", "text": "def check_service_params(service_params)\n service_keys = []\n [{ name: :aws, key: 'AWS_SERVICE_KEY' }, { name: :mongo, key: 'MONGO_DB_USERNAME' }].each do |key_data|\n key_index = service_params.index(key_data[:key])\n next if key_index.nil?\n key_value = get_key_value_for_param(key_data[:key], service_params)\n throw 'no value for this key key' if key_value.nil?\n service_keys.push(key_name: key_data[:name], key_value: key_value)\n end\n service_keys\n end", "title": "" }, { "docid": "0a3bc6faec332d316fa66060fb8c3b0d", "score": "0.53412193", "text": "def credentials\n {\n :provider => 'vsphere',\n :vsphere_username => new_resource.user,\n :vsphere_password => new_resource.password,\n :vsphere_server => new_resource.host,\n :vsphere_ssl => true,\n :vsphere_expected_pubkey_hash => new_resource.pubkey_hash\n }\nend", "title": "" } ]
7283303c2cf4661a024b951ee1ffccf9
Description: Sets the text of the text field withoud firing the events like onKeyPress, onKeyDown etc. This should not be used generally, but it is useful in situations where you need to set large text to the text field and you know that you don't have any event to be fired. Input: v Text to be set. def value=(v) assert_exists
[ { "docid": "5c785f11ac2b8b3022084de4fe7673d5", "score": "0.0", "text": "def doKeyPress( value )\r\n begin\r\n maxLength = @o.maxLength\r\n if (maxLength != -1 && value.length > maxLength)\r\n original_value = value\r\n value = original_value[0..maxLength]\r\n element.log \" Supplied string is #{suppliedValue.length} chars, which exceeds the max length (#{maxLength}) of the field. Using value: #{value}\"\r\n end\r\n rescue\r\n # probably a text area - so it doesnt have a max Length\r\n maxLength = -1\r\n end\r\n for i in 0..value.length-1 \r\n #sleep element.typingspeed # typing speed\r\n c = value[i,1]\r\n #element.log \" adding c.chr \" + c #.chr.to_s\r\n @o.value = \"#{(@o.value.to_s + c)}\" #c.chr\r\n @o.fireEvent(\"onKeyDown\")\r\n @o.fireEvent(\"onKeyPress\")\r\n @o.fireEvent(\"onKeyUp\")\r\n end\r\n \r\n end", "title": "" } ]
[ { "docid": "a485b5a650a9626051592a71de99177e", "score": "0.78700477", "text": "def set_Text(value)\n set_input(\"Text\", value)\n end", "title": "" }, { "docid": "a485b5a650a9626051592a71de99177e", "score": "0.78700477", "text": "def set_Text(value)\n set_input(\"Text\", value)\n end", "title": "" }, { "docid": "a485b5a650a9626051592a71de99177e", "score": "0.78700477", "text": "def set_Text(value)\n set_input(\"Text\", value)\n end", "title": "" }, { "docid": "1220c222df6dbb3d175b780437f65a62", "score": "0.73856217", "text": "def set_text(text_field_name, value_to_set)\r\n\r\n given_text_field = $browser.text_field(name: \"#{text_field_name}\")\r\n\r\n given_text_field.wait_until_present(2)\r\n given_text_field.set \"#{value_to_set}\"\r\n\r\n #Make sure the value set is retained in the text field\r\n begin\r\n value_after_set = given_text_field.value\r\n\r\n if value_after_set != value_to_set\r\n raise \"The attempt to set the text: #{value_to_set} in the text field #{text_field_name} was not successful. The text field contains #{value_after_set}\"\r\n end\r\n end\r\n\r\n end", "title": "" }, { "docid": "341edab1537167988e3603ac990efe57", "score": "0.7360695", "text": "def set(text)\n wait_until_exists\n @text_field.set(text)\n end", "title": "" }, { "docid": "848c804f204ffb02d2f2928e89667cd0", "score": "0.7013451", "text": "def text=(value)\n swt_widget&.text = value\n end", "title": "" }, { "docid": "8b72167271dac001a16be9ee40b2e3c4", "score": "0.6990627", "text": "def text=(value)\n # Value is frozen to prevent modification without updating the text on the\n # widget (i.e. mutation must be through this method)\n @text = value.clone.freeze\n\n gtk_instance.text = text\n end", "title": "" }, { "docid": "b6377b4afbdd10e1af1bb85daa727e3b", "score": "0.68918586", "text": "def set_text_box_value(id, value, timeout=nil)\r\n find_by_id_and_class(id, \"gwt-TextBox\", timeout) # so we get an error if it doesn't have the right type\r\n fill_in id, :with => value\r\n end", "title": "" }, { "docid": "db6381fd43df172e2ea0562f4f424f92", "score": "0.68328816", "text": "def text=(text)\n end", "title": "" }, { "docid": "9148f409480493cc8e67cb6066f53bd5", "score": "0.680297", "text": "def set_text(text); end", "title": "" }, { "docid": "03e41fba58d43b86d405311bffdb8a33", "score": "0.67801666", "text": "def text=(text)\n\t\tend", "title": "" }, { "docid": "3943ac4ecf8443e954599d875099ff29", "score": "0.67277837", "text": "def set_text_input(input); end", "title": "" }, { "docid": "dfa26273400492f4007b9e6d349f625a", "score": "0.66630054", "text": "def set_text(value)\n # https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n `#{@element}.textContent = #{value}`\n end", "title": "" }, { "docid": "4fb78cc7600d0a5b2ef284d72179f84c", "score": "0.66185266", "text": "def set_text(text)\n @text = text\n end", "title": "" }, { "docid": "11e137c71c73b2867bd897601b0fb385", "score": "0.65851504", "text": "def text=(val)\n return unless val # added 2010-11-17 20:11, dup will fail on nil\n # will bomb on integer or float etc !!\n #_set_buffer(val.dup)\n _set_buffer(val)\n end", "title": "" }, { "docid": "2965933437139e11e1341d58c2f9c756", "score": "0.65796274", "text": "def new_text=(value)\n @new_text = value\n end", "title": "" }, { "docid": "28e1cce7b6a8b76730fd09567bac35e4", "score": "0.6480315", "text": "def set_TextSearch(value)\n set_input(\"TextSearch\", value)\n end", "title": "" }, { "docid": "28e1cce7b6a8b76730fd09567bac35e4", "score": "0.6480315", "text": "def set_TextSearch(value)\n set_input(\"TextSearch\", value)\n end", "title": "" }, { "docid": "28e1cce7b6a8b76730fd09567bac35e4", "score": "0.6480315", "text": "def set_TextSearch(value)\n set_input(\"TextSearch\", value)\n end", "title": "" }, { "docid": "1432b534a9d58c7a0fa506a9db29907d", "score": "0.6459795", "text": "def set(name, value)\n set_text_content(name, 'input-field', @klass, value)\n end", "title": "" }, { "docid": "e0c4db485be55a2c7179709940204442", "score": "0.642809", "text": "def text(value)\n attributes[:text] = value\n end", "title": "" }, { "docid": "b0e6228ec979c59fd2a8769e5f687ed9", "score": "0.641208", "text": "def text_field_enter(value)\n control = @field.all(:css, 'input[type=\"text\"]').first\n control.set \"#{value}\"\n end", "title": "" }, { "docid": "75b3bc93d78681da8885cc597608fa70", "score": "0.63685054", "text": "def set_text_area_value(id, value, timeout=nil)\r\n input = normalizeInput(value)\r\n find_by_id_and_class(id, \"gwt-TextArea\", timeout) # so we get an error if it doesn't have the right type\r\n fill_in id, :with => input\r\n end", "title": "" }, { "docid": "081e71ce33cd600742a68afdb78af383", "score": "0.633026", "text": "def text_field(name, value = nil, options = {})\n\t\t\tset_class(options)\n\t\t\tsuper\n\t\tend", "title": "" }, { "docid": "bd93f08b548d2829ff8fea87cea7b032", "score": "0.6294451", "text": "def set_text(text)\n @text = text\n self\n end", "title": "" }, { "docid": "644e55c3480456ccc73fe46dae2cf1f3", "score": "0.6267217", "text": "def update_text_field(new_value)\n self.row.text_field.text = row_value\n end", "title": "" }, { "docid": "c0f4cc60c280e56d0809dce7e1927aa7", "score": "0.6239134", "text": "def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end", "title": "" }, { "docid": "bf262c7811e41b013f31db653bf31c5b", "score": "0.6236562", "text": "def set_text_content(name, tag, container, value)\n wait_visibility(name, tag, container).set(value)\n end", "title": "" }, { "docid": "274329272e51b9f9641ad027635ca9e8", "score": "0.6231985", "text": "def text(key, value)\n @form.setField(key.to_s, value.to_s) # Value must be a string or itext will error.\n end", "title": "" }, { "docid": "274329272e51b9f9641ad027635ca9e8", "score": "0.6231985", "text": "def text(key, value)\n @form.setField(key.to_s, value.to_s) # Value must be a string or itext will error.\n end", "title": "" }, { "docid": "8ae94b95b87140ba7ffe66ab50f39f5c", "score": "0.6202967", "text": "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", "title": "" }, { "docid": "5749bc2868736a703af57d44c191e36b", "score": "0.6187727", "text": "def update_text_field(new_value)\n self.row.text_field.text = row_value.to_s\n end", "title": "" }, { "docid": "4262a38fa624f78860077d5882d9be05", "score": "0.61853534", "text": "def set_field_value(name, value)\n\t\tend", "title": "" }, { "docid": "2cbc63223fcaca6b91b74172a52281fa", "score": "0.61743927", "text": "def text=(new_text)\n @text = new_text\n refresh\n update_cursor\n end", "title": "" }, { "docid": "44717a118b380ce9bd78ee3dc96e2a75", "score": "0.6170254", "text": "def search_for=(text)\n self.text_field(:id=>\"search_text\").set(\"#{text}\\n\")\n wait_for_ajax\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61641985", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61641985", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "609bdb2cdb181dc08b338db61761a0df", "score": "0.61621386", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "b84a69a0c360de37df52836b70caf23a", "score": "0.61572874", "text": "def set(value)\n @value = handler.sanitize(value)\n validate\n @value\n end", "title": "" }, { "docid": "7ba0d0797eec5b97400fc21ad2e2f741", "score": "0.6128226", "text": "def text(value)\n @doc << {:type => :text, :value => value}\n nil\n end", "title": "" }, { "docid": "0acf59e6541b5776ce37550a1cce56f7", "score": "0.6108245", "text": "def text(text)\n @text = text\n end", "title": "" }, { "docid": "717dd735b81b4a9c189af2ae809e0a3c", "score": "0.60762686", "text": "def set_SearchValue(value)\n set_input(\"SearchValue\", value)\n end", "title": "" }, { "docid": "4a40d15a87944ec81c280420e2ce898a", "score": "0.607182", "text": "def old_text=(value)\n @old_text = value\n end", "title": "" }, { "docid": "2f8d6af81d001a9276d1e9e2b0436a96", "score": "0.5999345", "text": "def input=(input_text)\n engine.input = input_text\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "6bd0c1c93c8a065dfef1f2b6c9664d6a", "score": "0.599591", "text": "def set_Username(value)\n set_input(\"Username\", value)\n end", "title": "" }, { "docid": "742079ab11fbad0439ecf1471d81bb55", "score": "0.59854245", "text": "def set_search_field_value value\n search_field = SearchField.new(\"\", \"#{@locator}/ancestor::div[div[@class='toolbar']]/div[@class='toolbar']\")\n search_field.clear_value\n search_field.set_value(value)\n end", "title": "" }, { "docid": "742079ab11fbad0439ecf1471d81bb55", "score": "0.59854245", "text": "def set_search_field_value value\n search_field = SearchField.new(\"\", \"#{@locator}/ancestor::div[div[@class='toolbar']]/div[@class='toolbar']\")\n search_field.clear_value\n search_field.set_value(value)\n end", "title": "" }, { "docid": "9a6ea415e166c4019f45ea50920f99be", "score": "0.5985046", "text": "def text=(text); end", "title": "" }, { "docid": "4cd2903d266c6fe0db21eb2c7350e80f", "score": "0.5984772", "text": "def text=(text)\n @text = normalize_text text\n self.key= @original_key if @original_key\n end", "title": "" }, { "docid": "79230b8f72cc80cf7abc2fd77c2b8ba3", "score": "0.5978023", "text": "def set_text( *args )\n value = args.pop\n elements = args\n\n value_node = build_document_tree( elements )\n modified_node = build_document_tree( elements, self.modified_document ) if self.modified_document\n\n value_node.text = value\n modified_node.text = value if self.modified_document\n end", "title": "" }, { "docid": "c20420dc74d6946bb7d239c1ad276831", "score": "0.59716654", "text": "def text_field; end", "title": "" }, { "docid": "50eabf64cf97a97b23a585d7ffbb047c", "score": "0.5971118", "text": "def set_value( value )\n @value = value \n end", "title": "" }, { "docid": "052fd5445275168e50295e6b6152d8ef", "score": "0.59550667", "text": "def value=(value)\n case tag_name\n when \"textarea\"\n @_node.setText(\"\")\n type(value)\n when \"input\"\n if file_input?\n @_node.setValueAttribute(value)\n else\n @_node.setValueAttribute(\"\")\n type(value)\n end\n end\n end", "title": "" }, { "docid": "60ded32966c049897a7bfd8fe47b08cc", "score": "0.59414154", "text": "def set(value)\n wait_for_exists\n @alert.send_keys(value)\n end", "title": "" }, { "docid": "addb9f1423107ef354957f51ba7a3d61", "score": "0.5935712", "text": "def setTextBoxValue(element_id, val)\n @driver.find_element(:id, element_id).clear()\n EnziUIUtility.setValue(@driver, :id, element_id, val)\n end", "title": "" }, { "docid": "2eceef5072f7b8b0a802355380db6d4a", "score": "0.5931481", "text": "def text val\n string =<<-EOL\n $('##{@id}').text(#{val.inspect})\n EOL\n @app.dom_on_sockets.execute string\n end", "title": "" }, { "docid": "0c4ed7e549b9a5734c979463586e843f", "score": "0.5918195", "text": "def set(args, auto_compute=true)\n initialize_text(args[:value]) if args && args[:value]\n super(args, auto_compute)\n end", "title": "" }, { "docid": "f0f01756da1b5ad9b8d986874a063382", "score": "0.59065306", "text": "def text=(text)\n @label.text = text\n end", "title": "" }, { "docid": "3a38a94a6910555167dbfd805d537f82", "score": "0.58992225", "text": "def set_CommentText(value)\n set_input(\"CommentText\", value)\n end", "title": "" }, { "docid": "3a38a94a6910555167dbfd805d537f82", "score": "0.58992225", "text": "def set_CommentText(value)\n set_input(\"CommentText\", value)\n end", "title": "" }, { "docid": "4d3e730ee4be61d3ccd11c8e918f8916", "score": "0.58907807", "text": "def set_value value\n if allows? value\n @set_value_handler.call value\n end\n end", "title": "" }, { "docid": "96e73eb8b9898f80b4fb7eaad444e893", "score": "0.58902043", "text": "def value=(value)\n `#{@element}.value = #{value}`\n end", "title": "" }, { "docid": "0d5d5532991a58be2ecddf4381a54338", "score": "0.58854854", "text": "def value\n wait_until_exists\n @text_field.value\n end", "title": "" }, { "docid": "d80bbe4bf4e5ab960697e1faba614b6c", "score": "0.58362615", "text": "def text=(value)\n @peer.text = value.to_s\n end", "title": "" }, { "docid": "b7be377bf77dcf0c38f9410eaf70d967", "score": "0.5834322", "text": "def enter_text_with_id(textfield_id, value)\n dump_caller_stack\n operation_delay\n text_field(:id, textfield_id).set(value)\n end", "title": "" }, { "docid": "f2ed4664b4d78973bfd720b8f78d8c4c", "score": "0.5823669", "text": "def input_model_text(new_text)\n pending(\"proper input text method that triggers all normal events\")\n fail\n end", "title": "" }, { "docid": "88a834ba1fabb55f89cda583aae5e2c6", "score": "0.58223134", "text": "def edit_text_field(id, val)\n Log.logger.info(\"Editing #{val} in the Textfield.\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n temp = wait.until { @browser.find_element(:xpath => \"//*[@id = '#{id}']\") }\n temp.clear\n temp.send_keys(val) # By using * we can edit three fields at one go.\n end", "title": "" }, { "docid": "b2ee8af073e57e9eba217993c4129bfc", "score": "0.5821294", "text": "def value=(value)\n `#{@el}.value = #{value}`\n end", "title": "" }, { "docid": "a748f87b80b777ca70d43726845c450c", "score": "0.5818004", "text": "def set_text_input(id, text)\n touch(\"ReactEditText tag:'#{id}'\")\n wait_for_keyboard\n enter_text \"* tag:'#{id}'\", text\n hide_soft_keyboard\n sleep(1)\nend", "title": "" }, { "docid": "ce93b6c8de8e3db0f93cdbf3078b3dcf", "score": "0.5806693", "text": "def set_Title(value)\n set_input(\"Title\", value)\n end", "title": "" } ]
8aeb9e307183caa3ad07d4e6b3005d9c
Coerce schema into a Attribute> Hash
[ { "docid": "6dba62c28fbfd53cacf590d59cee494c", "score": "0.59598845", "text": "def to_h\n each_with_object({}) { |attr, h| h[attr.name] = attr }\n end", "title": "" } ]
[ { "docid": "a24b8119a869dc24d077daf2da5e036b", "score": "0.7160926", "text": "def to_input_hash\n HASH_SCHEMA.schema(\n map { |attr| [attr.name, attr.to_write_type] }.to_h\n )\n end", "title": "" }, { "docid": "ba0ad4b0d649b5f14e6e73a6dd99294b", "score": "0.71596164", "text": "def schema_attributes_hash\n @schema_attributes_hash || set_schema_attributes\n @schema_attributes_hash\n end", "title": "" }, { "docid": "70ccb46a8ee837f2bc6ea971d73900e0", "score": "0.7099736", "text": "def attributes_hash(element)\n schema[element.to_sym]\n end", "title": "" }, { "docid": "b0d9269de09c3b0d6ada544161bf0f63", "score": "0.67581064", "text": "def to_output_hash\n HASH_SCHEMA.schema(\n map { |attr| [attr.key, attr.to_read_type] }.to_h\n )\n end", "title": "" }, { "docid": "ea4d5e37c1419f6986bc075669fc75d2", "score": "0.6619872", "text": "def attributes_from(struct)\n extracted_schema = struct.schema.keys.map { |key|\n if key.required?\n [key.name, key.type]\n else\n [:\"#{key.name}?\", key.type]\n end\n }.to_h\n attributes(extracted_schema)\n end", "title": "" }, { "docid": "62fd1dd8c9e7b297e1ba5f2110dd38cb", "score": "0.6519796", "text": "def default_attributes_from_schema\n Hash[attributes_schema.collect { |attribute_name, field| \n [attribute_name, field.default]\n }]\n end", "title": "" }, { "docid": "b99a8d28ebf95f9ecbdab90e5b603f03", "score": "0.65133595", "text": "def attributes\n if !@attributes\n @attributes = {}\n schema['properties'].each do |key, prop|\n type = prop['type'] == 'array' ? ARRAY_TYPES[key] : prop['type']\n @attributes[key] = {\n :name => key,\n :type => type,\n :description => prop['description'],\n :required => schema['required'].include?(key)\n }\n end\n end\n @attributes\n end", "title": "" }, { "docid": "7cf1967e1d74a69c881f173fba467153", "score": "0.6512663", "text": "def to_output_hash\n Types::Hash\n .schema(map { |attr| [attr.key, attr.to_read_type] }.to_h)\n .with_key_transform(&:to_sym)\n end", "title": "" }, { "docid": "77fff044a6f538dc817f6a48f6206f4f", "score": "0.6465351", "text": "def _attributes\n @_attributes ||= {}.merge(@schema.attributes)\n end", "title": "" }, { "docid": "59da233c0819547261f3a060e06a8ce3", "score": "0.64286274", "text": "def to_hash\n \thash = {}; self.attributes.each { |k,v| hash[k] = v }\n return hash\n end", "title": "" }, { "docid": "b683e7e778d8e608d7d2e5fd3b3b54a5", "score": "0.6388414", "text": "def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = send(key)\n hash[key] = hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end", "title": "" }, { "docid": "851118c2a5369a40875830bbd8d1c443", "score": "0.6382164", "text": "def set_schema_attributes\n @schema_attributes_array = []\n @schema_attributes_hash = {}\n UCB::LDAP::Schema.schema_hash[entity_name][\"attributes\"].each do |k, v|\n sa = UCB::LDAP::Schema::Attribute.new(v.merge(\"name\" => k))\n @schema_attributes_array << sa\n [sa.name, sa.aliases].flatten.each do |name|\n @schema_attributes_hash[canonical(name)] = sa\n end\n end\n rescue\n raise \"Error loading schema attributes for entity_name '#{entity_name}'\"\n end", "title": "" }, { "docid": "bc2fd96c849c6b4439116674ff93736f", "score": "0.63768786", "text": "def attr_hash\n Hash[attributes.map {|k, v| [k.to_s, v.to_s]}]\n end", "title": "" }, { "docid": "41e37e144b805670a09f83ac66c1e9db", "score": "0.63291657", "text": "def to_hash\n @raw_attributes.each do |k, v|\n unless @attributes.key? k\n @sorted = false unless @attributes.empty?\n type = @types[k]\n @attributes[k] = ActiveModel::Type::String === type ? @raw_attributes[k] : type.deserialize(v)\n end\n end\n\n sort_attributes!\n end", "title": "" }, { "docid": "8c89818bff9172147dea50e344e9573c", "score": "0.6299829", "text": "def to_hash; @attributes; end", "title": "" }, { "docid": "8c89818bff9172147dea50e344e9573c", "score": "0.6299829", "text": "def to_hash; @attributes; end", "title": "" }, { "docid": "b7a18451444d5a5f35695768ff68ba92", "score": "0.62861335", "text": "def attributes_for_api\n # by default, filter out nil elements\n hash = objects_to_attributes(@attributes.reject { |k,v| v.nil? }.with_indifferent_access)\n # and anything not included in the schema\n hash.reject! { |k,v| !schema.include?(k) } unless schema.nil?\n hash\n end", "title": "" }, { "docid": "471df942c67a5b0c4003b1fee6ac8bd2", "score": "0.6265462", "text": "def json_schema\n attributes.slice(*important_fields)\n .map { |field, metadata| [field, \"<#{displayed_type(field, metadata[:type])}>\"] }\n .to_h\n end", "title": "" }, { "docid": "92f10c9d4adb4f821fb7a459dc9a6ebe", "score": "0.62491333", "text": "def schema\n attr = {}\n attributes.each{|x,y| attr[x] = y[:type]}\n {:table => table_name, :attributes => attr, :primary_key => get_primary_key}\n end", "title": "" }, { "docid": "d256edb415273d5591949554543bf11b", "score": "0.6234808", "text": "def hash\n attributes.values.reduce { |a, e| a.to_s + e.to_s }.hash\n end", "title": "" }, { "docid": "3550197d8c601f4e9d3f9f919912394d", "score": "0.62191033", "text": "def to_hash(keys = :underscore)\n hash = super(keys)\n hash[get_attribute_key('columns', keys)] =\n columns_to_hash(COLUMNS, columns, keys)\n if filter\n hash[get_attribute_key('filter', keys)] =\n filter_to_hash(FILTERS, keys)\n end\n hash[get_attribute_key('scope', keys)] = scope_to_hash(keys)\n hash[\"@xsi:type\"] = type_attribute_for_soap\n return hash.compact\n end", "title": "" }, { "docid": "4c1d3947cd14a5e826d3e56774841ad9", "score": "0.6216626", "text": "def to_hash(keys = :underscore)\n\t\t\thash = super(keys)\n\t\t\thash[get_attribute_key('columns', keys)] =\n\t\t\t\tcolumns_to_hash(COLUMNS, columns, keys)\n\t\t\thash[get_attribute_key('filter', keys)] =\n\t\t\t\tfilter_to_hash(FILTERS, keys)\n\t\t\thash[get_attribute_key('scope', keys)] = scope_to_hash(keys)\n\t\t\thash[\"@xsi:type\"] = type_attribute_for_soap\n\t\t\treturn hash\n\t\tend", "title": "" }, { "docid": "28066c51b0323e5fbf8ad5a5308da88e", "score": "0.6199572", "text": "def convert(payload)\n attributes = {}\n @decoder.schema_fields.each do |field|\n column = @klass.columns.find { |c| c.name == field.name }\n next if column.nil?\n next if %w(updated_at created_at).include?(field.name)\n\n attributes[field.name] = _coerce_field(column, payload[field.name])\n end\n attributes\n end", "title": "" }, { "docid": "f60d7993cf451e03c2105c1c4e54a9f8", "score": "0.61795175", "text": "def schema\n defaults = {\n :\"db/cardinality\" => :\"db.cardinality/one\",\n :\"db.install/_attribute\" => :\"db.part/db\"\n }\n\n schema_array = @attributes.reduce([]) do |schema, (attribute, opts)|\n opts = opts.dup\n value_type = opts.delete(:value_type)\n\n unless opts.empty?\n opts[:cardinality] = namespace(\"db.cardinality\", opts[:cardinality])\n opts[:unique] = namespace(\"db.unique\", opts[:unique]) if opts[:unique]\n opts = opts.map { |k, v|\n k = namespace(\"db\", k)\n [k, v]\n }\n opts = Hash[*opts.flatten]\n end\n\n schema << defaults.merge({\n :\"db/ident\" => namespace(prefix, attribute),\n :\"db/valueType\" => value_type(value_type),\n :\"db/id\" => tempid(:\"db.part/db\")\n }).merge(opts)\n end\n enum_schema = [\n :\"db/add\", tempid(:\"db.part/user\"), :\"db/ident\"\n ]\n prefix = self.to_s.underscore\n @enums.each do |key, values|\n values.each do |value|\n ident_value = :\"#{prefix}.#{key.downcase}/#{value.to_s.sub(/_/, \"-\").downcase}\"\n es = [:\"db/add\", tempid(:\"db.part/user\"), :\"db/ident\", ident_value]\n schema_array << es\n end\n end\n schema_array\n end", "title": "" }, { "docid": "99d39b50d978af5eb3d686d977ecf039", "score": "0.6178255", "text": "def to_hash\n {}.tap do |hash|\n _attributes.each do |key, value|\n hash[key] = value.respond_to?(:to_hash) ? value.to_hash : value\n end\n end\n end", "title": "" }, { "docid": "5bb8336cfc27c753c8d3f81168d740ca", "score": "0.61760604", "text": "def to_attr_hash\n to_hash.reject { |key, _| [:id].include? key }\n end", "title": "" }, { "docid": "3d43511c8f56041c826dc744a4755278", "score": "0.61733574", "text": "def schema\n self.class.schema || self.attributes\n end", "title": "" }, { "docid": "1163c587d2891ae278d66b292f96f6a4", "score": "0.6143026", "text": "def attrs\n hash = Hashx.new\n each do |k, v|\n hash[k] = v unless v.is_a? Enumerable\n end\n hash\n end", "title": "" }, { "docid": "3a8073caeca72ae60b78e0ebaac3612b", "score": "0.61312306", "text": "def to_h\n # TODO remove this symbolization when we'll support Ruby 2.2+ only\n Utils::Hash.new(\n @attributes\n ).deep_dup.symbolize!.to_h\n end", "title": "" }, { "docid": "b3ce66c37ca330b863ee7462dfd03091", "score": "0.6127277", "text": "def to_hash\n attributes.map { |attribute, value|\n field = self.class.fetch_comment_field(attribute)\n value = serialize_value_api(field, value)\n\n [field.name, value]\n }.to_h\n end", "title": "" }, { "docid": "8a4c399d2f850a7a4f0b6b49022b5306", "score": "0.6124669", "text": "def hash\n @hash ||= attributes.hash\n end", "title": "" }, { "docid": "24c7272e893853422fd2e79987f20470", "score": "0.6120942", "text": "def attributes_db_raw_data_hash(only_attr_names = [])\n values = Hash.new\n\n attributes_schema.each do |attr_name, orm_field|\n next unless only_attr_names.empty? || only_attr_names.include?(attr_name)\n values[orm_field.column] = orm_field.encode(send(attr_name))\n end\n\n values\n end", "title": "" }, { "docid": "24e7575f680ce5c518927ddde9aebf38", "score": "0.61133945", "text": "def to_hash(keys = :underscore)\n\t\t\thash = super(keys)\n\t\t\thash[get_attribute_key('columns', keys)] =\n\t\t\t\tcolumns_to_hash(COLUMNS, columns, keys)\n\t\t\thash[get_attribute_key('filter', keys)] =\n\t\t\t\tfilter_to_hash(FILTERS, keys)\n\t\t\thash[get_attribute_key('scope', keys)] = scope_to_hash(keys)\n\t\t\thash[get_attribute_key('max_rows', keys)] = max_rows if max_rows\n\t\t\thash[get_attribute_key('sort', keys)] = sort_to_hash(keys) if sort\n\t\t\thash[\"@xsi:type\"] = type_attribute_for_soap\n\t\t\treturn hash\n\t\tend", "title": "" }, { "docid": "f5e7793b6182a8ff38857d715d8cc0b2", "score": "0.61100525", "text": "def to_hash\n @attributes.to_hash\n end", "title": "" }, { "docid": "4cd7089d1535b4ecee1f1e0c50c86690", "score": "0.6103776", "text": "def to_hash\n hash = Hash.new\n self.class::ATTR_LIST.each do |attr, metadata|\n if (newval = self.method(attr).call)\n if (newval.is_a?(Array))\n newval = newval.collect do |x|\n if (x.methods.include?(\"to_hash\"))\n x.to_hash\n else\n x\n end\n end\n elsif (newval.methods.include?(\"to_hash\"))\n newval = newval.to_hash\n end\n hash[attr.to_s] = newval \n end\n end\n hash\n end", "title": "" }, { "docid": "0792a61a0a63d2c1677f6ebb415a3adf", "score": "0.60969925", "text": "def to_dynamo_value_hash\n self.attributes.each_with_index({}) do |k, v|\n self.class.columns[k].to_dynamo_value_hash(v)\n end\n end", "title": "" }, { "docid": "06638afbdf6172f390d51ebcb83bd736", "score": "0.6086619", "text": "def to_h\n h = {}\n self._attribute_keys.each do |attr_key|\n attr_val = self.send attr_key\n if attr_val.is_a? Array\n h[attr_key] = []\n\n attr_val.each do |_attr_val|\n h[attr_key] << (_attr_val.is_a?(FieldSet) ? _attr_val.to_h : _attr_val.value )\n end\n else\n if !attr_val.is_a?(FieldSet) && attr_val.nil?\n puts \"#{@_full_name} expected value for #{attr_key} in hash, but none found\"\n next\n end\n h[attr_key] = (attr_val.is_a?(FieldSet) ? attr_val.to_h : attr_val.value )\n end\n end\n h\n end", "title": "" }, { "docid": "25e4f281e847a971d6293df6d9a9c82e", "score": "0.60729504", "text": "def as_hash\n attributes.merge(type: self.class.to_s)\n end", "title": "" }, { "docid": "b87a9298d2dba3177480811483d6441d", "score": "0.60660344", "text": "def encode_attributes(record, cql)\n encoded = {}\n Types::DirtyCollection.ignore_modifications do\n record.changed.each do |column_name|\n value = record.read_attribute(column_name)\n encoded[column_name.to_s] = cql ? attribute_definitions[column_name].type_cast_for_cql3(value) :\n attribute_definitions[column_name].type_cast_for_solr(value)\n end\n end\n encoded\n end", "title": "" }, { "docid": "243663af3e2353f5700e0b51e5a1a7ec", "score": "0.6058103", "text": "def to_hash #:nodoc:\n self.class.serialized_attributes.inject({}) do |hash, attr|\n hash[attr] = send(attr).to_s\n hash\n end\n end", "title": "" }, { "docid": "4f3546d7fd38580a45c700a229d7bb9b", "score": "0.60493064", "text": "def split_attribute_hash(attributes)\n assit_kind_of(Hash, attributes)\n db_attributes = {}\n semantic_attributes = {}\n attributes.each do |field, value|\n if(db_attr?(field))\n db_attributes[field] = value\n elsif(defined_property?(field))\n semantic_attributes[field] = value\n else\n semantic_attributes[expand_uri(field)] = value\n end\n end\n { :semantic_attributes => semantic_attributes, :db_attributes => db_attributes }\n end", "title": "" }, { "docid": "2651ab6ad1c335ed3d781345fe87e2c6", "score": "0.6043937", "text": "def to_hash\n hash = {:name => @name.to_s}\n\n if Kiwi::Validator === self.type\n hash[:attributes] = self.type.v_attributes.values.map{|attr| attr.to_hash}\n hash[:type] = '_embedded'\n else\n hash[:type] = self.type.to_s\n end\n\n hash[:values] = @values.map do |h|\n h.merge(:value => h[:value].to_s)\n end if @values\n\n hash[:desc] = @desc if @desc\n hash[:default] = @default.to_s if @has_default\n hash[:collection] = @collection if @collection\n hash[:optional] = @optional if @optional\n hash\n end", "title": "" }, { "docid": "d64a2d3731b78466f2e4c0a00d5045fa", "score": "0.6041785", "text": "def attr_map(schema)\n @log.debug \"#{__method__} called by #{caller_locations(1, 1)[0].label}\"\n attrs_camel = [ 'objectClass' ]\n attrs_camel.concat(schema['must'].map { |s| s.sub(/^@/, '') })\n attrs_camel.concat(schema['may'].map { |s| s.sub(/^@/, '') })\n Hash[attrs_camel.map { |s| [s.downcase.to_sym, s.to_sym ] }]\n end", "title": "" }, { "docid": "581b28884d4d3f2deb826bdc5ec3c69b", "score": "0.60394895", "text": "def to_hash\n hash = super\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "581b28884d4d3f2deb826bdc5ec3c69b", "score": "0.60394895", "text": "def to_hash\n hash = super\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "781540104debf198e1ada64132b15d58", "score": "0.60392064", "text": "def schema\n s = @gapi[\"schema\"]\n s = s.to_hash if s.respond_to? :to_hash\n s = {} if s.nil?\n s\n end", "title": "" }, { "docid": "e4adebe545f068846e6867fe3dc8cf62", "score": "0.6037764", "text": "def attributes_hash; end", "title": "" }, { "docid": "09819f5042ed8b458bd8466ebe2cada6", "score": "0.6011478", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "09819f5042ed8b458bd8466ebe2cada6", "score": "0.6011478", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "a80a338878b2d86ac49ec80837a2298b", "score": "0.60062546", "text": "def to_h\n self\n .class\n .dry_initializer\n .attributes(self)\n .each_with_object({}) { |(k, v), h| h[k.to_s] = __hashify(v) }\n end", "title": "" }, { "docid": "ff4260191086a60c978959f46126ae4b", "score": "0.6000842", "text": "def to_hash\n hash = {}\n MoBaseComplexType.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = MoBaseComplexType.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "4a5945549359a60a38fe11c64d4f5a45", "score": "0.5999239", "text": "def to_hash\n _to_hash(@attributes)\n end", "title": "" }, { "docid": "929f9cf53ec6bb414d793d453b0d0161", "score": "0.59973973", "text": "def coerce(payload)\n result = {}\n self.schema_fields.each do |field|\n name = field.name\n next unless payload.key?(name)\n\n val = payload[name]\n result[name] = coerce_field(field, val)\n end\n result.with_indifferent_access\n end", "title": "" }, { "docid": "b8299d101f020e1b2616a4eaf64a1c35", "score": "0.5997346", "text": "def build_attributes(relation, mapping)\n schema = relation.schema.to_h\n schema.each_with_object({}) do |(attribute, type), result|\n attribute = mapping.translate(attribute) if mapping.reverse?\n result[attribute] = coercible(type)\n end\n end", "title": "" }, { "docid": "50dff8bed4e1ebe07b4b11892673f2cc", "score": "0.598912", "text": "def to_hash\n self.attributes.to_hash\n end", "title": "" }, { "docid": "50dff8bed4e1ebe07b4b11892673f2cc", "score": "0.598912", "text": "def to_hash\n self.attributes.to_hash\n end", "title": "" }, { "docid": "50dff8bed4e1ebe07b4b11892673f2cc", "score": "0.598912", "text": "def to_hash\n self.attributes.to_hash\n end", "title": "" }, { "docid": "50dff8bed4e1ebe07b4b11892673f2cc", "score": "0.598912", "text": "def to_hash\n self.attributes.to_hash\n end", "title": "" }, { "docid": "fce515a4258e56939a4ca796c98b0dbf", "score": "0.59682894", "text": "def to_hash\r\n hash = {}\r\n\r\n instance_variables.each do |var|\r\n key = var.to_s.delete(\"@\").to_sym\r\n val = instance_variable_get(var)\r\n\r\n if authlete_model_simple_attribute?(key) or val.nil?\r\n hash[key] = val\r\n elsif key == :attributes or key == :descriptions\r\n hash[key] = val.map { |element| element.to_hash }\r\n end\r\n end\r\n\r\n hash\r\n end", "title": "" }, { "docid": "548a457a441f9e02111ee448c9efe38e", "score": "0.596459", "text": "def attribute_definitions\n # Keys for hash/range/secondary\n # S | N | B\n #{:attribute_name => , :attribute_type => }\n\n keys = []\n keys << hash_key[:attribute_name]\n keys << range_key[:attribute_name] if range_key\n local_secondary_indexes.each do |lsi|\n keys << lsi[:key_schema].select{|h| h[:key_type] == \"RANGE\"}.first[:attribute_name]\n end\n\n global_secondary_indexes.each do |lsi|\n lsi[:key_schema].each do |a|\n keys << a[:attribute_name]\n end\n end\n\n definitions = keys.uniq.collect do |k|\n attr = self.attributes[k.to_s]\n {\n :attribute_name => attr.name,\n :attribute_type => attribute_type_indicator(attr.type)\n }\n end\n end", "title": "" }, { "docid": "e82f8bd864a137376d8261d424cadda1", "score": "0.5956971", "text": "def to_hash\n Hash[@attributes.map { |k, v| [k, v.is_a?(Entity) ? v.to_hash : v] }]\n end", "title": "" }, { "docid": "1912d37c7c628197c506b7bda30c9295", "score": "0.5953328", "text": "def to_hash\n return if dump_attributes.empty?\n {}.tap do |hash|\n dump_attributes.each do |attribute|\n value = send(attribute)\n hash[attribute] = value if value\n end\n end\n end", "title": "" }, { "docid": "a477b3d7c5e970c106b382d62e6d5d00", "score": "0.5948135", "text": "def to_h\n attributes.map do |k, v|\n [k, self.class.value_to_h(v)]\n end.to_h\n end", "title": "" }, { "docid": "31c921980905326fe79156539cd9975c", "score": "0.5944052", "text": "def to_hash\n attrs = attributes\n attrs.delete_if { |_, value| value.nil? }\n\n attrs\n end", "title": "" }, { "docid": "58d7aa12e9121dc330509621af3c2316", "score": "0.5943683", "text": "def encode_attributes(record, cql, attributes = {})\n encoded = {}\n Types::DirtyCollection.ignore_modifications do\n if attributes.empty?\n record.send(cql ? 'changed' : 'column_names').each do |column_name|\n attributes[column_name] = record.read_attribute(column_name)\n end\n end\n attributes.each do |k, v|\n encoded[k.to_s] = cql ? attribute_definitions[k].type_cast_for_cql3(v) :\n attribute_definitions[k].type_cast_for_solr(v)\n end\n end\n encoded\n end", "title": "" }, { "docid": "5c2de39834cc5ab0c3bf52ad93e7fbde", "score": "0.5940113", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "5c2de39834cc5ab0c3bf52ad93e7fbde", "score": "0.5940113", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "073c0b0742c1e75e6994ef6f8099887f", "score": "0.5938088", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "073c0b0742c1e75e6994ef6f8099887f", "score": "0.5938088", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n\n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "ab05195d0fb2e8ee4d0e8a2454232882", "score": "0.593518", "text": "def property_schema_hash(property, model)\n schema = super\n schema[:sequence_name] = sequence_name(model, property) if property.serial?\n\n # TODO: see if TypeMap can be updated to set specific attributes to nil\n # for different adapters. scale/precision are perfect examples for\n # Postgres floats\n\n # Postgres does not support scale and precision for Float\n if property.primitive == Float\n schema.delete(:scale)\n schema.delete(:precision)\n end\n\n schema\n end", "title": "" }, { "docid": "448cddb723c4d1024bd1b66de05608a7", "score": "0.5927261", "text": "def to_hash\n attributes\n end", "title": "" }, { "docid": "448cddb723c4d1024bd1b66de05608a7", "score": "0.5927261", "text": "def to_hash\n attributes\n end", "title": "" }, { "docid": "4e793472d01c790a5fe986211cf20cbc", "score": "0.59272164", "text": "def schema\n ensure_full_data!\n s = @gapi[\"schema\"]\n s = s.to_hash if s.respond_to? :to_hash\n s = {} if s.nil?\n s\n end", "title": "" }, { "docid": "4e793472d01c790a5fe986211cf20cbc", "score": "0.59272164", "text": "def schema\n ensure_full_data!\n s = @gapi[\"schema\"]\n s = s.to_hash if s.respond_to? :to_hash\n s = {} if s.nil?\n s\n end", "title": "" }, { "docid": "4e793472d01c790a5fe986211cf20cbc", "score": "0.59272164", "text": "def schema\n ensure_full_data!\n s = @gapi[\"schema\"]\n s = s.to_hash if s.respond_to? :to_hash\n s = {} if s.nil?\n s\n end", "title": "" }, { "docid": "2d982c7d08d4808a0c6c5c59a9e688e1", "score": "0.5927202", "text": "def hash_for_serialization\n self.class.schema.keys.map(&:name).each.with_object(to_h) do |k, ret|\n ret[k] = nil unless ret.key?(k)\n end.merge(created_at: created_at&.iso8601(6))\n end", "title": "" }, { "docid": "f8577cc028e3ef4dcefedf3a4ed8424b", "score": "0.59181124", "text": "def to_h\n Utils.deep_dup @attributes\n end", "title": "" }, { "docid": "136951e28aa22fda94a47d3e02f243c1", "score": "0.591512", "text": "def to_h\n attributes.deep_dup\n end", "title": "" }, { "docid": "94670d098949faa8c14d3c99b30e1b6a", "score": "0.59129584", "text": "def info\n info = SCHEMA_ATTRIBUTES.inject({}) do |hash,attribute|\n hash[attribute] = send(attribute) if respond_to?(attribute)\n hash\n end\n info\n end", "title": "" }, { "docid": "5acde953948fa9831113f944ae77a86b", "score": "0.5911747", "text": "def attributes_to_hash(hash={})\r\n each_attr { |attr| hash[attr.name] = attr.value }\r\n hash\r\n end", "title": "" }, { "docid": "3e0cf5cee0f5682b18f1f465b509eaed", "score": "0.59054065", "text": "def to_h\n Utils::Hash.deep_dup(attributes)\n end", "title": "" }, { "docid": "75a40c67e00457c8d58c35058904dbe9", "score": "0.5899115", "text": "def to_h\n @attributes.to_h\n end", "title": "" }, { "docid": "47c5cc14e6b1d417f78abee1ef90a0a2", "score": "0.58962834", "text": "def to_h\n attributes.each_with_object({}) { |(key, value), hash| hash[key.to_s] = value.to_s }\n end", "title": "" }, { "docid": "69d4f72a756a831f58a8bfd46072537f", "score": "0.58956414", "text": "def attributes\n attributes = _attributes.dup\n attributes.typecast! unless _attributes.frozen?\n attributes.to_h\n end", "title": "" }, { "docid": "5f26c38cb94735284e43f522176346c3", "score": "0.588437", "text": "def to_hash\n Hash[ attributes.zip attributes.map{ |key| send key.to_sym } ].merge!({ 'id' => id })\n end", "title": "" }, { "docid": "a35cafc36ddb219ccf0880db79303298", "score": "0.5878637", "text": "def to_hash\n serialized_attributes = attributes.dup\n\n self.class.expandable_attributes.each_pair.select do |attribute_name, expanded_class|\n if expanded_class === attributes[attribute_name]\n serialized_attributes[attribute_name] = serialized_attributes[attribute_name].id\n end\n end\n\n serialized_attributes\n end", "title": "" }, { "docid": "a9b75b4195e99c3624681da7bdd990aa", "score": "0.58768284", "text": "def to_h\n {\n predicate: predicate, translation_key_fragment: translation_key_fragment, cardinality: cardinality,\n type: type, attribute_method_name: attribute_method_name\n }\n end", "title": "" }, { "docid": "44ee1a42caed73e0c4e63890def3c257", "score": "0.58768225", "text": "def to_attr_hash\n to_hash.reject { |key, _| [:id, :keywords].include? key }\n end", "title": "" }, { "docid": "0ae57343c66f8e32371feb3d3090a349", "score": "0.58753", "text": "def to_hash\n VALID_ATTRIBUTES.reduce({}) { |acc, k| acc[k] = send(k); acc }\n end", "title": "" }, { "docid": "0ae57343c66f8e32371feb3d3090a349", "score": "0.58753", "text": "def to_hash\n VALID_ATTRIBUTES.reduce({}) { |acc, k| acc[k] = send(k); acc }\n end", "title": "" }, { "docid": "b243b585903426618510d34fa2d6614c", "score": "0.587455", "text": "def schema_hash_i #:nodoc:\n @schema_hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" }, { "docid": "b6fcc9ba9f0a46841d70dfe10cc12b0e", "score": "0.58740044", "text": "def to_hash\n hash = {}\n self.class.attribute_map.each_pair do |attr, param|\n value = self.send(attr)\n if value.nil?\n is_nullable = self.class.openapi_nullable.include?(attr)\n next if !is_nullable || (is_nullable && !instance_variable_defined?(:\"@#{attr}\"))\n end\n \n hash[param] = _to_hash(value)\n end\n hash\n end", "title": "" } ]
d86056d3605adf21b7e6d13a108815cb
mutate the solr_parameters to remove words that are boolean operators, but not intended as such.
[ { "docid": "56d50db61d6bfeead4f37b36228361e5", "score": "0.7955222", "text": "def cleanup_boolean_operators(solr_parameters)\n return add_advanced_parse_q_to_solr(solr_parameters) if run_advanced_parse?(solr_parameters)\n solr_parameters[:q] = cleaned_query(solr_parameters[:q])\n return solr_parameters unless using_json_query_dsl(solr_parameters)\n\n solr_parameters.dig('json', 'query', 'bool', 'must').map! do |search_element|\n search_element[:edismax][:query] = cleaned_query(search_element[:edismax][:query])\n search_element\n end\n end", "title": "" } ]
[ { "docid": "747bffa373813c90daf0a6d0ebb7070f", "score": "0.65910614", "text": "def parslet_trick(_solr_parameters)\n return unless blacklight_params[:q].is_a?(String)\n return unless blacklight_params[:q].strip.end_with?(\"()\")\n blacklight_params[:q] = blacklight_params[:q].strip.gsub(\"()\", \"\")\n end", "title": "" }, { "docid": "5fb3f5c1ad2a45118f0b59593fe3f52b", "score": "0.65899444", "text": "def clean_params\n remove = ignored.map(&:to_sym)\n controller.iiif_search_params.except(*%i[page solr_document_id] + remove)\n end", "title": "" }, { "docid": "9e88e8b0e62fb1687e514b859629ec9d", "score": "0.6437651", "text": "def exclude_unpublished(solr_params)\n solr_params[:fq] ||= []\n solr_params[:fq] << '-workflow_state_name_ssim:unpublished'\n end", "title": "" }, { "docid": "b45d7db2aff0178deaf31e0cd92811d1", "score": "0.6392261", "text": "def to_params #:nodoc:\n { :fq => to_boolean_phrase }\n end", "title": "" }, { "docid": "90e76248fc7482ce9b5a7a3fa79d5cca", "score": "0.6295598", "text": "def replacements\n params.reject do |k, _v|\n ['q', 'vocab', 'controller', 'action', 'subauthority', 'lang', 'id',\n 'context', 'performance_data', 'response_header', 'format'].include?(k)\n end\n end", "title": "" }, { "docid": "8a3fa1f460939c00e58dd49479335765", "score": "0.6269907", "text": "def clean_checkboxes\n params[:query][:selected_fields].delete(\"\")\n params[:filter][:country_code_in].delete(\"\")\n params[:filter][:region_code_in].delete(\"\")\n end", "title": "" }, { "docid": "75d9956e82326edd303dffeabf7d60c2", "score": "0.62653303", "text": "def min_match_for_boolean(solr_parameters)\n return unless search_state.query_param&.match?(/\\s(AND|OR|NOT)\\s/)\n\n solr_parameters[:mm] = '1'\n end", "title": "" }, { "docid": "fe04b7998f258c4327460fb5a74e69ff", "score": "0.62064993", "text": "def clean_publish_false_param\n if params[:q]\n params[:q].delete_if { |k,v| k == 'publish_false' && v == '0' }\n end\n end", "title": "" }, { "docid": "fe689593ccf9cdefc9f5bc2523855c54", "score": "0.6199316", "text": "def exclude_unwanted_models(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= [\n '-has_model_s:\"info:fedora/afmodel:Dor_AdminPolicyObject\"',\n ]\n end", "title": "" }, { "docid": "b3e59f090ee6f20a9e5224ad6bab2afb", "score": "0.6197839", "text": "def hide_suppressed(solr_params)\n solr_params[:fq] << \"-suppressed_bsi: true\"\n end", "title": "" }, { "docid": "7d44ceb62e6c67a7f7ad7f065be79e8a", "score": "0.6183338", "text": "def exclude_unwanted_models(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"#{Solrizer.solr_name(\"has_model\", :symbol)}:\\\"info:fedora/afmodel:Article\\\" OR #{Solrizer.solr_name(\"has_model\", :symbol)}:\\\"info:fedora/afmodel:Dataset\\\" OR #{Solrizer.solr_name(\"has_model\", :symbol)}:\\\"info:fedora/afmodel:Thesis\\\"\"\n end", "title": "" }, { "docid": "0f686e77dc14c55cfcd82e6fcddae091", "score": "0.6155731", "text": "def sanitize_search_params( parameters = nil )\n if parameters.nil?\n parameters = params.dup\n end\n SEARCH_PARAMS_MAP.each do |param|\n key = param[:key]\n if parameters[key]\n # Remove blank elements or those set to their defaults\n if parameters[key].blank? ||\n param[:null_equivalent].include?(parameters[key])\n parameters.delete(key)\n else\n value = parameters[key]\n case key\n # Slice off superfluous text\n when ASK_AMOUNT_GREATER_THAN_OR_EQUAL_TO,\n ASK_AMOUNT_LESS_THAN_OR_EQUAL_TO\n parameters[key] = value.gsub(/[^\\d]/, '')\n when BEDROOM_NUMBER, BATHROOM_NUMBER\n pair = room_number_scope_from_string(\n \"#{key.to_s.chomp('_number').to_sym}\", value )\n parameters.merge!( pair )\n parameters.delete( key ) # Remove non-Searchlogic param\n # Convert to array (actually, I think Searchlogic will still process\n # this correctly without converting to an array, but it makes it\n # more convenient when handling in other scripts\n when CATEGORIES_EQUALS_ANY, FEATURES_EQUALS_ALL, STYLES_EQUALS_ANY\n parameters[key] = value.split(' ')\n end\n end\n end\n end\n return parameters.merge( params[:q] || {} )\n end", "title": "" }, { "docid": "62c68a7ec8eed892520662e19a1a7441", "score": "0.61129236", "text": "def exclude_unwanted_models(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"#{Solrizer.solr_name(\"has_model\", :symbol)}:\\\"info:fedora/afmodel:Thesis\\\"\"\n end", "title": "" }, { "docid": "7b3d1dfdb216be25b238ac8881b4c3af", "score": "0.6098118", "text": "def exclude_unwanted_models(solr_parameters = {})\n solr_parameters[:fq] ||= []\n end", "title": "" }, { "docid": "3056c08ee12a8505119fe1003104bfc4", "score": "0.60668653", "text": "def include_hidden(solr_params)\n remove_from_fq!(solr_params, '-shadowed_location_f:HIDDEN')\n end", "title": "" }, { "docid": "538d51422400079c8af8c785f6a4a222", "score": "0.6041795", "text": "def fields_not_to_clean\n ['qc_filter_context_search']\n end", "title": "" }, { "docid": "4a8ed7a3d0bd00aa2cea7eba6bec5d9d", "score": "0.5962889", "text": "def conditions_for_solr_search(solr, query)\n query.blank? ? nil : solr.keywords(query)\n end", "title": "" }, { "docid": "6c4149915f0db01067899417a9b2e0a6", "score": "0.5958341", "text": "def add_unstemmed_overrides_to_solr(solr_parameters)\n \n if blacklight_params[:unstemmed_search]\n blacklight_config.unstemmed_overrides.each_pair do |key, value|\n solr_parameters[key] = value\n end \n end \n \n return solr_parameters\n end", "title": "" }, { "docid": "86065230389eff377abbca1d6fbfd0f2", "score": "0.59519154", "text": "def exclude_unpublished_items(solr_parameters = {})\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << '-publishing_state_ssi:\"draft\"'\n solr_parameters[:fq] << '-publishing_state_ssi:\"needs_review\"'\n solr_parameters[:fq] << '-processing_state_ssi:\"derivatives\"'\n end", "title": "" }, { "docid": "6f2da8c43ad77089753b1e0e688511f3", "score": "0.59353405", "text": "def sanitize!(params)\n params.each_key do |key|\n params[key] = sanitize_search_term(params[key]) if key == :term\n end\n end", "title": "" }, { "docid": "1326336757cb9f21c2e6454b0f66957c", "score": "0.59284836", "text": "def exclude_unwanted_models(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"format:Candidate\"\n end", "title": "" }, { "docid": "ba8e980babbddd516047b77b084f5bea", "score": "0.59211725", "text": "def filter_models(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << '(' + (work_clauses + collection_clauses).join(' OR ') + ')'\n end", "title": "" }, { "docid": "2a7491e890edd294d88e16f8eefbb406", "score": "0.5918724", "text": "def normalize_predicates!(opt)\n opt.replace(normalize_predicates(opt))\n end", "title": "" }, { "docid": "605b0762b76cd39e7ac9ab515f288e24", "score": "0.591478", "text": "def strip_search_param\n case params[:q]\n when String\n params[:q].strip!\n when Hash\n params[:q].each_pair{|k, v| params[:q][k] = v.strip}\n else\n end\n end", "title": "" }, { "docid": "90f8cb2a49760ba6bd831c5b84a7d8ac", "score": "0.5914159", "text": "def clean_params\n clean_unserializable_data_from(:parameters)\n if params_filters\n parameters.keys.each do |key|\n parameters[key] = \"[FILTERED]\" if params_filters.any? do |filter|\n key.to_s.include?(filter)\n end\n end\n end\n end", "title": "" }, { "docid": "62ee4e76e7e6b00353ce76a97be8794e", "score": "0.5899811", "text": "def search_params( parameters = nil )\n if parameters.nil?\n parameters = params.dup\n end\n \n # Remove non-Searchlogic elements\n search_keys = SEARCH_PARAMS_MAP.map { |param| param[:key] }\n parameters.delete_if {\n |key, value| ! search_keys.include?( key.to_sym ) }\n \n return sanitize_search_params( parameters )\n end", "title": "" }, { "docid": "e6b1dc83fc8e99cbcb7ac6f3d352a6e7", "score": "0.5896055", "text": "def ocr_search_params(solr_parameters = {})\n solr_parameters.merge!(blacklight_config.search_fields[blacklight_config.full_text_index].solr_parameters)\n solr_parameters[:facet] = false\n solr_parameters[:hl] = true\n solr_parameters[:'hl.fl'] = blacklight_config.ocr_search_field\n solr_parameters[:'hl.fragsize'] = 135\n solr_parameters[:'hl.snippets'] = 10\n end", "title": "" }, { "docid": "08a08f1afd27a313946503e268706460", "score": "0.5890122", "text": "def render_search_to_s_filters(my_params)\n if my_params[:unstemmed_search]\n render_search_to_s_element(nil, \"(Stemming disabled)\")\n else\n \"\".html_safe\n end + super(my_params)\n end", "title": "" }, { "docid": "3ee40b563a36cd36ad9021f54f470e91", "score": "0.5878501", "text": "def filter_suppressed(solr_params)\n if !solr_params[\"fq\"]&.include?(\"-suppress_items_b:true\")\n solr_params[\"fq\"] = (solr_params[\"fq\"] || []).push(\"-suppress_items_b:true\")\n end\n end", "title": "" }, { "docid": "944f2e393547cd0bec00de4a2b2534bf", "score": "0.5870895", "text": "def toggle_search_params(params)\n categories = params[:categories]&.dup || []\n\n if enabled?(params)\n categories -= [to_param]\n categories -= descendants.collect(&:to_param)\n else\n categories << to_param\n categories.concat(descendants.collect(&:to_param))\n end\n categories.uniq!\n\n ret = params.except(:categories)\n ret[:categories] = categories unless categories.empty?\n\n RLetters::Solr::Search.permit_params(ret)\n end", "title": "" }, { "docid": "a81c9756f62a0738563ad252a1a1b536", "score": "0.5865292", "text": "def forbiden_word_params\n params.require(:forbiden_word).permit(:word, :is_valid_after_quote_accepted, :is_catched_word)\n end", "title": "" }, { "docid": "8a99cead3ff9d86b40761881d11c8276", "score": "0.58437705", "text": "def non_wukong_params\n options.\n reject{|param, val| options.param_definitions[param][:wukong] }.\n map{|param,val| \"--#{param}=#{val}\" }.\n join(\" \")\n end", "title": "" }, { "docid": "8631dfa23f94a5820c4eb3d0e2da3008", "score": "0.5836012", "text": "def add_exclusions_to_solr2()\n query = ''\n solrConfig = Oj.load(File.read('data/solr-config.json'))\n if(solrConfig[\"Exclusions\"][\"terms\"].length > 0)\n query = query + \" AND \"\n solrConfig['Exclusions']['fields'].each_with_index do |fieldToBeChecked, index|\n if (solrConfig['Exclusions']['fields'].length - 1 == index)\n query = query + '!' + fieldToBeChecked + ':' + '('\n solrConfig['Exclusions']['terms'].each_with_index do |term, index|\n if (solrConfig['Exclusions']['terms'].length - 1 == index)\n query = query + '\"' + term + '\"'\n else\n query = query + '\"' + term + '\" OR '\n end\n end\n query = query + \")\"\n else\n query = query + '!' + fieldToBeChecked + ':' + '('\n solrConfig['Exclusions']['terms'].each_with_index do |term, index|\n if (solrConfig['Exclusions']['terms'].length - 1 == index)\n query = query + '\"' + term + '\"'\n else\n query = query + '\"' + term + '\" OR '\n end\n end\n query = query + \") AND \"\n end\n end\n end\n query\nend", "title": "" }, { "docid": "b58149ba7f379735142d0a8926124f74", "score": "0.581575", "text": "def negatable_scalar_params\n @negatable_scalar_params ||= scalar_params - %i[search in]\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.5812061", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.58120435", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "7588a2b2c98bcd709a7d06e1fe2c0876", "score": "0.57916754", "text": "def nonwords\n @nonwords ||= %w(& of in the and).map{|w| w.to_sym}.to_set\n end", "title": "" }, { "docid": "17e9131eadf3ba2879c8a665c1c65b34", "score": "0.57782114", "text": "def flagged_filter(solr_parameters = {})\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"-#{blacklight_config.flagged_field}:[* TO *]\"\n end", "title": "" }, { "docid": "2f3e63b9ac84a7e85f1ee20a12916245", "score": "0.57573134", "text": "def home_page_solr_params(solr_params)\n if ( blacklight_params[:format].blank? || blacklight_params[:format] == \"html\") && \n blacklight_params[:controller] == 'catalog' && blacklight_params[:action] == 'index' &&\n !(blacklight_params[:q].present? || \n blacklight_params[:f].present? || \n blacklight_params[:search_field].present? ||\n blacklight_params[:range].present?\n )\n \n\n solr_params[:facet] = \"false\"\n solr_params[:stats] = \"false\"\n solr_params[:rows] = \"0\"\n end\n return solr_params \n end", "title": "" }, { "docid": "5a29828fd44e2bc694f184c23e7852f1", "score": "0.5757086", "text": "def normalize_params params\n return [{ :negated => !params }, {}] if !params || params == true\n\n unless params.is_a?(Hash)\n return [{ :negated => false }, { :value => params }]\n end # unless\n\n options = {\n :if => params.delete(:if),\n :negated => !!params.delete(:negated),\n :unless => params.delete(:unless)\n } # end hash\n\n [options, params]\n end", "title": "" }, { "docid": "e6e8eae4aca4e316796cb76504c9219d", "score": "0.57523215", "text": "def cleanse!(args)\n args.tap do |a|\n a.each { |k,v| a[k] = str_to_bool(v) }\n symbol_keys = a.keys.select { |k| k.is_a?(Symbol) && !a.has_key?(k.to_s) }\n symbol_keys.each { |k| a[k.to_s] = a[k] }\n a.delete_if { |k,_| k.is_a?(Symbol) }\n end\n end", "title": "" }, { "docid": "160268b04b0c39bd9bb94d77639b8252", "score": "0.5747281", "text": "def filter_models(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << '(' + (work_clauses + collection_clauses).join(' OR ') + ')'\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.572788", "text": "def filtered_parameters; end", "title": "" }, { "docid": "1e4985bfdbde6ae780800a811709162f", "score": "0.5710464", "text": "def filter_query_string\n return unless @query_str.present?\n # try parsing. if we can't, then strip characters.\n # this allows for savvy users to actually exercise features, w/o penalizing inadvertent strings.\n parser = self.class.get_query_parser\n errloc = parser.error_location(@query_str)\n if errloc\n @query_str.gsub!(/[\\&\\|\\>\\<\\!\\(\\)\\{\\}\\[\\]\\^\\~\\\\\\/]+/, '')\n @query_str.gsub!(/\\ +/, ' ') # reduce multiple spaces to singles\n # if we have just a single double quote mark, strip it too\n if @query_str.match(/\"/) and !@query_str.match(/\".+?\"/)\n @query_str.gsub!(/\"/, '')\n end\n end\n end", "title": "" }, { "docid": "bf71f22b6a3d024d9581258c3391dd13", "score": "0.5707235", "text": "def filter_params(params); end", "title": "" }, { "docid": "7400c85842fbf1b256b63dde02841e5c", "score": "0.57035714", "text": "def sanitize_query(str)\n # Escape special characters\n # http://lucene.apache.org/core/old_versioned_docs/versions/2_9_1/queryparsersyntax.html#Escaping Special Characters\n escaped_characters = Regexp.escape('\\\\+-&|!(){}[]^~*?:\\/')\n str = str.gsub(/([#{escaped_characters}])/, '\\\\\\\\\\1')\n\n # AND, OR and NOT are used by lucene as logical operators. We need\n # to escape them\n ['AND', 'OR', 'NOT'].each do |word|\n escaped_word = word.split('').map {|char| \"\\\\#{char}\" }.join('')\n str = str.gsub(/\\s*\\b(#{word.upcase})\\b\\s*/, \" #{escaped_word} \")\n end\n\n # Escape odd quotes\n quote_count = str.count '\"'\n str = str.gsub(/(.*)\"(.*)/, '\\1\\\"\\3') if quote_count % 2 == 1\n\n str\n end", "title": "" }, { "docid": "eb36d24f72956b098866f2756644301b", "score": "0.5697596", "text": "def clean_filter(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end", "title": "" }, { "docid": "ebccd2a51a1479eaf78099cadabe185e", "score": "0.5689864", "text": "def filter_models(solr_parameters)\n return if blacklight_params[:all_models] == \"true\"\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"!{!terms f=internal_resource_ssim}#{models_to_solr_clause}\"\n end", "title": "" }, { "docid": "c22801d9a2cb0c974a294107f3cbd885", "score": "0.56823194", "text": "def cql_to_solr_search_params(solr_params)\n\n if blacklight_params[\"search_field\"] == self.pseudo_search_field[:key] && ! blacklight_params[\"q\"].blank?\n parser = CqlRuby::CqlParser.new\n\n solr_params[:q] = \"{!lucene} \" + parser.parse( blacklight_params[\"q\"] ).to_bl_solr(self.blacklight_config) \n end\n return solr_params\n end", "title": "" }, { "docid": "5d0bb23bbf115301942f74909b92d916", "score": "0.5670709", "text": "def remove_from_fq!(solr_params, *terms)\n solr_params ||= {}\n solr_params[:fq] ||= []\n unless solr_params[:fq].empty?\n patterns =\n terms.flat_map { |term|\n if term.is_a?(Hash)\n term.flat_map do |field, value|\n Array.wrap(value).map { |v| \"#{field}:#{v unless v == '*'}\" }\n end\n else\n term.to_s\n end\n }.map { |pattern|\n escape = ('\\\\' if pattern.start_with?('+'))\n anchor = ('$' if pattern.include?(':') && !pattern.end_with?(':'))\n Regexp.new(\"^#{escape}#{pattern}#{anchor}\")\n }\n solr_params[:fq].delete_if do |item|\n patterns.any? { |pattern| item =~ pattern }\n end\n end\n solr_params\n end", "title": "" }, { "docid": "d5df8448adfa675e6d25aeb23d7a5e34", "score": "0.5661087", "text": "def sanitize_query_fields\n allowed_fields = @list.property_index_keys\n return request.query_parameters.select {|key, val| allowed_fields.include?(key)}\n end", "title": "" }, { "docid": "62289707e0fef3e73f3dc118ce071784", "score": "0.56567806", "text": "def preprocess_attrs(attrs)\n attrs.delete(\"term\") if attrs[\"term\"] && !attrs[\"word\"]\n attrs.delete(3) if attrs[3] == attrs[\"term\"]\n a = attrs.keys.reject { |k| k.is_a?(String) || [1, 2].include?(k) }\n attrs[\"word\"] ||= attrs[a[0]] if !a.empty?\n attrs[\"term\"] ||= attrs[a[1]] if a.length > 1\n attrs\n end", "title": "" }, { "docid": "9b887a441bec30ec8162fc66fd63ade2", "score": "0.5650231", "text": "def exclude_unwanted_models(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"-has_model_s:\\\"info:fedora/afmodel:FileAsset\\\"\"\n end", "title": "" }, { "docid": "b5e682096a2ba0a2f7ea12db94daf5c2", "score": "0.5645228", "text": "def whitelist_filter_fields\n {'stanford'=>'stanford',\n 'non-stanford'=>'non-stanford',\n 'all'=>'all',\n 'user'=>'user',\n 'curator'=>'curator',\n 'featured'=>'featured',\n 'public'=>'public',\n 'private'=>'private'\n }\n end", "title": "" }, { "docid": "80a82f77f037a1cf6a33979f1b41de4b", "score": "0.5638177", "text": "def escape_boolean_operators(query)\n return nil unless query\n substitutions_hash = {'&&' => '\\\\&\\\\&', '||' => '\\\\|\\\\|', '!' => '\\\\!', 'AND' => 'and', 'NOT' => 'not', 'OR' => 'or'}\n new_query = query.gsub(BOOLEAN_OPERATORS_REGEXP) do |match| \n substitutions_hash[match]\n end\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.56310976", "text": "def filter_parameters; end", "title": "" }, { "docid": "6170e9be0457d273caefaeba4cc60d7b", "score": "0.56293267", "text": "def remove_default_search_terms(search_terms)\n \tdefaults = {\"country_equals\" => \"Country\", \n \t\t\t\t\t\t\t\"sport_equals\" => \"Sport\", \n \t\t\t\t\t\t\t\"description_or_title_contains\" => \"Refine Search\"}\n \t\t\t\t\t\t\t\n \tif search_terms && defaults\n \t\tdefaults.each_pair do |key, value|\n \t\t\tsearch_terms.delete_if{ search_terms[key] == value }\n \t\tend\n \tend\n \tsearch_terms\n end", "title": "" }, { "docid": "19e096a8d32795f7b871a73adb78c30d", "score": "0.56285465", "text": "def negative_field_queries\n result = []\n fields.each do |key, value|\n next unless value\n is_negative_query = value.start_with? '!'\n is_null_query = (value == 'null' || value == '!null')\n\n if is_negative_query && !is_null_query\n not_value = \"#{value[1..-1]}\" # remove exclamation mark from position 0\n if not_value.match(/\\|/) # A value containing a pipe will be parsed as an OR statement\n result << {:terms => {key => not_value.downcase.split('|')}}\n else\n result << {:term => {key => not_value.downcase}}\n end\n end\n end\n result\n end", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.562633", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "2a7dbd3306aa73f3caf29dfc43b0a953", "score": "0.56250054", "text": "def filter_params\n params.permit(:queries => [:type, :attribute, :condition, :conjunction, :values => []])\n end", "title": "" }, { "docid": "78a375fb1cb76d96cac478c535db06cc", "score": "0.56163687", "text": "def cleanup_parameters\n\n changed = false\n original_size = params.to_unsafe_h.size\n\n # Eliminate \"noise\" parameters (usually generated from the advanced search\n # form), including 'op=\"AND\"' since this is always the default logical\n # operation.\n params.delete_if { |k, v| k.blank? || v.blank? }\n %w(utf8).each { |k| params.delete(k) }\n params.delete(:op) if params[:op] == 'AND'\n params.delete(:commit)\n debugging = params.delete(:virgo_debug)\n\n # Update session if indicated.\n case debugging.to_s.downcase\n when 'true' then session[:virgo_debug] = true\n when 'false' then session.delete(:virgo_debug)\n end\n\n # If parameters were removed, redirect to the corrected URL.\n changed ||= (params.to_unsafe_h.size != original_size)\n will_redirect if changed\n\n end", "title": "" }, { "docid": "16f6171824a91e0b1237b9416296a87f", "score": "0.55934626", "text": "def to_simple_pure_negative_query(local_params)\n # take em out of their ExcludedClauses\n embeddables = list.collect { |n| n.operand }\n # and insist on mm 100%\n solr_params = local_params.merge(:mm => \"100%\")\n\n # and put the NOT in front to preserve semantics.\n 'NOT _query_:\"' +\n bs_escape(build_local_params(solr_params) +\n embeddables.collect { |n| n.to_embed }.join(\" \")) +\n '\"'\n end", "title": "" }, { "docid": "d6809e78f301183acb1ae22cd3602c71", "score": "0.55882293", "text": "def remove_discovery_permissions(solr_parameters)\n fq = solr_parameters.fetch(:fq, nil)\n return unless fq\n solr_parameters[:fq] = fq.map { |q| prune(q) }\n end", "title": "" }, { "docid": "8e35e6848031bbf9bb90847ad58b3772", "score": "0.55859625", "text": "def sanitize_params(params, whitelist_constant)\n params.reject do |key, value|\n !whitelist_constant.include?(key) || (%i[end_date kpi_goal].include?(key) ? false : value.nil?)\n end\n end", "title": "" }, { "docid": "3863ee7830f2d0453f0227cc8ceca1d7", "score": "0.5584364", "text": "def remove_specified_facet_params(my_params, remove_facets)\n my_params = my_params.deep_dup\n\n remove_facets.each_pair do |facet, values|\n facet = facet.to_sym\n values = [values] unless values.kind_of?(Array)\n\n next unless my_params[:f].try {|h| h[facet.to_sym] }\n\n my_params[:f][facet.to_sym].delete_if do |v|\n values.include? v\n end\n end\n\n return my_params\n end", "title": "" }, { "docid": "168329d3647e189b4c7a7d8f8c496904", "score": "0.55721647", "text": "def remove_unmatchable_terms(terms)\n terms_class = terms.class\n terms = terms.split(' ') if terms_class == String\n\n terms_to_remove = []\n terms.each do |term|\n count = ThinkingSphinx.search_count(term)\n if count == 0\n terms_to_remove << term\n end\n #######\n ### Get rid of Roman Numerals\n temp = term.dup\n temp.gsub!(/[ixv]/,'')\n if temp == ''\n terms_to_remove << term\n end\n #######\n end\n remove_terms(terms, terms_to_remove)\n\n terms_class == String ? terms.join(' ') : terms\nend", "title": "" }, { "docid": "168329d3647e189b4c7a7d8f8c496904", "score": "0.55721647", "text": "def remove_unmatchable_terms(terms)\n terms_class = terms.class\n terms = terms.split(' ') if terms_class == String\n\n terms_to_remove = []\n terms.each do |term|\n count = ThinkingSphinx.search_count(term)\n if count == 0\n terms_to_remove << term\n end\n #######\n ### Get rid of Roman Numerals\n temp = term.dup\n temp.gsub!(/[ixv]/,'')\n if temp == ''\n terms_to_remove << term\n end\n #######\n end\n remove_terms(terms, terms_to_remove)\n\n terms_class == String ? terms.join(' ') : terms\nend", "title": "" }, { "docid": "f5c5e1610290419c12b1d09457d6602f", "score": "0.55686784", "text": "def filter_op_params(params)\n (params || {}).except(*EXCEPT_PARAMS)\n end", "title": "" }, { "docid": "8339f4738879be047f88128b64001665", "score": "0.55681723", "text": "def word_filter\n [\n { part_of_speech: :noun },\n { part_of_speech: :adjective, subclass: :na_adjective }\n ]\n end", "title": "" }, { "docid": "396e07c8f09501c847d29c0df68fdee5", "score": "0.5557158", "text": "def to_query(solr_params)\n # rescue double-nots to not treat them crazy-like and make the query\n # more work for Solr than it needs to be with a double-negative.\n if operand.is_a?(NotExpression)\n operand.operand.to_query(solr_params)\n else\n \"NOT \" + operand.to_query(solr_params)\n end\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.5555439", "text": "def filtered_params_config; end", "title": "" }, { "docid": "615b71d46716895f18fc8af436e88a68", "score": "0.5545002", "text": "def exclude_from_xss_checks; %w{ abstract abstract_filtered } end", "title": "" }, { "docid": "1ad650cf0d83c2b4986a57da221042c2", "score": "0.5542603", "text": "def sanitize_filterrific_param(val); end", "title": "" }, { "docid": "e5110d0cb9c1eb336c350919874aeac5", "score": "0.5532844", "text": "def published_models_only(solr_parameters)\n solr_parameters[:fq] << PUBLISHED_ONLY\n end", "title": "" }, { "docid": "de1a2d58fb3a3bbe7a4819a0d898a083", "score": "0.55294883", "text": "def to_positive_boolean_phrase\n \"#{Util.escape(@field.indexed_name)}:#{to_solr_conditional}\"\n end", "title": "" }, { "docid": "f83049c58aaa4352dfb7f3098ac3f35d", "score": "0.55168253", "text": "def exclude_institutions(solr_parameters = {})\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << '-curator_model_suffix_ssi:\"Institution\"'\n end", "title": "" }, { "docid": "0c9d4c365c1621bdf0a6b700bd6e3bef", "score": "0.5513704", "text": "def cleanedParams(params)\n params.select {|k, v| ALLOWED_PARAMS.include? k}\n end", "title": "" }, { "docid": "79773c0f9b593408add0a25fffea25b8", "score": "0.5512971", "text": "def filtering_params(params)\n params.collect { |value| ['sort', 'direction'].include?(value[0]) ? '' : \"&#{value[0]}=#{value[1]}\" }.join\n end", "title": "" }, { "docid": "de568a01d88abf83f7295d2c9407119d", "score": "0.551297", "text": "def cleanup_parameters\n\n changed = false\n original_size = params.to_unsafe_h.size\n\n # Eliminate \"noise\" parameters (usually generated from the advanced search\n # form), including 'op=\"AND\"' since this is always the default logical\n # operation.\n params.delete_if { |k, v| k.blank? || v.blank? }\n %w(utf8).each { |k| params.delete(k) }\n params.delete(:op) if params[:op] == 'AND'\n reset_search = (params.delete(:commit) == 'Search')\n debug_session = params.delete(:debug_session)\n\n # Update session if indicated.\n case debug_session.to_s.downcase\n when 'true' then session[:debug_session] = true\n when 'false' then session.delete(:debug_session)\n end\n\n # If parameters were removed, redirect to the corrected URL.\n changed ||= (params.to_unsafe_h.size != original_size)\n will_redirect if changed\n\n end", "title": "" }, { "docid": "9bd74079603b03e5058c4091b3b4dd0a", "score": "0.551148", "text": "def search_word_conditions\n params[:q].split(/\\s+/).map { |w| search_word_condition(w) }\n end", "title": "" }, { "docid": "75efdd346b2c3356db5a83a81ee97a39", "score": "0.55111295", "text": "def search_params\n # TODO: This is hacky and buggy. Wrap the relevent stuff inside a hash within params.\n params.permit(:city_id, :overlooking, :car_access, :serviced, :family_friendly, :free_access).delete_if { |_, value| value.empty? || value == 'false' }.except(:controller, :commit, :action)\n end", "title": "" }, { "docid": "b882de49bb2ea4df048bd775cd7052df", "score": "0.5506028", "text": "def sanitize_fields_excluded; end", "title": "" }, { "docid": "5a026232353b7a47b53f42eede87d064", "score": "0.5501503", "text": "def query_via_solr # rubocop:disable all\n filter_queries = []\n orders = []\n @where_values.each do |wv|\n wv.each do |k, v|\n # If v is blank but not false, check that there is no value for the field in the document\n if v.blank? && v != false\n filter_queries << \"-#{k}:#{full_solr_range(k)}\"\n else\n filter_queries << \"#{k}:(#{solr_format(k, v)})\"\n end\n end\n end\n\n @where_not_values.each do |wnv|\n wnv.each do |k, v|\n # If v is blank but not false, check for any value in the field in the document\n if v.blank? && v != false\n filter_queries << \"#{k}:#{full_solr_range(k)}\"\n else\n filter_queries << \"-#{k}:(#{solr_format(k, v)})\"\n end\n end\n end\n\n @greater_than_values.each do |gtv|\n gtv.each do |k, v|\n filter_queries << \"#{k}:[#{solr_format(k, v)} TO *]\"\n end\n end\n\n @less_than_values.each do |ltv|\n ltv.each do |k, v|\n filter_queries << \"#{k}:[* TO #{solr_format(k, v)}]\"\n end\n end\n\n @order_values.each do |ov|\n ov.each do |k, v|\n if @reverse_order_value\n orders << \"#{k} #{v == :asc ? 'desc' : 'asc'}\"\n else\n orders << \"#{k} #{v == :asc ? 'asc' : 'desc'}\"\n end\n end\n end\n\n sort = orders.join(',')\n\n q = @fulltext_values.empty? ? '*:*' : @fulltext_values.map { |ftv| '(' + ftv[:query] + ')' }.join(' AND ')\n\n params = { q: q, commit: true }\n params[:sort] = sort\n params[:fq] = filter_queries unless filter_queries.empty?\n if @query_parser_value\n params['defType'] = @query_parser_value.keys.first\n params.merge(@query_parser_value.values.first)\n end\n\n # Facets\n # facet=true to enable faceting, facet.field=<field_name> (can appear more than once for multiple fields)\n # Additional options: f.<field_name>.facet.<option> [e.g. f.author.facet.sort=index]\n\n # Facet Fields\n unless field_facet_values.empty?\n params['facet'] = 'true'\n params['facet.threads'] = facet_threads_value if facet_threads_value.present?\n\n facet_fields = []\n field_facet_values.each do |facet|\n facet_field = facet[:field]\n facet_fields << facet_field\n facet[:options].each do |key, value|\n params[\"f.#{facet_field}.facet.#{key}\"] = value.to_s\n end\n end\n params['facet.field'] = facet_fields\n end\n\n # Facet Ranges\n unless range_facet_values.empty?\n params['facet'] = 'true'\n facet_fields = []\n range_facet_values.each do |facet|\n facet_field = facet[:field]\n facet_fields << facet_field\n facet[:options].each do |key, value|\n params[\"f.#{facet_field}.facet.range.#{key}\"] = value.to_s\n end\n end\n params['facet.range'] = facet_fields\n end\n\n if @highlight_options[:fields].present?\n params[:hl] = true\n params['hl.fl'] = @highlight_options[:fields]\n params['hl.snippets'] = @highlight_options[:snippets] if @highlight_options[:snippets]\n params['hl.fragsize'] = @highlight_options[:fragsize] if @highlight_options[:fragsize]\n params['hl.requireFieldMatch'] =\n @highlight_options[:require_field_match] if @highlight_options[:require_field_match].present?\n if @highlight_options[:use_fast_vector]\n params['hl.useFastVectorHighlighter'] = true\n params['hl.tag.pre'] = @highlight_options[:pre_tag] if @highlight_options[:pre_tag].present?\n params['hl.tag.post'] = @highlight_options[:post_tag] if @highlight_options[:post_tag].present?\n else\n params['hl.mergeContiguous'] = @highlight_options[:merge_contiguous].present?\n params['hl.simple.pre'] = @highlight_options[:pre_tag] if @highlight_options[:pre_tag].present?\n params['hl.simple.post'] = @highlight_options[:post_tag] if @highlight_options[:post_tag].present?\n params['hl.maxAnalyzedChars'] =\n @highlight_options[:max_analyzed_chars] if @highlight_options[:max_analyzed_chars].present?\n end\n end\n\n select_columns =\n select_values.empty? ? (@klass.attribute_definitions.keys - @klass.lazy_attributes) : select_values.flatten\n select_columns << @klass.primary_key\n select_columns.map! { |c| @klass.column_for_attribute(c).try(:type) == :map ? \"#{c}*\" : c.to_s }\n params[:fl] = select_columns.uniq.join(',')\n unless @stats_values.empty?\n params[:stats] = 'true'\n @stats_values.flatten.each do |sv|\n params['stats.field'] = sv\n end\n params['stats.facet'] = @group_value\n end\n solr_response = nil\n\n if @group_value\n results = DatastaxRails::GroupedCollection.new\n params[:group] = 'true'\n params[:rows] = 10_000\n params['group.field'] = @group_value\n params['group.limit'] = @per_page_value\n params['group.offset'] = (@page_value - 1) * @per_page_value\n params['group.ngroups'] = 'false' # must be false due to issues with solr sharding\n ActiveSupport::Notifications.instrument(\n 'solr.datastax_rails',\n name: 'Search',\n klass: @klass.name,\n search: params) do\n solr_response = rsolr.post('select', data: params)\n response = solr_response['grouped'][@group_value.to_s]\n results.total_groups = response['groups'].size\n results.total_for_all = response['matches'].to_i\n results.total_entries = 0\n response['groups'].each do |group|\n results[group['groupValue']] = parse_docs(group['doclist'], select_columns)\n if results[group['groupValue']].total_entries > results.total_entries\n results.total_entries = results[group['groupValue']].total_entries\n end\n end\n end\n else\n ActiveSupport::Notifications.instrument(\n 'solr.datastax_rails',\n name: 'Search',\n klass: @klass.name,\n search: params.merge(page: @page_value, per_page: @per_page_value)) do\n solr_response = rsolr.paginate(@page_value, @per_page_value, 'select', data: params, method: :post)\n response = solr_response['response']\n results = parse_docs(response, select_columns)\n results.highlights = solr_response['highlighting']\n end\n end\n if solr_response['stats']\n @stats = solr_response['stats']['stats_fields'].with_indifferent_access\n end\n # Apply Facets if they exist\n if solr_response['facet_counts']\n results.facets = {}\n results.facets = results.facets.merge(solr_response['facet_counts']['facet_fields'].to_h)\n results.facets = results.facets.merge(solr_response['facet_counts']['facet_ranges'].to_h)\n end\n results\n end", "title": "" }, { "docid": "53ebdfb8edf85bea73c686e87e7dae89", "score": "0.549924", "text": "def strip_nil_f(solr_params)\n solr_params.delete('f') unless solr_params['f']\n end", "title": "" }, { "docid": "53ebdfb8edf85bea73c686e87e7dae89", "score": "0.54987544", "text": "def strip_nil_f(solr_params)\n solr_params.delete('f') unless solr_params['f']\n end", "title": "" }, { "docid": "54d92ab36639c5913052313b82cdd423", "score": "0.54978985", "text": "def clean_filtered_params(params)\n params.except('access_token', 'controller', 'action', 'format', 'locale')\n end", "title": "" }, { "docid": "345da1c6f4ff22402bb2876e765a90fa", "score": "0.549719", "text": "def scrub_boolean(_input)\n '-'\n end", "title": "" }, { "docid": "54d92ab36639c5913052313b82cdd423", "score": "0.5496889", "text": "def clean_filtered_params(params)\n params.except('access_token', 'controller', 'action', 'format', 'locale')\n end", "title": "" }, { "docid": "b920ab26ffb578c9a97080e684c32547", "score": "0.54849833", "text": "def filtering_params(params)\r\n params.slice(:starts_with, :ends_with, :contains)\r\n end", "title": "" }, { "docid": "77b5db2ac65035e914017a7a034444f6", "score": "0.54797137", "text": "def reset_search_params\n Parameters.sanitize(params).except(:page, :counter)\n end", "title": "" }, { "docid": "3e0f979898154265a832d1d1c9612156", "score": "0.54765886", "text": "def clean_params(params); end", "title": "" }, { "docid": "137bc14c80e1dbbc0f6af0898186ebcc", "score": "0.54736036", "text": "def filter_survey_params(params)\n params.select { |k, _| k == \"description\" }\n end", "title": "" }, { "docid": "b75b36cb5b16c6c298679ee1df9da258", "score": "0.54701585", "text": "def sanitize_fields_excluded=(_arg0); end", "title": "" }, { "docid": "11b904b3dab87e8f40b22850064237c6", "score": "0.5469021", "text": "def apply_solr_params_logic(solr_parameters, user_parameters)\n SearchFilter.apply_solr_params_for_filters(filters, solr_parameters, user_parameters)\n #filters.each do |filter|\n # filter.apply_solr_params(solr_parameters, user_parameters)\n #end\n return solr_parameters, user_parameters\n end", "title": "" }, { "docid": "2b89e3f6a90904d4ae118957437faf10", "score": "0.5463968", "text": "def sanitise!\n @params.keep_if do |_k, v|\n !v.to_s.strip.empty?\n end\n end", "title": "" }, { "docid": "bb81b910db743b66f5477518bc544cfa", "score": "0.54569787", "text": "def toggle_search_params(params)\n categories = params[:categories]&.dup || []\n\n if enabled?(params)\n categories -= self_and_ancestors.collect(&:to_param)\n categories -= self_and_descendants.collect(&:to_param)\n else\n categories.concat(self_and_descendants.collect(&:to_param))\n end\n categories.uniq!\n\n params.except(:categories).to_h.deep_dup.tap do |ret|\n ret[:categories] = categories unless categories.empty?\n end\n end", "title": "" }, { "docid": "8e83b74da84736dad5de5c9558e496a3", "score": "0.5438889", "text": "def remove_rails_special_params_from(params, additional_to_remove=[])\n return { } if params.blank?\n \n special_params = %w( id format controller action commit ).concat(additional_to_remove)\n return params.reject { |k,v| special_params.include?(k.to_s.downcase) }\n end", "title": "" }, { "docid": "e23afed704ca4fe5ab5265c87748bf65", "score": "0.5423618", "text": "def params_rm_blanks(search)\n search.each do |k,v|\n if v.blank?\n search.delete(k)\n end\n end\n end", "title": "" }, { "docid": "9f50ba336c1ea341da4f4cea93fa4e91", "score": "0.5421495", "text": "def remove_filters!; end", "title": "" }, { "docid": "6a700dcd301000452f9cc63d905c4574", "score": "0.5408135", "text": "def non_wukong_hadoop_params_string\n params_to_pass.reject do |param, val|\n params_to_pass.definition_of(param, :wukong_hadoop)\n end.map do |param,val|\n \"--#{param}=#{Shellwords.escape(val.to_s)}\"\n end.join(\" \")\n end", "title": "" } ]
e1f58e8e928fe570a65313b247b68682
For the benefit of error handlers, returns the most recent glob pattern which didn't find a file in the filesystem
[ { "docid": "931676c218017638790050b7a1db075a", "score": "0.0", "text": "def unmatched\n @_merb_unmatched\n end", "title": "" } ]
[ { "docid": "bf3950d09439d98c404900994c325137", "score": "0.64692676", "text": "def latest_file(glob)\n require 'find'\n return FileList[glob].map{|path| [path, File.mtime(path)]}.sort_by(&:last).map(&:first).last\n end", "title": "" }, { "docid": "d26132ad57b262a4fb74263861f5e392", "score": "0.6368108", "text": "def check_globs(filename)\r\n basename = File.basename(filename)\r\n found = @globs.each_key.select { |pattern| File.fnmatch pattern, basename }\r\n\r\n if found.empty?\r\n downcase_basename = basename.downcase\r\n found = @globs.each_key.select { |pattern|\r\n File.fnmatch pattern, downcase_basename\r\n }\r\n end\r\n\r\n @globs[found.max]\r\n end", "title": "" }, { "docid": "35f90810d803199bc94b6a8dc03de3b3", "score": "0.62918246", "text": "def get_latest_file(dir, pattern)\n # Get list of files using the pattern and max'es out\n # the file according to sort criteria.\n # Sort criteria is based on creation time\n Dir.glob(File.join(dir, pattern)).max do |f1, f2|\n File.ctime(f1) <=> File.ctime(f2)\n end\nend", "title": "" }, { "docid": "8fa21c52f9d1e9032e7f388f637f70b6", "score": "0.61062145", "text": "def find_single( glob )\n candidates = Pathname.glob container + glob\n raise None, \"No restore files found for #{glob}\" if candidates.size == 0\n raise \"too many #{candidates.inspect} for #{glob}\" if candidates.size > 1\n candidates.first\n end", "title": "" }, { "docid": "52923683877c0bb93a9357105b1734dd", "score": "0.6095143", "text": "def find_file(file_name, path_array)\n result = nil\n lookup = []\n\n unless path_array.empty?\n search_paths = path_array\n\n if path_array.first.kind_of? String\n search_paths = [path_array]\n end\n\n search_paths.each do |elem|\n full_path = (elem.kind_of?(String)) ? elem : File.join(elem)\n\n files = Dir.glob(File.join(full_path, file_name))\n\n unless files.empty?\n result = files.sort.last\n break\n else\n lookup << full_path\n end\n end\n end\n\n if result.nil?\n fail \"Could not find file #{file_name} at #{lookup.join(', ')}\"\n end\n\n result\nend", "title": "" }, { "docid": "2b652eaa9ad088d48f0a514b7cc6504e", "score": "0.60775405", "text": "def find_path_with_base(f)\n Dir.glob(f + \"*\").first || \"\" # don't return nil; makes for bad spec error messages\nend", "title": "" }, { "docid": "462afd77478628644ccc040578c074ec", "score": "0.607271", "text": "def filename\n Dir[glob].first if exists?\n end", "title": "" }, { "docid": "51b3721b2eb81fbb83e20e9c6b23dee7", "score": "0.6055755", "text": "def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end", "title": "" }, { "docid": "1c541d4535801072f69c8b3320dc5cb5", "score": "0.6020262", "text": "def resolve\n @paths.clear\n if @options[:glob] == :newest\n @paths.concat(Dir[@pattern].sort_by { |f| File.mtime(f) }.last(1))\n else\n @paths.concat(Dir[@pattern])\n end\n @paths.any?\n end", "title": "" }, { "docid": "f6afa347702148e25ea463323a61c01b", "score": "0.60184324", "text": "def timeout_match_files(pattern, timeout = 5)\n now = Time.now.utc\n\n Dir[pattern].each do |fname|\n ts = timestamp_from_filename(fname)\n if (now - ts).abs <= timeout\n return fname\n end\n end\n\n raise \"No file matching '#{pattern}' with a timestamp in the last #{timeout} \"\\\n \"seconds was found!\"\nend", "title": "" }, { "docid": "6a4a981ae8ca01ba7b196668a7f72b9e", "score": "0.6006193", "text": "def glob_match(filenames, pattern)\n\t\n\tnewPattern = pattern.gsub( '*', '.*').gsub( '?', '.')\n\n\treturn filenames.select{|i| i.match(/#{newPattern}/)}\n\t\nend", "title": "" }, { "docid": "a830b869646ba3df4616fa8627d88375", "score": "0.60025", "text": "def glob\n case @raw_image_files.first.filename\n when /^E.*dcm$/\n return 'E*.dcm'\n when /\\.dcm$/\n return '*.dcm'\n when /^I\\./\n return 'I.*'\n when /^I/\n return 'I*.dcm'\n when /.*\\.\\d{3,4}/\n return '*.[0-9]*'\n when /\\.0/\n return '*.0*'\n else\n return nil\n end\n # Note - To exclude just yaml files we could also just use the bash glob\n # '!(*.yaml), but we would have to list all exclusions. This may turn\n # out easier in the long run.\n end", "title": "" }, { "docid": "5b8c8bb03c4c13d2249d37454e0917a8", "score": "0.59843487", "text": "def find_file(file_name)\n match = Dir.glob(\"#{root_dir}/**/#{file_name}\")\n if match.empty?\n raise \"'File #{file_name}' not found anywhere under '#{root_dir}'\"\n elsif match.count > 1\n raise \"More than one file found with name: '#{file_name}'\"\n end\n match.first\n end", "title": "" }, { "docid": "64d33f6e01192942ce100ea997c4e1de", "score": "0.59795827", "text": "def find_files(path)\r\n Dir.entries(path).reject {|f| f =~ /^\\./} || Array.new\r\nend", "title": "" }, { "docid": "40f5967e98c36b13b2bbdef79049e676", "score": "0.5944592", "text": "def find_file_matching_pattern(search_dirs, pattern)\n search_dirs = [search_dirs] unless search_dirs.is_a?(Array)\n\n search_dirs.each do |d|\n matches = Dir.glob(File.join(d, pattern))\n return matches.first if matches.size > 0\n end\n return nil\n end", "title": "" }, { "docid": "4ed38196bab48f7c54558e42e49c88cc", "score": "0.59130013", "text": "def latest_file_path(name)\n files = Dir[\"#{ ENV[\"HOME\"] }/workspace/*#{ name }*.txt\"]\n throw RuntimeError if files.empty?\n\n files.sort_by! do |file_name|\n file_match_data = FILE_NAME_FORMAT.match file_name\n date_match_data = file_match_data.to_s.match DATE_FORMAT\n DateTime.parse(date_match_data.to_s)\n end\n files.last\n end", "title": "" }, { "docid": "7de069df84a364097966660c2c9ce9ec", "score": "0.5834998", "text": "def last_added(path)\n path += \"*\" unless path.index(\"*\")\n Dir.glob(path, File::FNM_CASEFOLD).select {|f| test ?f, f}.sort_by {|f| File.mtime f}.pop\n end", "title": "" }, { "docid": "547b2bcb66a239dce96f475e5e407dbe", "score": "0.5815271", "text": "def gmr dir, type, func\n file = Dir.glob(dir + '/*')\n .select { |f| File.send(type, f) }\n .max_by { |f| File.send(func, f) }\n file = File.basename(file) + '/' if file && type == :directory?\n return file.gsub('//', '/') if file\n\n nil\nend", "title": "" }, { "docid": "13e8aaa96d98b5ba06833302f018763b", "score": "0.57829803", "text": "def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end", "title": "" }, { "docid": "cc2276d281fcc8e1057f47807e27fac2", "score": "0.57275593", "text": "def resolve_glob(context, glob, base_path)\n base_path = Pathname.new(base_path)\n path_with_glob = base_path.dirname.join(glob).to_s\n\n Pathname.glob(path_with_glob).sort.select do |path|\n path != context.pathname && context.asset_requirable?(path)\n end\n end", "title": "" }, { "docid": "cc77f5675de0c4132dbe2ab84d55c992", "score": "0.572138", "text": "def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end", "title": "" }, { "docid": "cc77f5675de0c4132dbe2ab84d55c992", "score": "0.572138", "text": "def resolve_as_file_pattern name\n pattern = /(?:\\b|_)#{Regexp.escape name}(?:\\b|_)/\n all_matching_files.select {|p| p =~ pattern }\n end", "title": "" }, { "docid": "8b6d299ef46543d942faf1384f183b94", "score": "0.57104695", "text": "def files() = files_path.glob('**/*')", "title": "" }, { "docid": "19c18215403fd3bc4a86f4b3746c7558", "score": "0.56977063", "text": "def compute_glob_pattern(file_spec)\n segments = file_spec.split(Repositext::Cli::FILE_SPEC_DELIMITER)\n r = ''\n if segments.all? { |e| e =~ BASE_DIR_NAME_REGEX || e =~ FILE_PATTERN_NAME_REGEX }\n # file_spec consists of named base_dir and/or file_pattern\n bd = segments.detect { |e| e =~ BASE_DIR_NAME_REGEX } # e.g., 'content_dir'\n fp = segments.detect { |e| e =~ FILE_PATTERN_NAME_REGEX } # e.g., 'at_files'\n r << base_dir(bd) if bd\n r << file_pattern(fp) if fp\n else\n # interpret file_spec as glob pattern, either an absolute path, or\n # a relative path, based on current working directory.\n # NOTE: this doesn't necessarily have to contain '*'. It could be the\n # path to a single file.\n if '/' == file_spec[0]\n # absolute path, use as is\n r = file_spec\n else\n # relative path, based on current working directory\n # Note: we could use just the file_spec since relative paths are\n # based on pwd by default. I just wanted to make the behavior obvious.\n r = File.expand_path(file_spec, Dir.pwd)\n end\n end\n r\n end", "title": "" }, { "docid": "1202438161d7ecd2c9bc3c94fd4fbbe2", "score": "0.56878346", "text": "def find_with_glob(path, find_flags = 0, gave_char_class = false, dir: nil)\n parts = path_parts(normalize_path(path, dir: dir))\n return fs if parts.empty? # '/'\n\n entries = Globber.expand(path).flat_map do |pattern|\n parts = path_parts(normalize_path(pattern, dir: dir))\n find_with_glob_recurser(fs, parts, find_flags, gave_char_class).flatten\n end\n\n case entries.length\n when 0 then nil\n when 1 then entries.first\n else entries\n end\n end", "title": "" }, { "docid": "026da29703d0d6ae4e6d48882c1e59b2", "score": "0.5681599", "text": "def glob_match(filenames, pattern)\n pattern = pattern.gsub(/[\\*\\?\\.]/, '*' => '.*', '.' => '\\.', '?' => '.')\n regex = Regexp.new(pattern)\n filenames.select do |filename|\n filename =~ regex\n end\nend", "title": "" }, { "docid": "ff8ca0fb3a45462c3c8f0b12e5e593b4", "score": "0.5678455", "text": "def find_files(pattern)\n Dir[File.join(folder, pattern, \"*.#{pattern}\")].sort{|f1, f2|\n File.basename(f1) <=> File.basename(f2)\n }.collect{|f|\n File.join(pattern, File.basename(f))\n }\n end", "title": "" }, { "docid": "10a5e0ede801a39a01edb56237fc4965", "score": "0.56783175", "text": "def glob(pattern, &block)\n result = @lock.with_read_lock { @paths.flat_map { |path| path.glob(pattern, &block) }}\n result unless block\n end", "title": "" }, { "docid": "876714293265f8b6572f271cf37f92ff", "score": "0.5676006", "text": "def each_existing_path pattern, pathname_test = :exist?, &blk # :yields: corresponding_pathname\n attempts = []\n raise \"No paths to search for #{pattern}\" if @search_paths.nil? || @search_paths.empty?\n @search_paths.each do |path|\n path = (path + pattern).expand_path\n matches = Array(Pathname.glob(path).select(&pathname_test))\n attempts << path.to_s\n matches.each(&blk)\n end\n attempts\n end", "title": "" }, { "docid": "59b0c3c9bbf92fcd108a7755d41b5d42", "score": "0.56692326", "text": "def file_paths\n Dir.glob(@filepath_pattern).sort\n end", "title": "" }, { "docid": "0b6ca43e91609248abab55301e9279b8", "score": "0.56571364", "text": "def glob(pattern, flags = T.unsafe(nil)); end", "title": "" }, { "docid": "6892abb3121a87862228306a45c5b79a", "score": "0.5652809", "text": "def glob_match (filenames, pattern)\n\t# Escape the '*', '?', and '.' characters\n\tpattern.gsub!(/[\\*\\?\\.]/, '*' => '.*', '?' => '.', '.' => '\\.') \t\n\tregex = Regexp.new(pattern)\n\t#select returns a new array\n\tfilenames.select do |filename|\n\t\tfilename =~ regex\n\tend\nend", "title": "" }, { "docid": "98a03e318107761089d84d24c35cde42", "score": "0.5651374", "text": "def test_fallback_exists\n File.unstub :exist?\n tested 'fallback rms.jpg'\n\n files = Dir.glob(temp_dir('generated') + '/rms-35-?????????.webp')\n\n assert_equal 1, files.length\n end", "title": "" }, { "docid": "285ed8f940a4643162a366c931f82049", "score": "0.5648229", "text": "def file_patterns_errors\n messages = []\n messages << \"The sources did not match any file\" if [email protected]_files.empty? && @pod.source_files.empty?\n messages << \"The resources did not match any file\" if [email protected]? && @pod.resource_files.empty?\n messages << \"The preserve_paths did not match any file\" if [email protected]_paths.empty? && @pod.preserve_files.empty?\n messages << \"The exclude_header_search_paths did not match any file\" if [email protected]_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?\n messages\n end", "title": "" }, { "docid": "b98c3e2b0bffbe9107264198407caa37", "score": "0.5638277", "text": "def generate_glob_filter(glob)\n # Negative glob starts with '!'\n negative = glob.start_with?('!')\n # Strip leading '!' then\n glob.remove_prefix!('!') if negative\n lambda do |path|\n matches = File.fnmatch(glob, path, GLOB_MATCH_MODE)\n # inverse match if glob is negative\n matches = !matches if negative\n matches\n end\n end", "title": "" }, { "docid": "7efb717d3ca6ed41e2de17d98cb86381", "score": "0.5636913", "text": "def get_non_flac_paths(source_path)\n non_flac_file_paths = Find.find(source_path).reject {|f| f.end_with?(\".flac\")}\n non_flac_file_paths.reject! {|e| !File.file?(e) }\n return non_flac_file_paths\nend", "title": "" }, { "docid": "2434af213d7e43b088a1ea4f4d3dac3d", "score": "0.56200033", "text": "def safe_glob(dir, patterns, flags = T.unsafe(nil)); end", "title": "" }, { "docid": "0421caed4a0dac708561190411fd46bd", "score": "0.56190646", "text": "def glob\n \"**/*\"\n end", "title": "" }, { "docid": "8826ad8fde1f805f503f35ef62d167ad", "score": "0.5613094", "text": "def file_glob\n if file_types.nil?\n '*'\n else\n \"*{#{file_types.join(',')}}\"\n end\n end", "title": "" }, { "docid": "bf7de2f6e440e03eb3b127d4d03f56c1", "score": "0.56083506", "text": "def check_file(filename,patchdir)\n if !filename.match(/\\//)\n patch_list = Dir.entries(patchdir)\n filename = patch_list.grep(/#{filename}/)[0].chomp\n filename = patchdir+\"/\"+filename\n end\n if !File.exist?(filename)\n puts \"File: \"+filename+\" does not exist\"\n exit\n else\n puts \"File: \"+filename\n end\n return filename\nend", "title": "" }, { "docid": "5625dae50ae03f76e8b0e6dc3e79e2dd", "score": "0.56047416", "text": "def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end", "title": "" }, { "docid": "4b0c96febad0d8d4bbca58d2e6fa7c57", "score": "0.5601696", "text": "def prepare_exception_globs(exceptions_file, source_dir)\n source_path = File.expand_path(source_dir)\n globs = []\n File.open(exceptions_file) do |file|\n file.each do |line|\n glob = line.strip\n if (glob.length > 0) && (glob[0..0] != '#')\n globs << \"#{source_path}/#{glob}\".gsub('//', '/')\n end\n end\n end\n return globs\n end", "title": "" }, { "docid": "3eecc79e40830b5f992569602d67b881", "score": "0.55945563", "text": "def excluded?(fn, globs)\n # [mlr] some patterns won't be matched correctly without an\n # absolute pathname.\n fn = File.expand_path(fn)\n globs.reduce(nil) do |matched, glob|\n if matched.nil? then\n if File.fnmatch?(File.expand_path(glob), fn) then\n #puts \"+++ File.fnmatch?(#{File.expand_path(glob)}, #{fn}) => true\"\n glob\n else\n #puts \"+++ File.fnmatch?(#{File.expand_path(glob)}, #{fn}) => false\"\n nil\n end\n else\n matched\n end\n end\n end", "title": "" }, { "docid": "131ceeb5bea8d3ac59106c6b9947f36d", "score": "0.55912757", "text": "def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend", "title": "" }, { "docid": "21b5e606357e79ca974b5002388fdc34", "score": "0.5580766", "text": "def file\n if glob = file_map['vclog']\n Dir.glob(glob).first\n else\n Dir.glob(DEFAULT_GLOB).first\n end\n end", "title": "" }, { "docid": "1de2f6e159b8fe3c539bf2bd98621058", "score": "0.55735457", "text": "def path_to glob\n paths_to(glob).first\n end", "title": "" }, { "docid": "122c29da9a11fa217f6f54e3268f3fa1", "score": "0.55694205", "text": "def glob(pattern)\n root = self.root\n Pathname.glob(root.join(pattern)).map do |match|\n match.relative_path_from(root).to_s\n end\n end", "title": "" }, { "docid": "1addf8f1b4be58bf83856db05a61b507", "score": "0.5563752", "text": "def glob(pattern)\n Glob.new(@shell, pattern)\n end", "title": "" }, { "docid": "c0f7eb3cae076ee9987e157f4e472174", "score": "0.5556074", "text": "def resolve_glob(context, glob, base_path)\n base_path = Pathname.new(base_path)\n path_with_glob = base_path.dirname.join(glob).to_s\n\n Pathname.glob(path_with_glob).sort.select do |path|\n asset_requirable = asset_requirable?(context, path)\n path != context.pathname && asset_requirable\n end\n end", "title": "" }, { "docid": "6516e979835dd7bcc17f8bf25ef03e28", "score": "0.555053", "text": "def get_local_files regexp\n Dir[File.join(dir, '*')].select do |path|\n name = File.basename path\n File.file?(path) and name =~ regexp\n end\n end", "title": "" }, { "docid": "1a0511013567ab4265261066fc128009", "score": "0.55460334", "text": "def find_broken_src_from_log( file )\n broken_src = []\n IO.foreach(file) do |line|\n if is_src?(line)\n src = extract_src(line)\n broken_src << src\n elsif is_time?(line)\n broken_src.pop\n end\n end\n broken_src\nend", "title": "" }, { "docid": "4e8ab255ddff178a8446be49b6138c07", "score": "0.5544966", "text": "def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend", "title": "" }, { "docid": "1c5660b4dc34d175495eea1ed65f5252", "score": "0.5542765", "text": "def findFiles(mamaDirectory, fileExtension)\r\n\t$logger.debug { \": Looking for '\" + fileExtension + \"' in '\" +\r\n\t\tmamaDirectory + \"' ...\" }\r\n\t# Rather than get all recursive, just check a couple levels down.\r\n\t# If the files aren't within those levels, there's a problem.\r\n\textFiles = Dir.glob mamaDirectory + \"/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*\" + fileExtension\r\n\textFiles += Dir.glob mamaDirectory + \"/*/*/*\" + fileExtension\r\n\tif (extFiles.size <= 0)\r\n\t\t$logger.debug { \" No files found!\" }\r\n\t\treturn nil;\r\n\tend\r\n\treturn extFiles\r\nend", "title": "" }, { "docid": "0fb418692d75e2d7563dbbfd08d01a41", "score": "0.5539156", "text": "def glob; end", "title": "" }, { "docid": "1c027964f0bafed4eb3986c8650f9b2c", "score": "0.55205876", "text": "def ovl_glob(rel_pattern)\n gem_files = Dir.glob(File.join(GEM_ROOT, rel_pattern)).map do |path|\n path.sub(GEM_ROOT+\"/\", \"\")\n end\n\n (gem_files + Dir.glob(rel_pattern)).uniq\n end", "title": "" }, { "docid": "1c027964f0bafed4eb3986c8650f9b2c", "score": "0.55205876", "text": "def ovl_glob(rel_pattern)\n gem_files = Dir.glob(File.join(GEM_ROOT, rel_pattern)).map do |path|\n path.sub(GEM_ROOT+\"/\", \"\")\n end\n\n (gem_files + Dir.glob(rel_pattern)).uniq\n end", "title": "" }, { "docid": "48968b67b708289e91d97a389f0a93cf", "score": "0.5513656", "text": "def get_files_by_mtime dir='*'\n gfb dir, :mtime\nend", "title": "" }, { "docid": "0f103e871731f9121cbe6303de86f74d", "score": "0.55073166", "text": "def glob(pat, path='/')\n # FIXME : implement\n raise('not implemented')\n # FIXME: verify and update\n # FIXME: test\n #regex = /^#{pat.gsub('*','.*').gsub('?','.?')}$/ \n #find(path) { |fname| fname =~ regex }\n end", "title": "" }, { "docid": "b7a2dbf6bc2080daffbcea359ac2496b", "score": "0.5488154", "text": "def safeGlob(dir,wildcard)\n ret = []\n afterChdir = false\n begin\n Dir.chdir(dir) {\n afterChdir = true\n Dir.glob(wildcard) { |f| ret.push(dir+\"/\"+f) }\n }\n rescue Errno::ENOENT\n raise if afterChdir\n end\n if block_given?\n ret.each { |f| yield(f) }\n end\n return (block_given?) ? nil : ret\nend", "title": "" }, { "docid": "e92464f915c83b644f67c140c5966e23", "score": "0.5486392", "text": "def search_for_file(path_suffix)\n path_suffix += \".rb\" unless path_suffix.ends_with?(\".rb\")\n\n autoload_paths.each do |root|\n path = File.join(root, path_suffix)\n return path if File.file? path\n end\n nil # Gee, I sure wish we had first_match ;-)\n end", "title": "" }, { "docid": "1d502548b3c01df5ecaa9456f7ed58e0", "score": "0.5478388", "text": "def safeGlob(dir,wildcard)\n ret=[]\n afterChdir=false\n begin\n Dir.chdir(dir){\n afterChdir=true\n Dir.glob(wildcard){|f|\n ret.push(dir+\"/\"+f)\n }\n }\n rescue Errno::ENOENT\n raise if afterChdir\n end\n if block_given?\n ret.each{|f|\n yield(f)\n }\n end\n return (block_given?) ? nil : ret\nend", "title": "" }, { "docid": "8d949d68cebed9158435dc27b11505f3", "score": "0.5473162", "text": "def get_unknown_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-un', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"New files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend", "title": "" }, { "docid": "e4869980fd4ac452b3b7131273d1ea54", "score": "0.5470175", "text": "def lookup(glob, flags=0)\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n paths = Dir.glob(File.join(pwd, glob), flags)\n return paths unless paths.empty?\n break if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return []\n end", "title": "" }, { "docid": "a79e89e18c416945069ead918b8e9357", "score": "0.5468726", "text": "def last_used_counter\n directory_glob.inject(0) do |high_value, file|\n counter = get_counter_for_file(file)\n ((high_value <=> counter) == 1) ? high_value : counter\n end\n end", "title": "" }, { "docid": "a1e13fa3a5634e33c99298f055d00b39", "score": "0.54614717", "text": "def safeGlob(dir,wildcard)\n ret=[]\n afterChdir=false\n begin\n Dir.chdir(dir){\n afterChdir=true\n Dir.glob(wildcard){|f|\n ret.push(dir+\"/\"+f)\n }\n }\n rescue Errno::ENOENT\n raise if afterChdir\n end\n if block_given?\n ret.each{|f|\n yield(f)\n }\n end\n return (block_given?) ? nil : ret\nend", "title": "" }, { "docid": "e3a299a141d78d093102f838d040b5bb", "score": "0.54608136", "text": "def check_spec_files_exists(spec, accessor, platform_name, options = {})\n result = []\n patterns = spec.send(accessor)[platform_name]\n patterns.map do |pattern|\n pattern = Pathname.pwd + pattern\n if pattern.directory? && options[:glob]\n pattern += options[:glob]\n end\n result << \"#{platform_name}: [#{accessor} = '#{pattern}'] -> did not match any file\" if pattern.glob.empty?\n end\n result\n end", "title": "" }, { "docid": "1fe26669734f13d29d45445657039fe5", "score": "0.5447993", "text": "def last_modified_in dir\n Dir.glob( File.join( dir,'*' ) ).\n select {|f| File.file? f }.\n sort_by {|f| File.mtime f }.\n last\nend", "title": "" }, { "docid": "466ba911a12b5bfb666428b96c7cd913", "score": "0.5445753", "text": "def glob(pattern = '**/*', **_opts)\n Enumerator.new do |y|\n walk(pattern) do |path, entry|\n y << file_info(path, entry) if File.fnmatch?(pattern, path, File::FNM_PATHNAME)\n end\n end\n end", "title": "" }, { "docid": "ea7ca8565b69c067bb49e2aff00cdb8c", "score": "0.5434589", "text": "def regex_files(files, regex=nil)\n array = files.nil? ? [] : files\n if !files.nil? && !regex.nil?\n exp = Regexp.new(regex)\n array = files.select do |file|\n file_name = File.basename(file, \".*\")\n match = exp.match(file_name)\n !match.nil? # return this line\n end\n end\n return array\nend", "title": "" }, { "docid": "4bea79cebb0368840eb003928446b176", "score": "0.5429852", "text": "def find_files dir = test_dir\n glob file_pattern(dir)\n end", "title": "" }, { "docid": "a94b6b0d2f337d961bdc0339a02092f6", "score": "0.54241925", "text": "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "title": "" }, { "docid": "161adb930ab82768ddd12b9f8678f68d", "score": "0.54239726", "text": "def file_search\n #Checks the current folder for python files\n py_files = Dir.glob('*.py')\n #Checks if files exist, exists if not\n if py_files != []\n file_output(py_files)\n else\n puts \"You got lucky, Motherasshole!\"\n end\nend", "title": "" }, { "docid": "b5f75469c7461039f70cdba2f1a0e503", "score": "0.5419428", "text": "def find_file(name)\n if (explicit = folder/name.to_s).file?\n explicit\n else\n folder.glob(\"#{name}.*\").find{|f| f.file?}\n end\n end", "title": "" }, { "docid": "5b46c7af2f90238b974c7fa8d409b6d5", "score": "0.54147243", "text": "def file_pattern(name)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n get_config_val(@file_patterns, name)\n end", "title": "" }, { "docid": "b22a47bd3e0e76336b904e11eefedfa8", "score": "0.5413026", "text": "def glob(path, options = {})\n path = File.expand_path(path)\n if File.file?(path) || options[:no_recurse] == true\n [path]\n else\n [path] + Dir.glob(\"#{path}/**/*\", File::FNM_DOTMATCH).reject{|f| IMPLIED_DIR_ENTRIES =~ f }\n end\n end", "title": "" }, { "docid": "12da502b51cda2627f97a1c65cc2a23c", "score": "0.5411896", "text": "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "title": "" }, { "docid": "b00be5addad6e3b6cc282b41cb35454f", "score": "0.5408028", "text": "def file_matching_path\n !!container.stored_files.where(file_name: file_name, path: path).first\n end", "title": "" }, { "docid": "3ed9e238ac822140088e28e44d543efe", "score": "0.5407766", "text": "def existing\n select { |fn| File.exist?(fn) }.uniq\n end", "title": "" }, { "docid": "0fd814cc034feae38d5b06579f61a697", "score": "0.5405574", "text": "def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend", "title": "" }, { "docid": "74fb5906ef6a688d87177dc5f26f5b59", "score": "0.5400899", "text": "def find_free_name(filename); end", "title": "" }, { "docid": "55a36a672c398e641ef39af9de932cf8", "score": "0.53963935", "text": "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", "title": "" }, { "docid": "8ac0bbd6c8a54a19bd25ac29f3952958", "score": "0.5396038", "text": "def check_file(filenames)\n filenames.select{ |f| File.exists?(f) }.first\n end", "title": "" }, { "docid": "d017c1bf7e6209c08d740bf5da001629", "score": "0.53916824", "text": "def get_last_version\n files = Dir.glob($d + \"/**/*.yaml\").sort do |a,b| -(File.basename(a).to_i <=> File.basename(b).to_i) end\n# files.each do |a| puts File.basename(a) end\n return File.basename(files.first).to_i\nend", "title": "" }, { "docid": "97f06f2bc48df32b5b873d7bb914db4a", "score": "0.5387552", "text": "def chardev_glob(glob='./*')\n Dir[glob].select {|f| File::Stat.new(f).chardev? }\n end", "title": "" }, { "docid": "382f30314b524f64cec38e35a4d4d36c", "score": "0.5384213", "text": "def file(glob)\n \"**/#{glob}\"\n end", "title": "" }, { "docid": "1c73abcb11af1024d252e644dffcbb23", "score": "0.5377557", "text": "def filter_files(pattern)\n regexp=Regexp.new(pattern || '.*')\n @[email protected]([]) do |matches,file| \n file_without_basepath=file[@basepath.length .. -1]\n matches << file if file_without_basepath=~regexp\n matches\n end\n @table.reloadData\n end", "title": "" }, { "docid": "afbad43f9f44fb893687d096a3f89a40", "score": "0.53745675", "text": "def glob(path, pattern, flags=0)\n flags |= ::File::FNM_PATHNAME\n path = path.chop if path[-1,1] == \"/\"\n\n results = [] unless block_given?\n queue = entries(path).reject { |e| e.name == \".\" || e.name == \"..\" }\n while queue.any?\n entry = queue.shift\n\n if entry.directory? && !%w(. ..).include?(::File.basename(entry.name))\n queue += entries(\"#{path}/#{entry.name}\").map do |e|\n e.name.replace(\"#{entry.name}/#{e.name}\")\n e\n end\n end\n\n if ::File.fnmatch(pattern, entry.name, flags)\n if block_given?\n yield entry\n else\n results << entry\n end\n end\n end\n\n return results unless block_given?\n end", "title": "" }, { "docid": "c397a200711c88461dfa4818094cec4c", "score": "0.5365884", "text": "def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n #Looking for files where occurs: phrase_we_have_now\n files_to_check.each do |one_file|\n file = File.open(one_file, \"r\") do |f|\n f.each_line do |line|\n reg = /.*#{@phrase_we_have_now}.*/\n if line.match?(reg)\n result_files_with_phrase << one_file\n end\n end\n end\n end\n if result_files_with_phrase.length == 0\n puts \"\\n\\e[31m\\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\\e[31m\"\n exit\n end\n result_files_with_phrase.uniq.sort\n end", "title": "" }, { "docid": "fc80dbb53cca30570db5eda8d27755d3", "score": "0.53549105", "text": "def find_file_path(filename)\n filepath=\"#{ENV['IMPORT_PATH']}/#{filename}\"\n #filepath = Dir.glob(\"#{ENV['IMPORT_PATH']}/#{filename}\").first\n raise \"Cannot find file #{filename}... Are you sure it has been uploaded and that the filename matches?\" if filepath.nil?\n filepath\n end", "title": "" }, { "docid": "74119d55e3ba5a006e5a66aeaf2c3d33", "score": "0.5350207", "text": "def latest_file_index\n latest_index = 0\n latest_time = Time.at(0)\n (0..MAX_SAVE_SLOT-1).each do |i|\n filename = make_filename(i)\n next if !FileTest.exist?(filename)\n file_time = File.mtime(filename)\n if file_time > latest_time\n latest_time = file_time\n latest_index = i\n end\n end\n return latest_index\n end", "title": "" }, { "docid": "890baec7d16c22dcea6ba141a148ad29", "score": "0.53449243", "text": "def directory_glob\n glob = File.join(directory_path, \"#{globular_file_parts}.*\")\n Dir.glob(glob)\n end", "title": "" }, { "docid": "f2e6cfa0b109b53bc162dd750c113f00", "score": "0.5343303", "text": "def glob(*globs)\n files.find_all do |path|\n globs.any? { |pattern| File.fnmatch(pattern, path, File::FNM_EXTGLOB) }\n end\n end", "title": "" }, { "docid": "e1d6b786b92ac273078b8871d94b0a8b", "score": "0.53370845", "text": "def last_added(path)\n path += \"*\" unless path.index(\"*\")\n Dir[path].select {|f| test ?f, f}.sort_by {|f| File.mtime f}.pop\n end", "title": "" }, { "docid": "822ba22b54d42273c632871f328afb92", "score": "0.53358644", "text": "def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end", "title": "" }, { "docid": "c021e0cedc761302240826466a44e0a2", "score": "0.5335106", "text": "def current\n entries = Dir.glob(\"#{self.ftp_upload_directory}/*.jpg\")\n # File.mtime is modified time.\n res = entries.max_by {|f| File.mtime(f)}\n if (res == nil)\n raise NoPictureException.new(\"No Latest Picture\")\n end\n return res\n end", "title": "" }, { "docid": "c45ef3f62981a34b765623a23ca569ed", "score": "0.53299886", "text": "def file_patterns\n [@file_patterns].flatten.compact.uniq\n end", "title": "" }, { "docid": "06d57c59c3ba73c321ae3d90d119770c", "score": "0.53295976", "text": "def find(name)\n # look into each gempath for a matching file, sort by version (roughly), \n # and return the last hit\n gem_paths.\n map { |gem_path| Dir.glob(\"#{gem_path}/gems/#{name}-[0-9]*\") }.\n flatten.\n sort_by { |gem_path| gem_path.gsub(/.*\\/gems\\/[^-]+-/, \"\") }.\n last\n end", "title": "" }, { "docid": "70af7fea665fe0770c8fbeba32e94483", "score": "0.5324398", "text": "def look_for_most_recent_log\n newest_time = nil\n newest_file = nil\n\n Dir.foreach(LOGS_DIR) do |dirEntry|\n dirEntry = LOGS_DIR + dirEntry\n if is_log_file dirEntry\n if (newest_time == nil || (File.mtime(dirEntry) <=> newest_time) > 0)\n newest_time = File.mtime(dirEntry)\n newest_file = dirEntry\n end\n end\n end\n\n newest_file\n end", "title": "" }, { "docid": "8f16f3c64cf461ab203abe17fdcd2d3c", "score": "0.53170055", "text": "def last_added_dir(path)\n path += \"*\" unless path.index(\"*\")\n Dir.glob(path + \"/*/\", File::FNM_CASEFOLD).sort_by {|f| File.mtime f}.pop\n end", "title": "" }, { "docid": "380817cbc3d2f07e8dac4ff3cc2b7ddb", "score": "0.5313709", "text": "def files_named(name_pattern, minimum_size)\n @top_level.select do |fso|\n fso['type'] == 'file' && fso['name'].match(name_pattern) &&\n fso['size'] >= minimum_size\n end\n end", "title": "" }, { "docid": "af92ec95a0d357fad9715bfef2241c02", "score": "0.53118885", "text": "def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end", "title": "" } ]
207877a4e8df264b8fac46ba3cf6f6f1
Close the connection to twitter without closing the eventmachine loop
[ { "docid": "d719226d40682d2792c4479e85793882", "score": "0.5998591", "text": "def close_connection\n @stream.close_connection if @stream\n end", "title": "" } ]
[ { "docid": "6ac43b066370202a9a2ab30ab8757d85", "score": "0.75600815", "text": "def close\n puts \"closing twitter stream\"\n @stop = true\n @connection.finish if @connection\n Thread.pass\n rescue IOError\n #raised if not already started, so no action\n rescue StandardError => e\n puts \"rescued in close: #{e.class} #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end", "title": "" }, { "docid": "88425757d47943a6a789ceb23860fe36", "score": "0.7169589", "text": "def kill_twitter_thread\n @twitter_thread.kill!\n end", "title": "" }, { "docid": "c471a9ac6db5c2b614c3b6ef59b74ce5", "score": "0.7021402", "text": "def shutdown\n EM.add_timer(2, lambda { @connection.close {EM.stop}})\n end", "title": "" }, { "docid": "d1544bfb706cca30544668354bfcfda5", "score": "0.6949871", "text": "def event_loop_connection_close\n @em_connection.close_connection if @em_connection\n end", "title": "" }, { "docid": "09bd1ca37c69960cf52c88f43348a591", "score": "0.68337876", "text": "def close\n bot.close\n end", "title": "" }, { "docid": "21ac38b13cd6cadabd1ce9ef2d356b38", "score": "0.66961664", "text": "def close\n close_async.get\n end", "title": "" }, { "docid": "21ac38b13cd6cadabd1ce9ef2d356b38", "score": "0.66961664", "text": "def close\n close_async.get\n end", "title": "" }, { "docid": "5dc3aaf4af72cbed988c0d6bb2d0986f", "score": "0.6602368", "text": "def close\n @pool.all_connections do |conn|\n conn.unregister_from_event_loop\n conn.close\n end\n end", "title": "" }, { "docid": "5dc3aaf4af72cbed988c0d6bb2d0986f", "score": "0.6602368", "text": "def close\n @pool.all_connections do |conn|\n conn.unregister_from_event_loop\n conn.close\n end\n end", "title": "" }, { "docid": "72b2c64caccabc31e16d7c993618c405", "score": "0.6522073", "text": "def close\n return if @closed\n @closed = true\n @web_socket.close\n @web_socket = nil\n self.class.em_stop\n self\n end", "title": "" }, { "docid": "f1b4c599db4f163146da6bf82d4b4d67", "score": "0.6509246", "text": "def close\n @connection.disconnect\n @running = false \n end", "title": "" }, { "docid": "c00e83c54a267e873ca09fb3a3831eed", "score": "0.6500415", "text": "def close\n @connection.disconnect\n @running = false\n end", "title": "" }, { "docid": "94f94c6f1681c45bcc1a794ef46c9e75", "score": "0.64943385", "text": "def shutdown\n http.shutdown\n end", "title": "" }, { "docid": "218448f187fdaf5773f441921e0b1a27", "score": "0.64867836", "text": "def close\n wait_all_sent\n @http.shutdown\n end", "title": "" }, { "docid": "e6c23020f27949d9861f48d29089f9a5", "score": "0.64759475", "text": "def close\n @unbound = true\n EM.next_tick(method(:close_connection_after_writing))\n event(:connection_close, :signature => @signature, :msec => msec)\n end", "title": "" }, { "docid": "34997762696ad2896fc5cd6ddc1478d3", "score": "0.6475315", "text": "def shutdown\n @connection.close\n end", "title": "" }, { "docid": "bbf0f2f4602b0fece3f05c691ccab146", "score": "0.644927", "text": "def shutdown\n @active = false\n client.close_connection\n end", "title": "" }, { "docid": "ea38e3f61668dd4826df3f96b6bb96ad", "score": "0.64235497", "text": "def close!\n close_connection\n end", "title": "" }, { "docid": "57e9de099358325909fb537410e8100e", "score": "0.6402001", "text": "def async_close!\n client.async_close if open?\n end", "title": "" }, { "docid": "f2f5ce98d1ad6f3bcfebbfd3651303bc", "score": "0.6381439", "text": "def shutdown\n @should_close = true\n close_connection(false)\n end", "title": "" }, { "docid": "dda8255e69a0da7e5c9d8e606bb9c098", "score": "0.63812727", "text": "def stop\n log 'Stopping'\n EventMachine.stop_server(@em)\n @connections.each { |c| c.close_connection_after_writing }\n EventMachine.add_periodic_timer(1) do\n if @connections.empty?\n EventMachine.stop\n true\n else\n log \"Waiting for #{@connections.size} connections to close\"\n false\n end\n end\n end", "title": "" }, { "docid": "2b899d5202c9414ee1258eefb0e0651b", "score": "0.6375503", "text": "def close\n @connector.close\n end", "title": "" }, { "docid": "7f9fbdb6be0f830f1a940e9a3c50ed94", "score": "0.6365881", "text": "def shutdown!\n @manager.disconnect(@raw_conn)\n end", "title": "" }, { "docid": "a83d8994c58040c35486479363adf8ba", "score": "0.63655895", "text": "def close\n @client.close\n Thread.current.exit\n end", "title": "" }, { "docid": "1126f3443752115b45d7c2dff9b2281e", "score": "0.6358888", "text": "def close\n self.echo_thread.kill rescue nil\n # Give the meterpreter shutdown command a chance\n self.write_queue.close\n begin\n if self.write_thread.join(2.0)\n self.write_thread.kill\n end\n rescue\n end\n\n # close pipe, share, and socket\n super rescue nil\n self.simple.disconnect(self.simple.last_share) rescue nil\n self.client.socket.close\n end", "title": "" }, { "docid": "64100bdacf71e5f123e3e340bdd50053", "score": "0.63403386", "text": "def disconnect\n StropheRuby::EventLoop.stop(@ctx)\n end", "title": "" }, { "docid": "79ee0dc37620e08d8542b997b5dfdbf0", "score": "0.6334317", "text": "def event_loop_connection_close\n key = em_connection_with_pool_key\n @fiber[key].close_connection if @fiber[key]\n end", "title": "" }, { "docid": "d2ca1523c3462bcaf3ed119a6484647c", "score": "0.6324798", "text": "def close\n @update_manager.stop\n TD::Api.client_destroy(@td_client)\n end", "title": "" }, { "docid": "7f77321362bb6a0df08dbc5b14904893", "score": "0.6317487", "text": "def close\n @shutdown_mutex.lock\n end", "title": "" }, { "docid": "f2ba4674ebb1306b18bcf357c1c9fcf0", "score": "0.631085", "text": "def shutdown\n self.close()\n end", "title": "" }, { "docid": "71f4f9ad91c48da3966787b1151b3c38", "score": "0.6300463", "text": "def disconnect\n EM.next_tick { @connection.close_connection }\n end", "title": "" }, { "docid": "1cf39aeae1f8eb760fe764424bff5302", "score": "0.62793237", "text": "def close_connection\n @client.close\n end", "title": "" }, { "docid": "8c5d05493c50550f8ffbc5a20179405f", "score": "0.6251799", "text": "def shutdown!\n close\n end", "title": "" }, { "docid": "f3f5a6cfff6f7fff53c48f33bac6a09f", "score": "0.6229235", "text": "def disconnect!\n raw_connection.close\n end", "title": "" }, { "docid": "63c0c74ba5753486f368f1725a00c63f", "score": "0.62159866", "text": "def close\n close_connection(CLOSED, true)\n end", "title": "" }, { "docid": "009e5a7e740a67fdd90e71e0ecdb0e8a", "score": "0.62108207", "text": "def term\n @conn.close\n @thread.wakeup\n end", "title": "" }, { "docid": "22f4035c0c0bcba6a8ef79ad02da1a84", "score": "0.61996925", "text": "def close(timeout=2)\n \[email protected](timeout)\n end", "title": "" }, { "docid": "befa2f28b8c493f1d9ba4a15ed104008", "score": "0.6194567", "text": "def close!\n\n\t @wordnet_connection.close!\n\n\tend", "title": "" }, { "docid": "b4577e3bf368ff055a7aaad8ff3b5d50", "score": "0.6192617", "text": "def close\n\t\tself.stop\n\t\tself.http_client.finish\n\trescue IOError\n\t\t# ignore it since http session has not yet started.\n\tend", "title": "" }, { "docid": "d89431266156a93de05d0916cbfa03d1", "score": "0.6185383", "text": "def close\n return if @state == :closed\n @state = :closed\n # TODO: server MAY wait streams\n callback(:close)\n end", "title": "" }, { "docid": "0f9f33572ebfaa04f645e83b2b036e08", "score": "0.61797065", "text": "def stop\n connection.close if connection\n end", "title": "" }, { "docid": "7f1191bfdd8f234aa201909a76dd6621", "score": "0.61747396", "text": "def goodbye_my_love!\n debug 'Tearing down connection'\n if(socket && !socket.closed?)\n [lambda{ socket.write Command::Cls.new.to_line}, lambda{socket.close}].each do |action|\n begin\n action.call\n rescue IOError, SystemCallError => e\n warn \"Socket error encountered during teardown: #{e.class}: #{e}\"\n end\n end\n end\n @socket = nil\n info 'Connection torn down'\n nil\n end", "title": "" }, { "docid": "3856919f30aae3c6a61c565277f68976", "score": "0.6174641", "text": "def close\n if @stopped.make_true\n reset_http\n end\n end", "title": "" }, { "docid": "001493f0f3a3453d6ea5e8ccf17f541a", "score": "0.61704665", "text": "def close()\n \t\tprint(\"\\r\\nClosing the connection. Bye!\")\n \t\[email protected] unless @client.closed?\n\tend", "title": "" }, { "docid": "9c08b88c9a1ffc451391cfc4421cdbfb", "score": "0.6164899", "text": "def close\n @client.close\n @client = nil\n end", "title": "" }, { "docid": "7dfdfc523a716ad430ee032435af596d", "score": "0.61614954", "text": "def close\n @client.disconnect\n end", "title": "" }, { "docid": "63691aca087bc6ec2b2e51b6bc395a47", "score": "0.61612517", "text": "def close\n # If the user doesn't call this they will leak memory, because the receive\n # thread will hang around... so yeah, call close. :)\n destroy_connection\n rescue\n nil\n ensure\n @recv_thread && @recv_thread.kill\n end", "title": "" }, { "docid": "30b7761cd68a5b9a88ab956258aa89e2", "score": "0.6159327", "text": "def quit\n @xml['twitter'].destroy \n Gtk.main_quit\n @poller.stop\n @poster.join if @poster\n @maddie.take_snapshot\n end", "title": "" }, { "docid": "f385922a5bf43a84f5a21586c09601ac", "score": "0.6152872", "text": "def close\n @connection_manager.close\n end", "title": "" }, { "docid": "198a9dfca7a0fd844e183ad2a12a4ff2", "score": "0.6148126", "text": "def close\n @socket.close\n end", "title": "" }, { "docid": "198a9dfca7a0fd844e183ad2a12a4ff2", "score": "0.6148126", "text": "def close\n @socket.close\n end", "title": "" }, { "docid": "198a9dfca7a0fd844e183ad2a12a4ff2", "score": "0.6148126", "text": "def close\n @socket.close\n end", "title": "" }, { "docid": "2854959539b813325b6f1716c483a2db", "score": "0.6141148", "text": "def shutdown\n client.close\n end", "title": "" }, { "docid": "c084455d33be63bf4a5bb7b328a7152d", "score": "0.6138091", "text": "def close\n @active.value = false\n close_connections\n end", "title": "" }, { "docid": "ac26e763fb9020f9eff4a7edcff668f6", "score": "0.61359304", "text": "def disconnect\n @base.get('/logout')\n Base.disconnect!\n end", "title": "" }, { "docid": "bb060527a8e2391b0b688d75e07b0f25", "score": "0.6132808", "text": "def disconnect\n $emsConnections.close\n end", "title": "" }, { "docid": "33c99ad6d87a4411f6ec560918660536", "score": "0.6132156", "text": "def close\n socket.cleanup\n socket.close\n end", "title": "" }, { "docid": "94140cfe9bdb26ced551331232c6be00", "score": "0.6124782", "text": "def shutdown\n @shutdown = true\n disconnect()\n end", "title": "" }, { "docid": "4bbe24a03d788d3222f0245a5e9ae214", "score": "0.61240804", "text": "def close\n @connection.Close\n end", "title": "" }, { "docid": "0a0d8aa3eac43f4f81702c57a3396357", "score": "0.61184204", "text": "def close\n return if @closed\n @closed = true\n @web_socket.close\n @web_socket = nil\n self\n end", "title": "" }, { "docid": "31010d4c6738fcfd6aa638d22da80d89", "score": "0.6117418", "text": "def close\n logger.debug { 'Logging out' }\n unless @connection.nil?\n logger.debug { 'Sending logout commands' }\n @connection.puts('bye') { |c| logger.debug c }\n @connection.close\n end\n\n logger.debug { 'Disconnected from FIBS' }\n end", "title": "" }, { "docid": "31db310a8f7bf3fbabab647e38c5bbc6", "score": "0.6113884", "text": "def close\n @server.close\n end", "title": "" }, { "docid": "f07211cafc2021fdbd139a05df9708ab", "score": "0.6113241", "text": "def teardown\n @interrupted = true\n @receiver.close()\n @session.close()\n @connection.close()\n finished\n @thread.raise(Interrupted)\n end", "title": "" }, { "docid": "987c9388ac873035272b70136a7be98e", "score": "0.6112672", "text": "def close\n @bunny.stop\n # normal amqp does not require stopping\n end", "title": "" }, { "docid": "987c9388ac873035272b70136a7be98e", "score": "0.6112672", "text": "def close\n @bunny.stop\n # normal amqp does not require stopping\n end", "title": "" }, { "docid": "626ea265e1edacb7b33a0cb197d9c1e2", "score": "0.6110145", "text": "def close(_context)\n @client = nil\n end", "title": "" }, { "docid": "c3bf5b3a4dba348ab944011e871f3dc1", "score": "0.61075985", "text": "def close(context)\n @connection = nil\n end", "title": "" }, { "docid": "bdf71d06d84e5ef397e0771bc2ca0764", "score": "0.60973066", "text": "def close()\n do_command(\"close\", [])\n end", "title": "" }, { "docid": "aecc490c65543f898ed79fec5a2d375a", "score": "0.6096552", "text": "def shutdown\n @connection_manager.shutdown if @connection_manager\n @client = nil\n @connection_manager = nil\n end", "title": "" }, { "docid": "a9d59dbd9c5719f5a7d68ad1de55cda8", "score": "0.6094958", "text": "def sync_close(*) end", "title": "" }, { "docid": "36ca6a34283fc2d59cb7b3aa721361f4", "score": "0.6092626", "text": "def close()\n @client.close()\n end", "title": "" }, { "docid": "280b281c30d4ecb16abb6451e4525956", "score": "0.6089012", "text": "def close\r\n @client.close\r\n end", "title": "" }, { "docid": "4f89ff2629a2f29dc7589b975aa886fd", "score": "0.6087171", "text": "def close!\n socket.close\n end", "title": "" }, { "docid": "a931822ed77052d0b27081b32006a04f", "score": "0.6082899", "text": "def close\n @run = false\n\n socket.close\n\n super()\n end", "title": "" }, { "docid": "120354b2b3024600d8e091856cce6362", "score": "0.60800046", "text": "def close\n begin\n @client.disconnect\n rescue => e\n raise DISCONNECTOR_ERR + e\n end\n end", "title": "" }, { "docid": "72ff214e41f504ea574066682e4fb9bf", "score": "0.60794634", "text": "def close_connection\n return if (@closed)\n\n unless (@timed_out)\n send_callback(:on_disconnect)\n end\n\n debug_notification(:closed, \"Connection closed\")\n \n super\n\n @connected = false\n @closed = true\n @timeout_at = nil\n @interpreter = nil\n end", "title": "" }, { "docid": "477bf03e09839cbae20055b1baf7851f", "score": "0.60657275", "text": "def close\n busterminate(@id_connection)\n end", "title": "" }, { "docid": "4bdf6d199148b704aafc0f3a5a9bb6dc", "score": "0.6065186", "text": "def close\n @shutdown = true\n \n @thread.join\n @thread = nil\n \n # Since the thread is stopped now, we can be sure no new connections are\n # accepted. This is why we access the collection without locking.\n @connections.each do |connection|\n connection.close\n end\n @ins.close if @ins\n end", "title": "" }, { "docid": "9338972ba8192c608347123155d7c0dc", "score": "0.6064307", "text": "def close\n @client.close\n end", "title": "" }, { "docid": "a6e3ccb0db5f7cbe2322e82ada7ed526", "score": "0.60557634", "text": "def close_connection\n @connection.expunge\n @connection.logout\n begin\n @connection.disconnect unless @connection.disconnected?\n rescue\n Rails.logger.info(\"Fetcher: Remote closed connection before I could disconnect.\")\n end\n end", "title": "" }, { "docid": "a6e3ccb0db5f7cbe2322e82ada7ed526", "score": "0.60557634", "text": "def close_connection\n @connection.expunge\n @connection.logout\n begin\n @connection.disconnect unless @connection.disconnected?\n rescue\n Rails.logger.info(\"Fetcher: Remote closed connection before I could disconnect.\")\n end\n end", "title": "" }, { "docid": "748abbf9ffec2f86dcd4ee5c23a70aa9", "score": "0.6055383", "text": "def close\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "f5a94443cfb4e0e8f7057eb924c475ff", "score": "0.60551554", "text": "def close\n @socket&.close\n end", "title": "" }, { "docid": "98ebe5ffff843eff75afd81ce3e85870", "score": "0.6054428", "text": "def close(cb = nil, &block)\n @connections.clear\n @conn_addresses.clear\n @reconnect_timers.each{|_, timer| EM.cancel_timer(timer)}\n cb ||= block\n unless @peers.empty?\n if cb\n @after_writting = cb\n flush_all_queue\n @peers.values.each{|c| c.close_connection(true)}\n else\n @peers.values.each{|c| c.close_connection}\n end\n else\n EM.next_tick(cb) if cb\n end\n @bindings.each{|c|\n unless String === c\n EM.stop_server c\n else\n InProc.unbind(c, self)\n end\n }\n end", "title": "" }, { "docid": "a41669a5cbf0f9f43128b680461f10a9", "score": "0.60465944", "text": "def close\n socket.close\n end", "title": "" }, { "docid": "595edfeeeb609d40a2adb3a24ab495d2", "score": "0.6032504", "text": "def on_close(&blk)\n env['async.close'].callback(&blk)\n end", "title": "" }, { "docid": "7258ee65deb0d4a2c1c5ff14c7548005", "score": "0.60303485", "text": "def unbind\n puts \"#{self} client a connection has terminated\"\n EventMachine::stop_event_loop()\n end", "title": "" }, { "docid": "d5321599981db72bd7a7daad7fc8a78d", "score": "0.60295236", "text": "def close\n @connection.close\n @connection = nil\n end", "title": "" }, { "docid": "90234cb2cb5fa84b0cbdc649cd28244c", "score": "0.602372", "text": "def shutdown\n request('session-close')\n end", "title": "" }, { "docid": "ef1230d8efb8fbba58b7bbda3e989d22", "score": "0.60206026", "text": "def close\n @connection.close()\n end", "title": "" }, { "docid": "707a2ba5dab68f1e4350d4f6f170d6ff", "score": "0.60079265", "text": "def connection_cleanup\n debug 'Tearing down connection'\n @running = false\n if(connected?)\n socket.terminate\n end\n @socket = nil\n info 'Connection torn down'\n nil\n end", "title": "" }, { "docid": "3efc1f01f2bba6905260c80ea1f4a05b", "score": "0.60051906", "text": "def close_connection\n return if (@closed)\n\n unless (@timed_out)\n send_callback(:on_disconnect)\n end\n\n debug_notification(:closed, \"Connection closed\")\n\n super\n\n @connected = false\n @closed = true\n @timeout_at = nil\n @interpreter = nil\n end", "title": "" }, { "docid": "68bce84a71e3669c49fcef252aaa06a0", "score": "0.6001692", "text": "def close\n if connected?\n @connected = false\n client.close\n end\n end", "title": "" }, { "docid": "9739d3a9c8a4417932cb89e2f9ef43f7", "score": "0.59972936", "text": "def close\n # Revoke the SSO access token:\n revoke_access_token if @token\n\n # Close the HTTP client:\n @client.close if @client\n end", "title": "" }, { "docid": "0f481da9a39258f437c1c08c87a6e937", "score": "0.59958375", "text": "def end_session!\n @socket = socket.close\n end", "title": "" }, { "docid": "46f7544857b3a960ce86bcaeb3670d42", "score": "0.59955454", "text": "def shutdown\n log_string \"IMC Connection closed.\"\n @connection.close\n end", "title": "" }, { "docid": "c77ae9c9b1e137a11508a26bfba0c3c0", "score": "0.5995496", "text": "def close\n return nil unless is_connected?\n socket_puts(\"close\")\n @socket = nil\n end", "title": "" }, { "docid": "532303920a2702cb82e83211e7f77cfb", "score": "0.5988339", "text": "def close\r\n @connection.Close\r\n end", "title": "" }, { "docid": "4e8be75230d222ab3c478153ed49d714", "score": "0.59881157", "text": "def close\n @em_connection.close\n end", "title": "" }, { "docid": "f2af5ec0719e4380493c1b5e4607f22d", "score": "0.59871686", "text": "def disconnect\n @client.close if @client\n end", "title": "" } ]
1eadf00dab4dd32ce0f52b9a7fe5c458
If you have extra params to permit, append them to the sanitizer.
[ { "docid": "5d58f9959f5fd4a2410d63fef33c5511", "score": "0.0", "text": "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "title": "" } ]
[ { "docid": "9f3b62fe05ad1542504f6ef13056ac4e", "score": "0.6905034", "text": "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", "title": "" }, { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.683687", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "8091c3e7b94c717c25d9ecbc5a2855b5", "score": "0.68280804", "text": "def devise_parameter_sanitizer; end", "title": "" }, { "docid": "bac98b104607ad84410a73c433963bd4", "score": "0.67889357", "text": "def update_sanitized_params\n\t\t\tdevise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}\n\t\tend", "title": "" }, { "docid": "17f1723573aa3f1d8127a2a18f10e5d2", "score": "0.6674015", "text": "def sign_up_params\n devise_parameter_sanitizer.sanitize(:sign_up)\n end", "title": "" }, { "docid": "72a9d1c2f3d409d1d0d461d3c0e79b87", "score": "0.66522104", "text": "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:password_confirmation ,:password ,:email, :role, :avatar, :avatar_cache, :remove_avatar, :invite_code, :firstname, :lastname)}\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.66448265", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6595933", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "b7a7b28775d144719f33dc7d1117fa2b", "score": "0.65606564", "text": "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", "title": "" }, { "docid": "6900bb74782e4e12b352fb52bd294931", "score": "0.64921725", "text": "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :approved , :password, :password_confirmation,:approved, :role_ids => [], affiliate_person_attributes: [:name], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id, :twitter_sign_in, :video_upload_twitter, :order_placed_twitter] )}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation,:approved, :sign_in_twitter, :video_upload_twitter, :order_placed_twitter, :performer => [], :role_ids => [], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id])}\n end", "title": "" }, { "docid": "1edc20bd18c43fcf7fc5b92d1da8b226", "score": "0.6489163", "text": "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64781183", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.64483696", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.64394945", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "79b8b316e1ef83582bdac4629996dc37", "score": "0.6419598", "text": "def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end", "title": "" }, { "docid": "6ab96b7390d17c25390120b0d217ea22", "score": "0.6419251", "text": "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", "title": "" }, { "docid": "21b124098cb3c128802e22b776b3f0ec", "score": "0.63999707", "text": "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", "title": "" }, { "docid": "6cfe1f2e4a55f6e4beeaef590b0a1391", "score": "0.63977224", "text": "def sanitized_allowed_attributes=(attributes); end", "title": "" }, { "docid": "6cfe1f2e4a55f6e4beeaef590b0a1391", "score": "0.63977224", "text": "def sanitized_allowed_attributes=(attributes); end", "title": "" }, { "docid": "98363cc6e225847e0563ace04ddadf59", "score": "0.63934815", "text": "def update_sanitized_params\n\t\tdevise_parameter_sanitizer.for(:sign_up) \t\t\t\t{ |u| u.permit(:name, :email, :password, :password_confirmation, :company, :role_type, :celp_no, :approval, :authorize) }\n\t\tdevise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password, :company, :role_type, :celp_no, :approval, :authorize) }\n\tend", "title": "" }, { "docid": "cf5c0e18776ef8777c4cf4687793fb0c", "score": "0.6381383", "text": "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "title": "" }, { "docid": "c8d1b09827dbe3a963c60c741dc68594", "score": "0.63552105", "text": "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", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.6351666", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.63470167", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "eb5b91d56901f0f20f58d574d155c0e6", "score": "0.6263344", "text": "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", "title": "" }, { "docid": "ab49b0baeea5bf6f204adca9e864094e", "score": "0.62456423", "text": "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "title": "" }, { "docid": "760ea0a0a32f17b8e45dea2dcaa6e85e", "score": "0.6201932", "text": "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end", "title": "" }, { "docid": "760ea0a0a32f17b8e45dea2dcaa6e85e", "score": "0.6201932", "text": "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end", "title": "" }, { "docid": "93783c9b6c03c3bd41f75234b31911f8", "score": "0.61927104", "text": "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", "title": "" }, { "docid": "196f08359b3a11938974363e8b5f31ba", "score": "0.61919683", "text": "def sanitize_attrs(attrs = {}, permitted = [])\n sanitized = {}\n attrs.each do |key, value|\n sanitized[key.to_s] = value if permitted.include?(key.to_s)\n end\n sanitized\n end", "title": "" }, { "docid": "ff55cf04e6038378f431391ce6314e27", "score": "0.6170647", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.6156662", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "9afb646948f2e93a96015eb0ea0b1289", "score": "0.61398244", "text": "def student_params\n params.require(:student).permit(:name, :sex, :birthplace, :birthdate, :phone, :email, :employment,\n :street_address, :district, :regency_city, :religion, :registered_at,\n :avatar, :crop_x, :crop_y, :crop_w, :crop_h).tap do |whitelisted|\n if params[:student][:biodata]\n whitelisted[:biodata] = params[:student][:biodata]\n end\n end\n end", "title": "" }, { "docid": "2ce1ea5a9612e3b22167ec09d3ec96a5", "score": "0.61027503", "text": "def user_strong_params\n html_safe(params[:user]).strip\n end", "title": "" }, { "docid": "4658b5ebaf35abb1b89c071aed7e018c", "score": "0.6095907", "text": "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6092075", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "d17287b48784257580d7e0971173c983", "score": "0.60888684", "text": "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", "title": "" }, { "docid": "8e88cff066899440218be0e10df9d32f", "score": "0.60829175", "text": "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", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6078085", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "94a26202101c4478cdd1a735b86ada98", "score": "0.6074742", "text": "def configure_permitted_parameters\n extra_params = [:full_name, :programme, :student_number]\n devise_parameter_sanitizer.for(:sign_up).push(*extra_params)\n devise_parameter_sanitizer.for(:account_update).push(*extra_params)\n end", "title": "" }, { "docid": "da8404c11852f41c5a813625b7640e46", "score": "0.6032367", "text": "def post_card_params\n params[:post_card].permit!\n end", "title": "" }, { "docid": "cf3a0c0635625d213ecf832e5f0eb56d", "score": "0.5991786", "text": "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.597175", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "56e29f7cc0f2f4ac538af32e413dbd2f", "score": "0.5967426", "text": "def white_params\n params.require(:therapist).permit(Therapist.therapist_whitelist, \n therapist_availability_attributes:Therapist.therapist_availability_whitelist, \n therapist_availability_rec_attributes:Therapist.therapist_recurring_whitelist)\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.59671617", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "d625fbd6570a8a86e0588529d8c9d85b", "score": "0.596185", "text": "def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end", "title": "" }, { "docid": "236d6f6a5f10ed527d95f3f7e56460d5", "score": "0.5957206", "text": "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "title": "" }, { "docid": "6ead0298fcec221cb89d208836597b05", "score": "0.5954368", "text": "def surgery_params\n params.require(:surgery).permit(:name)\n end", "title": "" }, { "docid": "12553a99d7dbcd459d770424e53f80ea", "score": "0.5938198", "text": "def safe_params\n params.require(:youtube_search).permit(:search_terms, :alert_on_new_result)\n end", "title": "" }, { "docid": "5eab212b1d0d7075557410e979fdcb85", "score": "0.59285605", "text": "def post_params\n permit_params\n end", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.5927781", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "72d8b74e95db3244aec3002ca7d5dd0e", "score": "0.59138155", "text": "def update_sanitized_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :adress, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n \n end", "title": "" }, { "docid": "e310f8ae001392da6281c299a2572677", "score": "0.59032714", "text": "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "title": "" }, { "docid": "b48f61fbb31be4114df234fa7b166587", "score": "0.58997184", "text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "title": "" }, { "docid": "e3f83427e50dea749dfb4362709998c1", "score": "0.58978087", "text": "def sanitize!(request)\n [ :path, :query, :body ].each do |name|\n send(\"#{name}_parameters\").sanitize_object!(request.params)\n end\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.5896996", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.58940434", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "6de692075453dcc2ab042b068ad97f4f", "score": "0.5887589", "text": "def surgical_params\n params.require(:surgical).permit(Surgical.safe_attributes)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.5887006", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "7befdf5d03aadb61b4c6e74ed07cd447", "score": "0.588294", "text": "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", "title": "" }, { "docid": "dab2e7e37c475245685ea808d5ea4f48", "score": "0.58775926", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :terms_of_service << :first_name << :last_name\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end", "title": "" }, { "docid": "5dc5638cc9b549ad691c97689297bd90", "score": "0.58737236", "text": "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "title": "" }, { "docid": "cbdb6e6a543691a840ed14a2213a6df0", "score": "0.5871206", "text": "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", "title": "" }, { "docid": "ed4783d294a30988bf536f8e074ad564", "score": "0.5870724", "text": "def submission_params\n allowed = :student_number, :last_name, :first_name, :week, :hours, :comments, :email, :github, :challenging\n (1..Course.current.exercises_max).each do |i|\n allowed << \"a#{i}\".to_s\n end\n params.require(:submission).permit(allowed)\n end", "title": "" }, { "docid": "e86d3c7a5d37c3d8653eef9e26d814de", "score": "0.586412", "text": "def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end", "title": "" }, { "docid": "3c815c7718a92f45dc5d6f7a9d7659d6", "score": "0.58603865", "text": "def csrfattack_params\n params.require(:csrfattack).permit(:professor, :vote)\n end", "title": "" }, { "docid": "b7921cbcc22947bf5d6b5cfef8b6bf50", "score": "0.5850765", "text": "def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end", "title": "" }, { "docid": "4782f0a9dd14ad89435ae20d8ae650a6", "score": "0.58469373", "text": "def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end", "title": "" }, { "docid": "2b4481b7db581e86f56846f5cb81499d", "score": "0.5843961", "text": "def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end", "title": "" }, { "docid": "81b57f3f66460e1555acec155ed14a7c", "score": "0.58388746", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end", "title": "" }, { "docid": "f573619c24113379f1e6edbd3be8eff7", "score": "0.5837621", "text": "def post_params(*args)\n params.require(:student).permit(*args)\n end", "title": "" }, { "docid": "8b8d810e07d3c17fcd9d728504bc2089", "score": "0.58303636", "text": "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "title": "" }, { "docid": "91d7e7d4c004a320c8af8cba627b1c5f", "score": "0.5808892", "text": "def additional_subject_params\n params.permit(:name)\n end", "title": "" }, { "docid": "64496811440ff6cc194b72f1ebdcf178", "score": "0.5802483", "text": "def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end", "title": "" }, { "docid": "b4c9e256f5ff7da4611e1dd066ed19af", "score": "0.57949424", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up,\n keys: [:face_image, :worker_number, :name, :name_kana, :trade_name, :phone, :address_zip, :address, :warehouse_zip, :warehouse, :warehouse_info, :inaba,\n :yodo, :takubo, :ykkap, :sankyo, :lixil])\n end", "title": "" }, { "docid": "a8448344a1c8b46809c7e7041ef4914b", "score": "0.5791214", "text": "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "title": "" }, { "docid": "2f3ae517611130e77cfc59be153bf71e", "score": "0.5791014", "text": "def student_params\n params.require(:student).permit!\n end", "title": "" }, { "docid": "2d1410a4947eb1218a0372b90e8547d3", "score": "0.57847995", "text": "def visit_params\n params.require(:visit).permit(*allowable)\n end", "title": "" }, { "docid": "6b8ef5fd177b7f5ab623097187f9b8a8", "score": "0.5782731", "text": "def special_params\n params.require(:special).permit(:info)\n end", "title": "" }, { "docid": "c250f72dc3725feca0db99e6cdd30891", "score": "0.5781977", "text": "def safe_movie_params\n\t\treturn params.require(:movie).permit(:title, :description, :year_released)\n\tend", "title": "" }, { "docid": "6ceac1e2b2b174202a6126b7dcdc62a0", "score": "0.57755154", "text": "def user_pleasure_params\n params.permit(:title)\n end", "title": "" }, { "docid": "dda639f5582a8e3ec82c8b041880d653", "score": "0.5772579", "text": "def full_sanitizer=(_arg0); end", "title": "" }, { "docid": "dda639f5582a8e3ec82c8b041880d653", "score": "0.5772579", "text": "def full_sanitizer=(_arg0); end", "title": "" }, { "docid": "dda639f5582a8e3ec82c8b041880d653", "score": "0.5772579", "text": "def full_sanitizer=(_arg0); end", "title": "" }, { "docid": "50bfa51e3dbeddf3b2cf65efc3a832b3", "score": "0.5769446", "text": "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end", "title": "" }, { "docid": "18039f60d44a2059a6f4ef70c11204e9", "score": "0.5766719", "text": "def surgery_params\n\t\t# Permitting the profile photo params\n\t\tparams.require(:surgery).permit(:name)\n\tend", "title": "" }, { "docid": "0d980fc60b69d03c48270d2cd44e279f", "score": "0.5758603", "text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "title": "" }, { "docid": "4e7339c602c5ee7f89eddd021b57bed2", "score": "0.575704", "text": "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:fname, :lname, :avatar, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end", "title": "" }, { "docid": "ad0d0f2aa2736ac22f4f19a84eb9f05b", "score": "0.5756578", "text": "def string_enforcer_params\n params.fetch(:string_enforcer, {})\n end", "title": "" }, { "docid": "0f4c5eecf81dc65ba15722757102f223", "score": "0.57548386", "text": "def update_params\n permitted = params.permit(*common_params,\n annotated_students_attributes:\n %i[id student_id _destroy])\n permitted[:annotated_students_attributes] = [] if @annotation.is_group\n permitted\n end", "title": "" }, { "docid": "9bdcf84df29fd2bed39dcae445bc4174", "score": "0.57541984", "text": "def sanitizer\n if options = sanitization\n @sanitizer ||= options.to_sanitize\n end\n end", "title": "" }, { "docid": "bdcf7980cb612ecb5d79f2f5aa6b93e3", "score": "0.57518667", "text": "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end", "title": "" }, { "docid": "dab3510fcdc1b7a1ff0613baeb45a4a8", "score": "0.5751863", "text": "def configure_permitted_parameters\n added_attrs = [:email, :password, :password_confirmation, :name, :description, :age, :gender,\n :favorite_movie, :favorite_food, :favorite_song, :job_title, :hobbies, :school, :social_media_link,\n :snap_chat_name, :allow_male, :allow_female, :allow_other]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "title": "" }, { "docid": "18d56128a5cb9b14ec140965de058be1", "score": "0.5748482", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end", "title": "" }, { "docid": "419c8d98951eb301906ad011d2fa97b9", "score": "0.5746564", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:practice, :last_name, :first_name, :email, :phone, :birthday, :gender, :password,\n :password_confirmation, :avatar, :avatar_cache, :remove_avatar, address_attributes: [ :id, :postcode, :prefecture, :city, :street, :building ]])\n end", "title": "" }, { "docid": "0b6129d775136b0d6037453613f331dd", "score": "0.5744878", "text": "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "title": "" }, { "docid": "795ea00f52a1dca190b25a5f7cda9104", "score": "0.5743098", "text": "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end", "title": "" }, { "docid": "d85549ae521cee72b8fe7839ecb86e98", "score": "0.5728885", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:name, :email, :password, :password_confirmation, :current_password, :role_ids, :performer_attributes => [:first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id ,:description, :white_label_id, :clip_category_performers_attributes => [:id, :clip_category_ids]])\n end\n Rails.logger.info'****************************************'\n end", "title": "" }, { "docid": "b253a4e344145fd07b38d67d03079c11", "score": "0.5727657", "text": "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:firstname, :lastname, :ucard, :course, :level]\n devise_parameter_sanitizer.for(:account_update) << [:firstname, :lastname, :ucard, :course, :level]\n\n end", "title": "" }, { "docid": "f141a28a04cf1cf9e40c68eede2d26dd", "score": "0.57257277", "text": "def unsanitised_user_params\n params.require(:user).permit(\n :name,\n :email,\n :organisation_id,\n :invitation_token,\n :password,\n :password_confirmation,\n :require_2sv,\n :role,\n supported_permission_ids: [],\n ).to_h\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.572434", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" } ]
9d11ac03b3dec20944218affb461c1ec
def set_file_system(path) Liquid::Template.file_system = SubjectService::FileSystem.new(path, "_%s.html.liquid".freeze) end
[ { "docid": "4579c6e4f1320938a00cda5a8ad45efb", "score": "0.5669637", "text": "def set_resource_file_system(resource, *args)\n resource_file_system(resource)\n set_file_system File.join(resource_file_system(resource), *args)\n end", "title": "" } ]
[ { "docid": "acb9e7efcbdec9607b42436ab6ffe230", "score": "0.63934755", "text": "def set_file_system\n @file_system = FileSystem.find(params[:id])\n end", "title": "" }, { "docid": "12950448feae5e8ee0300a7efdd5a751", "score": "0.61803967", "text": "def template=(file)\n @template = file\nend", "title": "" }, { "docid": "3746b40076e9373f6b0248077689b44b", "score": "0.61717206", "text": "def template(filename, path)\n file = lib_file(with_correct_path_seperator(path))\n file.dirname.mkpath\n file.open(\"w+\") { |f| f << render(template_root(filename)) }\n end", "title": "" }, { "docid": "32304dc37ff190b57072b8f821db58be", "score": "0.609632", "text": "def initialize_template(path)\n source = GitPath.show(path, content_paths.content_path, @git)\n source = follow_symlink(source)\n\n identifier = path\n handler = path.split('.').last\n handler = ActionView::Template.registered_template_handler(handler)\n\n details = {\n format: Mime['html'],\n updated_at: Date.today,\n virtual_path: path\n }\n\n ActionView::Template.new(source, identifier, handler, details)\n end", "title": "" }, { "docid": "bfde40c0a059f2355913c1c297a3cc6d", "score": "0.60348517", "text": "def set_template\n # TODO What if this folder is empty? What if it doesn't exist?\n @template = Template.new(params[:path])\n end", "title": "" }, { "docid": "37f51100e419bdc3f8c775ba677e7515", "score": "0.6017555", "text": "def initialize path\n\t\t\t\t@registered_templates = Array.new\n\t\t\t\t@templates = Array.new\n\n\t\t\t\tbase_dir = __FILE__.gsub(\"risu/base/template_manager.rb\", \"\")\n\n\t\t\t\tload_templates(base_dir + path)\n\t\t\t\tload_templates(Dir.pwd, false)\n\t\t\t\tload_templates(File.expand_path(USER_TEMPLATES_DIR)) if File.exist?(File.expand_path(USER_TEMPLATES_DIR)) && File.directory?(File.expand_path(USER_TEMPLATES_DIR))\n\t\t\tend", "title": "" }, { "docid": "3fd9ec8225c0d44cf96166af8e49b6a2", "score": "0.5986979", "text": "def mount_at(path)\n @mount_path = path\n\n # Setup the template_dir_stack.\n\n stack = []\n stack << File.join(Template.root_dir, path).gsub(/\\/$/, \"\")\n self.setup_template_dir_stack(stack)\n stack << File.join(Nitro.proto_path, \"app\", \"template\", path).gsub(/\\/$/, \"\")\n\n ann(:self, :template_dir_stack => stack)\n end", "title": "" }, { "docid": "7064c2cd2ea5c126ac3844ccbd717da9", "score": "0.5979463", "text": "def fetch_from_filesystem\n Dir.glob(File.join(self.root_dir, \"*.{#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join(',')}}\")).each do |filepath|\n fullpath = File.basename(filepath)\n\n snippet = self.add(filepath)\n\n Locomotive::Mounter.with_locale(self.filepath_locale(filepath)) do\n snippet.template = Tilt.new(filepath)\n end\n end\n end", "title": "" }, { "docid": "a97583c04a5d737fbda31150e96035ad", "score": "0.59356934", "text": "def add_theme_directory_to_paths\n self.prepend_view_path(\"#{@site.theme.path}/templates\")\n self.prepend_view_path(\"#{@site.theme.path}\")\n \n # Give the include tag access to files in the site's templates directory\n ::Liquid::Template.file_system = ::Liquid::LocalFileSystem.new(File.join(@site.theme.path, 'templates'))\n end", "title": "" }, { "docid": "25502d17796df4201d56747503cf0129", "score": "0.5909281", "text": "def initialize_template(path)\n source = File.binread(path)\n identifier = path\n handler = ActionView::Template.registered_template_handler('erb')\n\n details = {\n format: Mime['html'],\n updated_at: File.mtime(path),\n virtual_path: path\n }\n\n ActionView::Template.new(source, identifier, handler, details)\n end", "title": "" }, { "docid": "fcebfb05dab9fccb01d93bf48b098f74", "score": "0.58972615", "text": "def initialize(path)\n @local_path = path\n @name = File.basename(path, \".html\")\n @last_modified_at = File.mtime(path)\n self.dependencies.each do |dependency_path|\n dependency_mtime = File.mtime(dependency_path)\n @last_modified_at = dependency_mtime if dependency_mtime > @last_modified_at\n end #each\n @remote_path = \"/\" + path.match(%r'/([^/]+/client-[^/]+/html/[^.]+\\.html)$')[1] + \"/\" +\n @last_modified_at.to_i.to_s(16)\n end", "title": "" }, { "docid": "0274e8a2b30b3a3444b62916450e92da", "score": "0.5894231", "text": "def initialize (path)\n\t\t\t\t@registered_templates = Array.new\n\t\t\t\t@templates = Array.new\n\n\t\t\t\tbase_dir = __FILE__.gsub(\"risu/base/template_manager.rb\", \"\")\n\n\t\t\t\tload_templates(base_dir + path)\n\t\t\t\tload_templates(Dir.pwd, false)\n\t\t\t\tload_templates(File.expand_path(USER_TEMPLATES_DIR)) if File.exists?(File.expand_path(USER_TEMPLATES_DIR)) && File.directory?(File.expand_path(USER_TEMPLATES_DIR))\n\t\t\tend", "title": "" }, { "docid": "199d416ece0cb05415fa5b598d800038", "score": "0.5882095", "text": "def generate_site_files(path, posts)\n slim = Slim::Template.new(path).render(Object.new, content: 'this is the content')\n\n [path.split('/').pop.gsub(/\\.slim/, '.html'), slim]\n end", "title": "" }, { "docid": "41729161224924d0a49d6adf243e5392", "score": "0.585632", "text": "def fetch_from_filesystem\n Dir.glob(File.join(self.root_dir, \"*.{#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join(',')}}\")).each do |filepath|\n fullpath = File.basename(filepath)\n\n snippet = self.add(filepath)\n\n Locomotive::Mounter.with_locale(self.filepath_locale(filepath)) do\n snippet.template = self.fetch_template(filepath)\n end\n end\n end", "title": "" }, { "docid": "5a19fa8377b92460f1ce8591b0bb7205", "score": "0.5832534", "text": "def read_template_from_file_system(context)\n Liquid::Template.file_system.read_section_file(\n context.evaluate(@template_name_expr)\n )\n end", "title": "" }, { "docid": "08a6be7ff482600ec3a92d426b26b794", "score": "0.5821438", "text": "def liquid_partial_template\n # Load templates\n return if @theme.nil?\n templates_file = \"#{Rails.root}/app/views/themes/#{@theme}/shared/\"\n Liquid::Template.file_system = Liquid::LocalFileSystem.new(templates_file)\n end", "title": "" }, { "docid": "e20243095f6f46fd8bf85d2f9ce9d0c5", "score": "0.5821235", "text": "def load_templates ( template )\n @textTemplate = Liquid::Template::parse( File.open( File.expand_path( lewt_stash + \"/templates/#{template}.text.liquid\", __FILE__) ).read )\n @htmlTemplate = Liquid::Template::parse( File.open( File.expand_path( lewt_stash + \"/templates/#{template}.html.liquid\", __FILE__) ).read )\n @stylesheet = File.expand_path( lewt_stash + '/templates/style.css', __FILE__)\n end", "title": "" }, { "docid": "c27813a61f35a4298599bd4416a27e44", "score": "0.5798765", "text": "def set_paths_and_discover_file!\n if config[:processing]\n if !config[:file] && config[:file_path_prompt]\n config[:file] = prompt_for_template\n else\n file_lookup_path = File.expand_path(config[:file])\n unless File.exists?(file_lookup_path)\n file_lookup_path = config[:file]\n end\n config[:file] = sparkle_collection.get(\n :template, file_lookup_path\n )[:path]\n end\n else\n if config[:file]\n unless File.exists?(config[:file])\n raise Errno::ENOENT.new(\"No such file - #{config[:file]}\")\n end\n else\n raise \"Template processing is disabled. Path to serialized template via `--file` required!\"\n end\n end\n true\n end", "title": "" }, { "docid": "79e302540a87b7cb7fa90a481c2e80b5", "score": "0.5795886", "text": "def initialize(dir)\n @file_system = FileSystemLocal.new(dir)\n\tend", "title": "" }, { "docid": "e6e278d4c3292cd36256055be1789eb0", "score": "0.57597643", "text": "def file_for(content)\n \"snp_#{template_name}\".tap do |file_name|\n File.open(file_name, \"w+\") { |f| f.write(content) }\n end\n end", "title": "" }, { "docid": "ccb4b6cb9d698562bd131a175f04f191", "score": "0.5714716", "text": "def load_template(*path)\n path = File.join(*path)\n @templates[path] ||= ERB.new(File.read(path))\n @templates[path].filename = path\n @templates[path]\n end", "title": "" }, { "docid": "4a79cdf9cebe0f0f21d77e9cf8b7b71a", "score": "0.5688583", "text": "def retrieve(path)\n path = \"#{Rails.root}/public/system/#{path}\"\n File.open(path)\n end", "title": "" }, { "docid": "541ae95afce8cd0f9e8cfe6af066bde7", "score": "0.56674856", "text": "def std_template=(template)\n raise \"Template #{template} does not exist!\" unless self.std_templates.include?(template) \n @template = \"#{BASENAME}/#{template}.rhtml\"\n end", "title": "" }, { "docid": "bbde1c2765bba31123b9d9ea6ffed545", "score": "0.5659402", "text": "def create_file_from_template(file_name, template_path, mode = '644')\n file file_name,\n :ensure => :present,\n :mode => mode,\n :content => template(File.join(File.dirname(__FILE__), '..', 'templates', template_path), binding),\n :require => package('solr-jetty')\n end", "title": "" }, { "docid": "b30e682f40854180d5682aa06708848f", "score": "0.56522566", "text": "def add_template_to_dependency(path)\n if @context.registers[:page] && @context.registers[:page].key?(\"path\")\n @site.regenerator.add_dependency(\n @site.in_source_dir(@context.registers[:page][\"path\"]),\n template_path(path)\n )\n end\n end", "title": "" }, { "docid": "4b87b35eec9eea3899029dfb85d27c25", "score": "0.5649733", "text": "def register_template(path, content, strip: :heredoc)\n # TODO: make a custom in-memory reoslver instead of going through the FS\n unless @tmpdir\n @tmpdir = Dir.mktmpdir\n TestController.prepend_view_path OptimizedFileSystemResolver.new(@tmpdir)\n end\n\n full_path = File.join(@tmpdir, path)\n FileUtils.mkdir_p File.dirname(full_path)\n File.write(full_path, strip_content(content, strip))\n\n nil\n end", "title": "" }, { "docid": "c97eb7029dac0c5748272eeb6b90f213", "score": "0.56019604", "text": "def set_liquid_template\n @liquid_template = LiquidTemplate.find(params[:id])\n end", "title": "" }, { "docid": "c97eb7029dac0c5748272eeb6b90f213", "score": "0.56019604", "text": "def set_liquid_template\n @liquid_template = LiquidTemplate.find(params[:id])\n end", "title": "" }, { "docid": "baaaa7ad885951ee3332e39558db7d61", "score": "0.5599119", "text": "def manage_file(path, contents)\n if contents.is_a?(Hash) && !contents.empty?\n file = Chef::Resource::Template.new(path, run_context)\n file.cookbook('cerner_splunk')\n file.source('generic.conf.erb')\n file.variables(stanzas: contents)\n else\n file = Chef::Resource::File.new(path, run_context)\n file.content(contents) unless contents.empty?\n end\n file.path(path)\n file.owner(node['splunk']['user'])\n file.group(node['splunk']['group'])\n file.mode('0600')\n if contents.empty?\n file.run_action(:delete)\n else\n file.run_action(:create)\n end\n new_resource.updated_by_last_action(true) if file.updated_by_last_action?\n end", "title": "" }, { "docid": "f82c179c7ac3fe8fe5b6a67db0ca0302", "score": "0.5588449", "text": "def templates_for(file); end", "title": "" }, { "docid": "d7164561a73f3641b42520462198a28b", "score": "0.55801666", "text": "def file(path)\n return nil unless path\n return CottaFile.new(@system, Pathname.new(path))\n end", "title": "" }, { "docid": "80670d1ae35d3808456d4a351e5348e8", "score": "0.5578064", "text": "def template_path(path)\n File.join(@site.source.to_s, TEMPLATE_DIR, path.to_s)\n end", "title": "" }, { "docid": "3238443b38d1742a41d61ba6984f83b8", "score": "0.5577274", "text": "def read_template_file(template_path)\n type, name = template_path.split('--')\n\n entity = (\n case type\n when 'sections'\n section_finder.find(name)\n when 'snippets'\n snippet_finder.find(name)\n else\n raise ::Liquid::FileSystemError, \"This liquid context does not allow #{type}.\"\n end\n )\n\n raise ::Liquid::FileSystemError, \"Unable to find #{name} in the #{type} folder\" if entity.nil?\n\n entity.liquid_source\n end", "title": "" }, { "docid": "3b622882a3429fb01112940ba67b9a37", "score": "0.5574308", "text": "def template(path)\n Cache.template_cache.fetch(path) do\n super(path)\n end\n end", "title": "" }, { "docid": "d287fb3916439a46ff5116f28151bd13", "score": "0.55707884", "text": "def render_file(path)\n svc_name = ARGV[0]\n executable = ARGV[1] || \"/usr/bin/#{svc_name}\"\n source_path = File::join(RunitSettings::SvSkelDir, path)\n source = File::read(source_path)\n target_path = File::join(RunitSettings::AllServicesDir, svc_name, path)\n template = ERB.new(source)\n result = render(template, svc_name, executable)\n\n File::open(target_path, \"w\") do |file|\n file.write result\n end\n FileUtils::chmod(\"+x\", target_path)\nend", "title": "" }, { "docid": "1f190a51c0cd29bb54dc60b4c6982c24", "score": "0.5569768", "text": "def file(path, simple_templating=true)\n if simple_templating\n caller_file = caller.first\n end\n add Config::Patterns::File do |p|\n p.path = path\n if block_given?\n if simple_templating\n yield FileTemplate.new(p, self, caller_file)\n else\n yield p\n end\n end\n end\n end", "title": "" }, { "docid": "dde1abe5ced76ff4be115a7622ef7ea8", "score": "0.55658877", "text": "def set_template_path\n template_path = 'lib/templates/html/'\n\n gem_path = \"#{Gem.dir}/gems/#{ImageGps::NAME}-#{ImageGps::VERSION}/\"\n return File.join(gem_path, template_path) if File.exists?(gem_path)\n\n config_file = File.join(ENV['HOME'],'.image_gps.yaml')\n if File.exists?(config_file)\n app_path = YAML.load_file(config_file)['app_path']\n File.join(app_path, template_path)\n else\n template_path # Fallback in case user is inside app folder\n end\n end", "title": "" }, { "docid": "a582533dca049a56c089d1d16e8b3a36", "score": "0.5541567", "text": "def set_template_path\n template_path = 'lib/templates/html/'\n gem_path = \"#{Gem.dir}/gems/gps_extractor-#{GpsExtractor::VERSION}/\"\n if File.exists?(gem_path)\n return File.join(gem_path, template_path)\n else\n template_path\n end\n end", "title": "" }, { "docid": "468704add1771adaf7e04c798b4f2e32", "score": "0.5532889", "text": "def liquid_stock_path\n File.join(BasePath,filename_with_extention)\n end", "title": "" }, { "docid": "5cf85344ecc5d4f49314de2225c6d158", "score": "0.5526364", "text": "def create_file(path, content, *args)\n path = path.to_s\n if path[/\\.html$/] && using_haml?\n path = path + '.haml'\n end\n\n super\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.5514581", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "10e11c8983a045bdd927d78f776796a5", "score": "0.55142283", "text": "def serve_local\r\n send_file(File.expand_path(settings.public_folder + unescape(@path)))\r\nend", "title": "" }, { "docid": "510346443d56caad3706a127a89949ae", "score": "0.55136573", "text": "def template_for(file); end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.55135787", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "57165a60e1b4e43f71f4436563de5709", "score": "0.551347", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "8eb42eb6ec29547a237d6c60ad656abf", "score": "0.5512533", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "c67993e02c5a379ea50edc54cb4176c6", "score": "0.5511393", "text": "def set_files_by_type(path)\n files = Dir.chdir(path) { Dir[\"*\", \"*/*\"].group_by { |f| f.ext || :_dir }.to_symkey }\n @mds = files.values_atx(:md, :markdown)\n xhtmls = files.values_atx(:xhtml, :html)\n @csses = files.values_atx(:css)\n images = files.values_atx(:png, :jpg, :jpeg, :gif, :bmp, :tiff)\n (@cover_image, *_), @images =\n images.partition { |f| File.basename(f, '.*').match /^cover/ }\n\n @cover_xhtml =\n if cover = xhtmls.delete('cover.xhtml')\n cover\n elsif @cover_image\n # Create cover page if page not provided for a cover image.\n create_cover_page(@cover_image)\n end\n\n @navfile, xhtmls = pick_nav_file(xhtmls)\n\n @heading_files = get_heading_files(@navfile)\n\n @xhtmls = xhtmls.map { |f| xhtml_with_heading f }.sort_by(&:first)\n end", "title": "" } ]
ada2a13af2e7384e0ab13e9a51a58405
Generate an ISO 8601 representation of the specified date expressed in UTC.
[ { "docid": "b07a1cde65dfd799e80c2bfea687ea81", "score": "0.6052033", "text": "def to_datetime date\n #date.getutc.strftime('%FT%T%:z')\n date.getutc.iso8601\nend", "title": "" } ]
[ { "docid": "98b0e4fe9783dd6ea3364021af7f78c1", "score": "0.6798587", "text": "def iso8601\n \"#{start_date.iso8601}/#{end_date.iso8601}\"\n end", "title": "" }, { "docid": "9dc0c0244153531664aa550abc4d2d69", "score": "0.6776414", "text": "def iso_date(date)\n date.iso8601\n end", "title": "" }, { "docid": "4070b4ebbfe3b0f79a39f63f371053b1", "score": "0.66781396", "text": "def iso8601\n date = frozen? ? dup : self\n date.strftime(ISO_8601_FORMAT)\n end", "title": "" }, { "docid": "0fb296871054e2b9b1775895d65cc596", "score": "0.6603944", "text": "def to_iso8601\n tz = self.utc? ? \"Z\" : self.strftime(\"%z\")\n # zero-pad tv_usec so the time string is sortable.\n return \"%s.%06d%s\" % [self.strftime(ISO8601), self.tv_usec, tz]\n end", "title": "" }, { "docid": "713094fe1f536234dee56e0bdf8d1c6d", "score": "0.6482365", "text": "def to_iso8601\n Time.at(to_time.to_f + 0.5).iso8601\n end", "title": "" }, { "docid": "c33f668395dd93ce5e9796fe9608f077", "score": "0.62816525", "text": "def set_ISO_date_string(input = nil)\n\t date = get_date(input)\n\t return get_ISO_date_string(date) if date.is_a? Time\n end", "title": "" }, { "docid": "f9e64bdee89cd6792be48149834973d2", "score": "0.62697446", "text": "def to_json_date(date)\n\tdate.utc.strftime('%FT%T.%LZ')\nend", "title": "" }, { "docid": "f61e9a69ddcd34cfec6740173bc358d8", "score": "0.62619114", "text": "def iso8601\n if present?\n output = 'P'\n\n number_of_days = weeks * 7 + days\n output << \"#{number_of_days}D\" if number_of_days > 0\n if seconds > 0 || minutes > 0 || hours > 0\n output << 'T'\n output << \"#{hours}H\" if hours > 0\n output << \"#{minutes}M\" if minutes > 0\n output << \"#{seconds}S\" if seconds > 0\n end\n\n negative? ? \"-#{output}\" : output\n else\n 'PT0S'\n end\n end", "title": "" }, { "docid": "b2edcbf1cdcf3c339fafc9fd3dcba656", "score": "0.62617975", "text": "def date_to_iso_string(date)\n return nil if date.nil?\n return '%d-%02d-%02d' % [date.year, date.month, date.day]\nend", "title": "" }, { "docid": "8727b715b46445674a0cf1d22b98bc73", "score": "0.62547463", "text": "def to_iso\n strftime('%Y-%m-%dT%H:%M:%S')\n end", "title": "" }, { "docid": "e17722111c8fcbbeba8e64b6263943b1", "score": "0.61857206", "text": "def to_wire(options={})\n utc.iso8601\n end", "title": "" }, { "docid": "c956f48214e42669ca75883e3b3198d5", "score": "0.611499", "text": "def date_with_zone(date)\n date.strftime('%Y-%m-%d %Z')\n end", "title": "" }, { "docid": "45e938fc8ca7cbf92cb5e04212595651", "score": "0.6002392", "text": "def time_iso8601\n time = Time.now.utc\n return \"%s.%06d%s\" % [time.strftime(\"%Y-%m-%dT%H:%M:%S\"), time.tv_usec,\n \"Z\"]\n end", "title": "" }, { "docid": "2e76d7b42dfc5772e47a19c32ae7a4ee", "score": "0.59462136", "text": "def to_iso\n strftime('%Y-%m-%d')\n end", "title": "" }, { "docid": "17a449eeff520ee4afc7023e7d284abe", "score": "0.59133863", "text": "def get_date_string\n return Time.now.utc.strftime(\"%Y-%m-%d\")\nend", "title": "" }, { "docid": "90fc7ab2c05efed3a037a337ffa315c3", "score": "0.58774495", "text": "def iso8601(precision: nil)\n ISO8601Serializer.new(self, precision: precision).serialize\n end", "title": "" }, { "docid": "03c34cef87a0db0927a7d2d41bb0bdcb", "score": "0.57851714", "text": "def iso8601(*args)\n \"#{self.begin.iso8601(*args)}/#{self.end.iso8601(*args)}\"\n end", "title": "" }, { "docid": "03c34cef87a0db0927a7d2d41bb0bdcb", "score": "0.57851714", "text": "def iso8601(*args)\n \"#{self.begin.iso8601(*args)}/#{self.end.iso8601(*args)}\"\n end", "title": "" }, { "docid": "161b841aa522a1c99edbf6c7e261af59", "score": "0.577932", "text": "def time_iso8601\n return timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.\") + timestamp.tv_usec.to_s\n end", "title": "" }, { "docid": "34cf7d1152d82f9c0557b731c4d69c87", "score": "0.57650506", "text": "def date_to_time(date)\n date.to_time(:utc).to_formatted_s(:iso8601)\n end", "title": "" }, { "docid": "34cf7d1152d82f9c0557b731c4d69c87", "score": "0.57650506", "text": "def date_to_time(date)\n date.to_time(:utc).to_formatted_s(:iso8601)\n end", "title": "" }, { "docid": "c61d814c305453ff78f67f86628e2f99", "score": "0.57639724", "text": "def date\n \"#{(time.utc+utc_offset).ctime} #{@zone||\"+0000\"}\" if @time\n end", "title": "" }, { "docid": "3786b43ee2c37719d816fc50c0f8a427", "score": "0.57633203", "text": "def iso_format(time)\n time.getutc.strftime('%Y-%m-%dT%H:%M:%SZ')\n end", "title": "" }, { "docid": "cc047f473baeb836cd07c4bf3a0aa92c", "score": "0.5741746", "text": "def encode_date(date); end", "title": "" }, { "docid": "01b9afacf4aea68d1d7f09c1916004c3", "score": "0.5732671", "text": "def date\r\n return utc.date unless utc?\r\n Time.utc(year, month, day)\r\n end", "title": "" }, { "docid": "5047ce0ab56070a9df7e476d07bcd896", "score": "0.5702923", "text": "def now_iso\n iso { now }\n end", "title": "" }, { "docid": "c3225b2094b6b9776fb2f7d07188e6fa", "score": "0.5702739", "text": "def format_datetime(datetime)\n datetime.new_offset(0).iso8601.sub('+00:00', '.000Z')\n end", "title": "" }, { "docid": "3ab64a967fdffda989770b11e9820786", "score": "0.57015985", "text": "def result\n DateTime.iso8601(value).utc\n end", "title": "" }, { "docid": "59c3bb8ed6cd8dc4188402b08f888da5", "score": "0.5700043", "text": "def utc_httpdate\n Time.now.utc.httpdate\n end", "title": "" }, { "docid": "f7ae474097f1ad85218fe2112096f508", "score": "0.566743", "text": "def iso_format(time)\n time.getutc.iso8601\n end", "title": "" }, { "docid": "4e4951ddb326f303a312c744a54317f8", "score": "0.5650494", "text": "def utc_httpdate\n Time.now.utc.httpdate\n end", "title": "" }, { "docid": "0f171da4ead0135f38964884ec8365f4", "score": "0.5622019", "text": "def utc\n end", "title": "" }, { "docid": "45f9f174db91ca2c654330d8dd8437a9", "score": "0.5611309", "text": "def date_time_with_zone(date)\n date.strftime('%Y-%m-%d %H:%M %Z')\n end", "title": "" }, { "docid": "bc3b5eca2c345e3a9c96ed40744ed45a", "score": "0.5607308", "text": "def time_now\n #Time.now.utc.iso8601(3)\n Time.now.utc.iso8601\nend", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "9860315f296e8207adc7528fb459c2c8", "score": "0.55996346", "text": "def utc; end", "title": "" }, { "docid": "83671a2318b8602d3bb16c997b4977b6", "score": "0.55936795", "text": "def iso_format(time)\n time.strftime('%Y-%m-%dT%H:%M:%SZ')\n end", "title": "" }, { "docid": "c087f9fcd4e42028258d9acc3fa50624", "score": "0.55880594", "text": "def iso_format(time)\n time.strftime('%Y-%m-%dT%H:%M:%SZ')\n end", "title": "" }, { "docid": "bf6ce4cf92a78a128421d3e176273ec6", "score": "0.55787253", "text": "def to_s\n\t\t\t\tif @day_number then\n\t\t\t\t\tif @ps_number then\n\t\t\t\t\t\tsprintf ISO_8601_Datetime, year, month, day, hour, minute, second, @offset < 0 ? '-' : '+', *(@offset/60).floor.divmod(60)\n\t\t\t\t\telse\n\t\t\t\t\t\tsprintf ISO_8601_Date, year, month, day\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tsprintf ISO_8601_Time, hour, minute, second, @offset < 0 ? '-' : '+', *(@offset/60).floor.divmod(60)\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "a57a5ca34c5d49e1ba60f680048669a8", "score": "0.5569001", "text": "def date_str(date)\n t = (date.is_a? Integer) ? Time.at(date) : Time.parse(date).localtime\n\n # Convert to human friendly representation in user's time zone (almost RFC 2822)\n t.strftime('%a, %-d %b %Y %H:%M:%S %Z')\nend", "title": "" }, { "docid": "6f1a7f4b9a120953985b8b4fe6157a51", "score": "0.5555693", "text": "def convert_time_to_iso_8601(timestamp)\n timestamp = timestamp += \" -08:00\"\n new_timestamp = DateTime.strptime(timestamp, '%m/%e/%y %r %:z')\n rezoned_timestamp = new_timestamp.new_offset('-05:00')\n rezoned_timestamp.iso8601.to_s\nend", "title": "" }, { "docid": "2e0b5c87546e499ba3fa0cbf140ec95e", "score": "0.55555195", "text": "def formatted_date\n utc = opts[:appointment]&.resource&.start\n\n DateTime.strptime(utc)&.in_time_zone(DEFAULT_TIME_ZONE)&.strftime(DATE_FORMAT)\n end", "title": "" }, { "docid": "2103bf6ece7f5b96af4997fc81daa620", "score": "0.5533015", "text": "def w3c_date(date)\n date.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n end", "title": "" }, { "docid": "5c2095a4b7115353ca253f545a86f6b0", "score": "0.55318046", "text": "def to_utc_comparison_s; end", "title": "" }, { "docid": "cceaf0b041b871ab396c6a05cc5c2a4d", "score": "0.5521387", "text": "def to_s\n @string || @object.strftime('%H:%M:%S%Z').sub(/\\+00:00|UTC/, 'Z')\n end", "title": "" }, { "docid": "2d3b23a3bb41ada0594063b5f8587c60", "score": "0.5520263", "text": "def fecha_a_iso(fecha)\n fecha.strftime('%Y-%m-%d')\nend", "title": "" }, { "docid": "3225f704a71cd3f1797323cdd2594063", "score": "0.55194783", "text": "def iso8601_format( value )\n str = value.strftime('%Y-%m-%dT%H:%M:%S')\n str << ('.%06d' % value.usec)\n\n offset = value.gmt_offset.abs\n return str << 'Z' if offset == 0\n\n offset = sprintf('%02d:%02d', offset / 3600, offset % 3600 / 60)\n return str << (value.gmt_offset < 0 ? '-' : '+') << offset\n end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "7527ef9135bfeae061879a477d8496ec", "score": "0.55083394", "text": "def getutc; end", "title": "" }, { "docid": "ca82b7c3b23a0833bd085a4219c75be3", "score": "0.5507382", "text": "def time_now\n Time.now.utc.iso8601(3)\nend", "title": "" }, { "docid": "6044701a0122ed8c8545a1a9a4cd0f3b", "score": "0.55043507", "text": "def httpdate\n getutc.httpdate\n end", "title": "" }, { "docid": "cacab60664ea7766c35151feee3b3d0b", "score": "0.5500703", "text": "def pretty_datetime(date)\n eastern_date = date - 5.hours \n eastern_date.strftime(\"%b %d, %Y at %I:%M %p\") + \" Eastern\"\n end", "title": "" }, { "docid": "eaf32418f0c534acf292fb110b7bf1b0", "score": "0.5491605", "text": "def time_now\r\n Time.now.utc.iso8601(3)\r\nend", "title": "" }, { "docid": "b0f48b88d476f2931df2f919bb6c0899", "score": "0.5475182", "text": "def getutc\n end", "title": "" }, { "docid": "7cfd4c57f9a479095f76aa04d7115f4a", "score": "0.5473459", "text": "def date_str(date)\n date.to_time.strftime('%a, %-d %b %Y %H:%M:%S %Z')\nend", "title": "" }, { "docid": "f644ec8459f7987a51e10e1a387f2210", "score": "0.54644656", "text": "def created_at_iso8601\n @attributes[:created_at_iso8601]\n end", "title": "" }, { "docid": "9ecc823afa44c1d73adcc838e9268ce7", "score": "0.5406964", "text": "def as_string\n return unless date && precision\n return unless slice_point\n\n date.slice(0, slice_point)\n end", "title": "" }, { "docid": "af3a1a1d797e74db4bde9272d7b42f6d", "score": "0.53982836", "text": "def to_s\n return \"#{@timestamp} UTC\" if @utc_offset == 0\n\n local_timestamp = @timestamp + @utc_offset\n sign = @utc_offset >= 0 ? '+' : '-'\n \n min, sec = @utc_offset.abs.divmod(60)\n hour, min = min.divmod(60)\n \n \"#{local_timestamp} #{sign}#{'%02d' % hour}:#{'%02d' % min}#{sec > 0 ? ':%02d' % sec : nil} (#{@timestamp} UTC)\" \n end", "title": "" }, { "docid": "e2a8a8d66679c3628ba4a2b2cfadc526", "score": "0.5397148", "text": "def created_at_s\n created_at.to_s(:short_date_string)\n end", "title": "" }, { "docid": "b2b0ff6e736576103a281b4a170154f3", "score": "0.5385993", "text": "def to_utc(local); end", "title": "" }, { "docid": "b2b0ff6e736576103a281b4a170154f3", "score": "0.5385993", "text": "def to_utc(local); end", "title": "" }, { "docid": "7ed7ae844ad05f4ebd49fdab21461cd4", "score": "0.5383132", "text": "def formatted\n time.utc.strftime('%FT%TZ')\n end", "title": "" }, { "docid": "f18a48699beab19c8a501cb3329964d6", "score": "0.53748095", "text": "def httpdate\n utc.httpdate\n end", "title": "" }, { "docid": "b798ff25ebd4b1fca3582c32e974f4d0", "score": "0.53718764", "text": "def to_ElasticDate\n return (self.strftime(\"%Y-%m-%dT%H:%M:%S\") + DateTime.now.zone)\n end", "title": "" }, { "docid": "b8267e8a6fb57ddb3c91335187eb2367", "score": "0.53706163", "text": "def datetime_stamp\n Time.now.utc.iso8601\n end", "title": "" }, { "docid": "b8267e8a6fb57ddb3c91335187eb2367", "score": "0.53706163", "text": "def datetime_stamp\n Time.now.utc.iso8601\n end", "title": "" }, { "docid": "16da57fbb684b8dfd474fd343c15d846", "score": "0.53613615", "text": "def api_date; utc.strftime(API_TIME_FORMAT); end", "title": "" }, { "docid": "091a24ec0cce75df54d8267ac1e5c3fc", "score": "0.53485143", "text": "def to_string(time = Time.now)\n time.to_time.utc.strftime('%Y%m%dT%H%M%S.%LZ')\n end", "title": "" }, { "docid": "892978974f540b6ca2d9421bb8773857", "score": "0.5321527", "text": "def to_utc_time; end", "title": "" }, { "docid": "ed2fbb39a0855dce65f2969674f5cb55", "score": "0.53185207", "text": "def standard_date(date)\n date.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "title": "" }, { "docid": "e849fab877248a385c0180ee170684d3", "score": "0.531154", "text": "def utc\n @utc = true\n return self\n end", "title": "" }, { "docid": "1728ff3bf5a94034a6666423073ee649", "score": "0.5308191", "text": "def format_date( date )\n\tdate.strftime( \"%Y-%m-%dT%H:%M:%S:%L%z\" ) if date\nend", "title": "" }, { "docid": "a622cbd55b2356ef7489b2c7e540880d", "score": "0.5304537", "text": "def formatted_date\n #01/19/2017 at 01:55PM (example format)\n if self.date.nil?\n return \"\"\n else\n return self.date.in_time_zone(\"Eastern Time (US & Canada)\").strftime(\"%m/%d/%Y at %I:%M%p\")\n end\n end", "title": "" }, { "docid": "5f55cf5eaa570b44c83d03532505510c", "score": "0.530159", "text": "def getutc\n self.dup.utc\n end", "title": "" }, { "docid": "917392d6d28e2686f58ec490f87c6c73", "score": "0.52842385", "text": "def today_at_8pm_iso \n DateTime.parse(DateTime.now.strftime('%Y%m%d') + \"T20:00:00-04:00\").iso8601\n end", "title": "" }, { "docid": "b1828887b00f4869c6863f460b28429a", "score": "0.52826154", "text": "def utc\n new_offset(0)\n end", "title": "" }, { "docid": "6e64550c354da61e0c56aca19da635eb", "score": "0.5265414", "text": "def get_date_string(options)\n time = Time.new\n time = time.to_a\n date = Time.utc(*time)\n date_string = date.to_s.gsub(/\\s+/,\"_\")\n date_string = date_string.gsub(/:/,\"_\")\n date_string = date_string.gsub(/-/,\"_\")\n if options['verbose'] == true\n handle_output(options,\"Information:\\tSetting date string to #{date_string}\")\n end\n return date_string\nend", "title": "" }, { "docid": "e4db950f94f94ffe2dbb86f607238c00", "score": "0.5260473", "text": "def date\n Time.now.strftime(\"%d.%m.%Y %T %Z\")\nend", "title": "" }, { "docid": "2928cecfefc7d704b118c0ef9f750440", "score": "0.5259707", "text": "def event_date_time_s\n event_date_time.utc.strftime DATE_TIME_FORMAT\n end", "title": "" }, { "docid": "8a6517b44ec2a2116644bab03d854aba", "score": "0.5255784", "text": "def utc\n utc = new_offset(0)\n\n Time.utc(\n utc.year, utc.month, utc.day,\n utc.hour, utc.min, utc.sec + utc.sec_fraction\n )\n end", "title": "" }, { "docid": "2c21d972fb794523cb9b48c334c7db5d", "score": "0.52491534", "text": "def isoify_dates(hash)\n hash.each_with_object({}) do |(k, v), memo|\n memo[k] = datetime_in_iso8601(v)\n end\n end", "title": "" }, { "docid": "815e156c208923c21879e088ba47194a", "score": "0.5247344", "text": "def timestamp\n Time.now.utc.strftime '%T UTC'\n end", "title": "" }, { "docid": "197c561ff0211609b543f1c0e10fea0e", "score": "0.5241399", "text": "def as_utc\r\n Time.utc(year, month, day, hour, min, sec)\r\n end", "title": "" }, { "docid": "80bf14254d0de59878dd33f8f34461f0", "score": "0.5233994", "text": "def date\n if custom_date?\n return custom_date\n end\n Time.now.utc\n end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "25bf57d5f7e591f54568fba19a1fdb2c", "score": "0.5225274", "text": "def utc?; end", "title": "" }, { "docid": "a58576cc96693b5e6a25d713ec46d0f1", "score": "0.5218685", "text": "def date_string; end", "title": "" }, { "docid": "95036e420058e3166236396aa42fd2a6", "score": "0.52126026", "text": "def meeting_date_to_iso\n ms = meeting_sessions.first\n date = ms ? ms.scheduled_date : header_date\n date.strftime('%Y%m%d')\n end", "title": "" } ]
67b5942173f9787609c2f02120e13cca
MAKES PARAMS test minimum params for residuals endpoint
[ { "docid": "ff626cb8e78678ffce9917010455115b", "score": "0.52640224", "text": "def makes_params_1\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n makeCode: \"100\",\n residuals: true\n }\n end", "title": "" } ]
[ { "docid": "432b02fb893ea5a21468c22f2b9234d4", "score": "0.5676342", "text": "def params_required\n\n min, max = 0, @action_params.size\n\n unlimited = false\n @action_params.each_with_index do |setup, i|\n\n increment = setup[0] == :req ? true : false\n\n if param = @action_params.values_at(i+1)[0]\n increment = true if param[0] == :req\n end\n\n if setup[0] == :rest\n increment = false\n unlimited = true\n end\n\n min += 1 if increment\n end\n max = nil if unlimited\n [min, max]\n end", "title": "" }, { "docid": "b78af33c84f2f4da7abf1aa0167518c7", "score": "0.54185456", "text": "def mmp_rate; param_rate(1); end", "title": "" }, { "docid": "21f32b24b56028a987c95bd373ef8a11", "score": "0.54016006", "text": "def mhp_rate; param_rate(0); end", "title": "" }, { "docid": "cd606936925bb61d48d2ca40913b752e", "score": "0.5378362", "text": "def test_minimum_numerals( *params )\n params[0] ||= @test_params[current_method_name]\n minimum_test( /[0-9]/, params[0] )\n end", "title": "" }, { "docid": "4ba2e0075473f023a8c492a76b2c35df", "score": "0.5361093", "text": "def initialize\n super\n @params = [0.0] * 8\n end", "title": "" }, { "docid": "76acfeb0f79e97d2e8a08c4607e4a3d8", "score": "0.53105545", "text": "def mammal_params\n base_params\n end", "title": "" }, { "docid": "181e68b6a05bd63193b3558a66acc9f0", "score": "0.5292354", "text": "def mrf; xparam(5); end", "title": "" }, { "docid": "ac525960f4d0b84ebb89ee2c1c8a1039", "score": "0.5251403", "text": "def mrp_params\n params.require(:mrp).permit(:a1, :a2, :a3, :a4, :a5, :a6, :a7, :a8, :a9, :a10, :a11, :b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :c2, :c3, :est, :lt)\n end", "title": "" }, { "docid": "035190defa8d1f57e68a8de13bb07fed", "score": "0.5241191", "text": "def mineral_test_params\n params.require(:mineral_test).permit(:water_source_id, :mineral_id, :test_date, :measurement)\n end", "title": "" }, { "docid": "1fdcf16daf3bd80ccdf664dc5414df7b", "score": "0.5211951", "text": "def mat_rate; param_rate(4); end", "title": "" }, { "docid": "b9a0f9337b940b62f28c3f972fc816c8", "score": "0.5192835", "text": "def min_args\n p_layout = parameter_layout\n p_layout[:required][0] + p_layout[:required][1]\n end", "title": "" }, { "docid": "cde59108fc3258be3c6a1a26b705a30a", "score": "0.5181387", "text": "def expected_params\n []\n end", "title": "" }, { "docid": "6d1aec1f82df54c318b2d791cfb1572d", "score": "0.5181309", "text": "def verify_parameter_supermaster_fin\n prepare_parameters( 'MASFIN' )\n end", "title": "" }, { "docid": "ef34e18140e1274b2b12341a30901e42", "score": "0.5160991", "text": "def maximums_for_param_types\n { :req => 1, :opt => 1, :block => 1, :rest => 1.0/0 }\n end", "title": "" }, { "docid": "5d05699d7be4f5bcc8feb2c114fd51a2", "score": "0.5145899", "text": "def request_missing_params\n\t\t\tRake.application.last_request_missing_params = true\n\t\tend", "title": "" }, { "docid": "023a732c85c90276657e73afa2ec880d", "score": "0.513564", "text": "def sim_params\n {\n pepper: {\n ideal_n: 15.0,\n ideal_p: 45.0,\n ideal_k: 30.0,\n ideal_water: 60.0,\n min_light: 60.0,\n max_light: 90.0,\n min_health_for_growth: 80.0,\n max_health_for_death: 65.0,\n max_height: 10,\n max_depth: 4\n },\n tomato: {\n ideal_n: 16.0,\n ideal_p: 64.0,\n ideal_k: 32.0,\n ideal_water: 50.0,\n min_light: 60.0,\n max_light: 90.0,\n min_health_for_growth: 80.0,\n max_health_for_death: 65.0,\n max_height: 15,\n max_depth: 4\n }\n }\n end", "title": "" }, { "docid": "f04825bdb7b60734085b4e78e5818519", "score": "0.512203", "text": "def check_dmf_params(detect_params)\n wrong_arg = false\n [\"dataset_uri\", \"backbone\", \"time_per_cmpd\", \"upper_limit\", \"lower_limit\", \"subjectid\"].each do |key|\n if !(detect_params.include?(key))\n puts \"detect_params requires following params: dataset_uri, backbone, time_per_cmpd, upper_limit, lower_limit, subjectid\"\n wrong_arg = true\n end\n end\n\n if (detect_params[\"backbone\"].to_s != \"true\") && (detect_params[\"backbone\"].to_s != \"false\")\n puts \"backbone must be 'true' or 'false', not '#{detect_params[\"backbone\"]}'\"\n wrong_arg = true\n end\n\n if !((detect_params[\"time_per_cmpd\"].to_f.class == Float) && (detect_params[\"time_per_cmpd\"].to_f >= 0.0005) && (detect_params[\"time_per_cmpd\"].to_f <= 0.1))\n puts \"time_per_cmpd must be numeric and between 0.0005 and 0.1 (default 0.003), not '#{detect_params[\"time_per_cmpd\"]}'\"\n wrong_arg = true\n end\n\n if !((detect_params[\"upper_limit\"].to_f.class == Float) && (detect_params[\"upper_limit\"].to_f >= 0.11) && (detect_params[\"upper_limit\"].to_f <= 0.99))\n puts \"upper_limit must be numeric and between 0.11 and 0.99 (default 0.5), not '#{detect_params[\"upper_limit\"]}'\"\n wrong_arg = true\n end\n\n if !((detect_params[\"lower_limit\"].to_f.class == Float) && (detect_params[\"lower_limit\"].to_f >= 0.01) && (detect_params[\"lower_limit\"].to_f <= 0.9))\n puts \"lower_limit must be numeric and between 0.01 and 0.9 (default 0.1), not '#{detect_params[\"lower_limit\"]}'\"\n wrong_arg = true\n end \n\n if detect_params[\"upper_limit\"].to_f < detect_params[\"lower_limit\"].to_f\n puts \"lower_limit has to be smaller than upper_limit\"\n wrong_arg = true\n end\n\n if !(detect_params[\"nr_com_ratio\"].nil?)\n if !((detect_params[\"nr_com_ratio\"].to_f <= 0.75) && (detect_params[\"nr_com_ratio\"].to_f >= 0.1))\n puts \"nr_com_ratio must be between 0.1 and 0.75 (default 0.25), not '#{detect_params[\"nr_com_ratio\"]}'\"\n wrong_arg = true\n end\n end\n\n if !(detect_params[\"fminer_algo\"].nil?)\n if !(['bbrc', 'last'].include? detect_params[\"fminer_algo\"])\n puts \"fminer_algo must be 'bbrc' or 'last'\"\n wrong_arg = true\n end\n end\n\n if !(detect_params[\"verbose\"].nil?)\n if detect_params[\"verbose\"].to_s != \"true\" && detect_params[\"verbose\"].to_s != \"false\"\n puts \"verbose must be 'true' or 'false'\"\n wrong_arg = true\n end\n end \n\n if wrong_arg == true\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "f00b0fc0a5d71783902eb52bdcf4c5c5", "score": "0.51122755", "text": "def omhp; param_base(0); end", "title": "" }, { "docid": "57961a71a8b7d170995a095a7aeec981", "score": "0.51010454", "text": "def deviance\n return @optimization_result.f_minimum \n end", "title": "" }, { "docid": "314af94b40906165ee3563bcf2b26c4a", "score": "0.5088243", "text": "def min_args\n p_layout = parameter_layout\n p_layout[:required][0] + p_layout[:required][1]\n end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.508557", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.508557", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.508557", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "b392573a9beef1b0e41d5e881a8dabcd", "score": "0.50767905", "text": "def init_params\n @start = params.fetch(:start, 0).to_i\n @items = [params.fetch(:items, 10).to_i, 100].min\n\n if @start < 0 || @items < 0\n return error(\n error_code: t('api.error_codes.invalid_data'),\n error_messages: [t('api.error_messages.negative_parameter',\n start: params.fetch(:start, 'not provided'),\n items: params.fetch(:items, 'not provided'))]\n )\n end\n\n @order = params.fetch(:order, 'name ASC').to_s\n end", "title": "" }, { "docid": "59e1e423510481a764160d8ae32887f4", "score": "0.50755525", "text": "def test_minimental_params\n params.require(:test_minimental).permit(:f1, :f2, :f3, :f4, :f5, :f6, :f7, :f8, :f9, :f10, :f11, :f12, :f13, :f14, :f15, :f16, :f17, :f18, :f19, :score)\n end", "title": "" }, { "docid": "c6316b3d2ad1e550a93cbdc36db8109f", "score": "0.5068846", "text": "def makes_params_2\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n makeCode: \"100\",\n residuals: true,\n annualMileage: \"9000\",\n initialMileage: \"15000\",\n condition: \"ROUGH\"\n }\n end", "title": "" }, { "docid": "5c44110fd7203d11dde8e1644268202f", "score": "0.5066214", "text": "def check_parms\r\n # - - - - - - - - - - - - - - - - - -\r\n \r\n # Swap if needed to make sure min\r\n # really is smallest on beginning\r\n if (@beg_radius > @end_radius)\r\n print \"(warning: arc pocket swapping radius)\\n\"\r\n tt = @beg_radius\r\n @beg_radius = @end_radius\r\n @end_radius = tt\r\n end #if\r\n\r\n # swap if needed to make sure\r\n # min really is smallest on \r\n # beginning\r\n if (@beg_angle> @end_angle)\r\n print \"(warning: arc pocket swapping angles)\\n\"\r\n tt = @beg_angle\r\n @beg_angle = @end_angle\r\n @end_angle = tt\r\n end # if\r\n\r\n \r\n \r\n \r\n return self\r\n end", "title": "" }, { "docid": "054b4c3bcec7444a24725dfbf3b49c40", "score": "0.5062292", "text": "def dumpParameters(pars)\n puts \n puts '#-----------------------------------------------------------------------------#'\n puts '# Define All MINUIT Parameters #'\n puts '#-----------------------------------------------------------------------------#'\n puts 'define_parameters { # only executed once during pre-fit set up '\n pars.each do |par|\n par.dumpForDefine\n end\n puts '}'\n\n puts \n puts '#-----------------------------------------------------------------------------#'\n puts '# Initialize MINUIT Parameters for Next Fit Iteration #'\n puts '#-----------------------------------------------------------------------------#'\n puts 'initialize_parameters { # executed before each iteration'\n pars.each do |par|\n if par.terms[\"free?\"] == \"true\"\n par.dumpForInitialize\n end\n end\n puts '}'\n\nend", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.50615525", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.50615525", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.50615525", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.50587904", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.50587904", "text": "def check_params; true; end", "title": "" }, { "docid": "08f0811214bb532bf2e26893c8e35ed8", "score": "0.5048542", "text": "def unfit_step_weight\n @m0 ||= (pseudoplan[unfit_kappa_basis_var] < low_restr[unfit_kappa_basis_var] ? 1 : -1)\n end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.5037301", "text": "def min_rep; end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.5037301", "text": "def min_rep; end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.5037301", "text": "def min_rep; end", "title": "" }, { "docid": "b170c6acd95a521c28f8a7e86e5e4cb8", "score": "0.50334454", "text": "def fleet_calculator_params\n params.require(:total_weight)\n end", "title": "" }, { "docid": "512fdc3075157ef1b4de8f8d98021194", "score": "0.50246334", "text": "def getparams(rawparams)\n\n temp = rawparams[:temperature].to_f if rawparams[:temperature].present?\n pres = rawparams[:pressure].to_f if rawparams[:pressure].present?\n quality = rawparams[:quality].to_f if rawparams[:quality].present?\n v = rawparams[:specific_volume].to_f if rawparams[:specific_volume].present?\n u = rawparams[:specific_energy].to_f if rawparams[:specific_energy].present?\n h = rawparams[:specific_enthalpy].to_f if rawparams[:specific_enthalpy].present?\n s = rawparams[:specific_entropy].to_f if rawparams[:specific_entropy].present?\n\n return {temperature: temp, pressure: pres, quality: quality,\n specific_volume: v, specific_energy: u,\n specific_enthalpy: h, specific_entropy: s, status: 'success'}\n\n end", "title": "" }, { "docid": "5d931a90d1c3a5f5e7170535c066e0c9", "score": "0.5022436", "text": "def tramplesMinimize?(_param=1); return false; end", "title": "" }, { "docid": "b46c5e9c5530c6f24d2d7c453e8e915e", "score": "0.5016265", "text": "def mrg; xparam(8); end", "title": "" }, { "docid": "6b9d3a33b08d096c0224937619b45a3b", "score": "0.5014959", "text": "def ensure_params(necessary_params)\n necessary_params.all?(&method(:ensure_param))\n end", "title": "" }, { "docid": "5a95b7c233e94bc210e00c2872be6603", "score": "0.500963", "text": "def get_optimal_params(data_set, current_entropy)\n\t\t\toptimal_params = {best_gain: 0.0}\n\n\t\t\tfor_each_attribute(data_set) do |column_index|\n\t\t\t\tattribute_value_range(column_index).each do |divider_value|\n\t\t\t\n\t\t\t\t\ttrue_set, false_set = divide_set(column_index, divider_value, data_set)\n\t\t\t\t\tgain = information_gain(true_set, false_set, current_entropy)\n\n\t\t\t\t\tif gain > optimal_params[:best_gain]\n\t\t\t\t\t\toptimal_params.merge!({\n\t\t\t\t\t\t\tbest_gain: gain,\n\t\t\t\t\t\t\tcolumn: column_index,\n\t\t\t\t\t\t\tdividing_value: divider_value,\n\t\t\t\t\t\t\ttrue_set: true_set,\n\t\t\t\t\t\t\tfalse_set: false_set\n\t\t\t\t\t\t})\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\toptimal_params\n\t\tend", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.5008858", "text": "def need_params\n end", "title": "" }, { "docid": "8673db959929e4e7a71d511b61a72a5b", "score": "0.50087273", "text": "def init_params\n @start = params.fetch(:start, 0).to_i\n @items = [params.fetch(:items, 10).to_i, item_limit].min\n\n if @start < 0 || @items < 0\n return error(\n error_code: t(\"api.error_codes.invalid_data\"),\n error_messages: [t(\"api.error_messages.negative_parameter\",\n start: params.fetch(:start, \"not provided\"),\n items: params.fetch(:items, \"not provided\"))]\n )\n end\n\n @order = params.fetch(:order, \"name ASC\").to_s\n end", "title": "" }, { "docid": "bcf5197e5f48111d0f44c7fceb0f4ff5", "score": "0.5008532", "text": "def mhp; param(0); end", "title": "" }, { "docid": "e3dfbcbf6e0e315f7841e9f7349c1709", "score": "0.49950454", "text": "def test_params_to_qualifications_nothing_2\n p = { 'qo_01234567890123456789' => '', 'qv_01234567890123456789' => '2' }\n q = @controller.bypass.params_to_qualifications(p)\n assert_equal q.length, 0\n end", "title": "" }, { "docid": "1bcff38bfec8026c77b5db991fa1b2e5", "score": "0.49949652", "text": "def mineral_params\n params.require(:mineral).permit(:name, :color, :luster, :streak, :hardness_min, :hardness_max, :cleavage, :fracture, :description, :img_url)\n end", "title": "" }, { "docid": "3179e269ad6432487fd4a378838beeeb", "score": "0.49859345", "text": "def sc_mismatch; parse_params; @sc_mismatch; end", "title": "" }, { "docid": "e8b2d0704a4f6459ef221d17ae4f726c", "score": "0.4978893", "text": "def check_params *param\n raise RequestError.new(:missing_params, \"Missing parameters, need all of #{param}\") unless param.all? { |p| has_param? p }\n end", "title": "" }, { "docid": "6cb0a4fe5b243bc143519201546ceec5", "score": "0.49705005", "text": "def models_params_1\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n makeCode: \"100\",\n modelCode: \"140\",\n residuals: true\n }\n end", "title": "" }, { "docid": "63805708ab5ddf8a22e1835a9b0f71d3", "score": "0.49689376", "text": "def good_params\n params[:good]\n end", "title": "" }, { "docid": "b12ca617712e288758c25df1003fc309", "score": "0.4967028", "text": "def correct_params\n params.select{ |x| x.correct? }\n end", "title": "" }, { "docid": "db2329002b4374ad9ac6ce74690c6177", "score": "0.4965822", "text": "def nparams()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "406ed328946cc224f52515d30480291f", "score": "0.4965271", "text": "def tune_params\n params.fetch(:tune, {})\n end", "title": "" }, { "docid": "27af5440b6792efa896431f42d9af881", "score": "0.49578634", "text": "def test_all_param_codepoints\n\t\tparams = Klass.constants.map {|x| x if x =~ /PARAM$/}.compact\n\t\tassert_operator params.size, :>=, 6 # Allow for more later.\n\t\tparams.each do |p|\n\t\t\tcp = p.split(/_PARAM/).first\n\t\t\tnext if cp == \"DDM\"\n\t\t\tassert Konst.const_defined? cp\n\t\t\tassert_kind_of Numeric, Konst.const_get(cp)\n\t\tend\n\tend", "title": "" }, { "docid": "f35795f75ff6f2ceeeb9f8e11bbc3cc4", "score": "0.49527898", "text": "def min_x; end", "title": "" }, { "docid": "7f17a5f50a563d4c1e97251fbac4b483", "score": "0.49525538", "text": "def satisfy(x)\r\n (@b - @w * x).t.to_a.flatten.min + EPS >= 0.0\r\n end", "title": "" }, { "docid": "cc5771e97bbb9b8fb5698a07232dd730", "score": "0.49521753", "text": "def min_degree() [min_in_degree, min_out_degree].min; end", "title": "" }, { "docid": "9da8ea0c40392072b31c30f3588a1d4f", "score": "0.49515373", "text": "def initialize\n\n @r = nil\n @s = nil\n @min_prob = nil\n @use_min_prob = false\n @should_fit_s = true\n\n end", "title": "" }, { "docid": "d3376f52bca5b16d8e51fec1c71ee206", "score": "0.4950304", "text": "def theta\n return @optimization_result.x_minimum \n end", "title": "" }, { "docid": "3ae74a2459e3685d847d19d64e35de19", "score": "0.495029", "text": "def params_without_defaults!(params)\n filters = settings.filter_settings\n\n params.delete(\"min_price\") if params[:min_price] == filters[:price].first.first\n params.delete(\"max_price\") if params[:max_price] == filters[:price].last.first\n params.delete(\"min_beds\") if params[:min_beds] == filters[:bedrooms].first.first\n params.delete(\"max_beds\") if params[:max_beds] == filters[:bedrooms].last.first\n return params\n end", "title": "" }, { "docid": "a04296b7ed145cf2c550461eb7df9473", "score": "0.49496377", "text": "def min(*data_points)\n end", "title": "" }, { "docid": "63d95af713c7e4958abc26542fc93a2a", "score": "0.4946258", "text": "def coarse_params\n params[:coarse]\n end", "title": "" }, { "docid": "c736592772a91f59b9b1f679f659b0c7", "score": "0.49416554", "text": "def calculate_minimum_speed\n self.points.slowest.first.speed if self.points.slowest and self.points.slowest.first and self.points.slowest.first.speed\n end", "title": "" }, { "docid": "5486e76bc3d47ae4b3a9779ac92e4304", "score": "0.49340686", "text": "def get_test_params_performance(params_array)\n params_array.each do |params|\n params['TEST_VALUE'] ||= rand(9999).to_s\n end\nend", "title": "" }, { "docid": "dca2b99f4cb56ff8b417f84153c46ad5", "score": "0.49283996", "text": "def required_params\n params.select{ |x| x.required? }\n end", "title": "" }, { "docid": "fd074531428899ecf68c76ea4182fbb8", "score": "0.49261162", "text": "def validate_params\n #params['message'].to_i > 50 && params['method'] != 'sum'\n end", "title": "" }, { "docid": "929b51093be131262783a76b954b629c", "score": "0.49250287", "text": "def extract_params_pm()\n params = {\n :creditsMax => @creditsMax,\n :creditsMin => @creditsMin,\n :intitule => @intitule,\n :langue => @langue,\n :sigles => sigles_array(),\n :mtype => @mtype,\n :dptCharge => @dptCharge,\n :commentaire => @commentaire,\n :validite => @validite,\n :import_commentaire => @import_commentaire,\n :status => @status\n }\n return params\n end", "title": "" }, { "docid": "15bed8506cd7fe5377a2953032d4e6a2", "score": "0.49248183", "text": "def params_error\n return if params_valid?\n\n if @params.empty?\n respond 'No parameters set', HTTP_ANSWER_INVALID_URL\n else\n bad_params = @params.keys - [TIME_FORMAT_PARAMETER]\n respond 'Unknown parameter ' + bad_params.to_s, HTTP_ANSWER_INVALID_URL\n end\n end", "title": "" }, { "docid": "a9f47f08ed5bbe299c2b9c6e4af8fd7a", "score": "0.49244523", "text": "def simple_model_params additional_params={}\n {\"assignmentRules\"=>\"\\r\\n\",\n \"modelname\"=>\"model1\",\n \"parameterset\"=>\"\\r\\nVmGLT = 99.999\\r\\nKeqGLT = 1\\r\\nKmGLTGLCo = 1.1918\\r\\nKmGLTGLCi = 1.1918\\r\\nVmGLK = 226.452\\r\\nKeqGLK = 3800\\r\\nKmGLKGLCi = 0.08\\r\\nKmGLKG6P = 30\\r\\nKmGLKATP = 0.15\\r\\nKmGLKADP = 0.23\\r\\nVmPGI = 339.677\\r\\nKeqPGI = 0.314\\r\\nKmPGIG6P = 1.4\\r\\nKmPGIF6P = 0.3\\r\\nVmPFK = 182.903\\r\\ngR = 5.12\\r\\nL0 = 0.66\\r\\nKmPFKF6P = 0.1\\r\\nCPFKF6P = 0.0\\r\\nKmPFKATP = 0.71\\r\\nCPFKATP = 3\\r\\nKPFKAMP = 0.0995\\r\\nCPFKAMP = 0.0845\\r\\nKiPFKATP = 0.65\\r\\nCiPFKATP = 100\\r\\nKPFKF26BP = 0.000682\\r\\nCPFKF26BP = 0.0174\\r\\nKPFKF16BP = 0.111\\r\\nCPFKF16BP = 0.397\\r\\nVmALD = 322.258\\r\\nKeqALD = 0.069\\r\\nKmALDF16P = 0.3\\r\\nKmALDGAP = 2\\r\\nKmALDDHAP = 2.4\\r\\nKmALDGAPi = 10\\r\\nVmGAPDHf = 1184.52\\r\\nVmGAPDHr = 6549.68\\r\\nKmGAPDHGAP = 0.21\\r\\nKmGAPDHBPG = 0.0098\\r\\nKmGAPDHNAD = 0.09\\r\\nKmGAPDHNADH = 0.06\\r\\nVmG3PDH = 70.15\\r\\nKeqG3PDH = 4300\\r\\nKmG3PDHDHAP = 0.4\\r\\nKmG3PDHNADH = 0.023\\r\\nKmG3PDHNAD = 0.93\\r\\nKmG3PDHGLY = 1\\r\\nVmPGK = 1306.45\\r\\nKeqPGK = 3200\\r\\nKmPGKBPG = 0.003\\r\\nKmPGKP3G = 0.53\\r\\nKmPGKADP = 0.2\\r\\nKmPGKATP = 0.3\\r\\nVmPGM = 2525.81\\r\\nKeqPGM = 0.19\\r\\nKmPGMP3G = 1.2\\r\\nKmPGMP2G = 0.08\\r\\nVmENO = 365.806\\r\\nKeqENO = 6.7\\r\\nKmENOP2G = 0.04\\r\\nKmENOPEP = 0.5\\r\\nVmPYK = 1088.71\\r\\nKeqPYK = 6500\\r\\nKmPYKPEP = 0.14\\r\\nKmPYKPYR = 21\\r\\nKmPYKADP = 0.53\\r\\nKmPYKATP = 1.5\\r\\nVmPDC = 174.194\\r\\nKmPDCPYR = 4.33\\r\\nnPDC = 1.9\\r\\nVmADH = 810\\r\\nKeqADH = \\\"6.9e-5\\\"\\r\\nKmADHACE = 1.11\\r\\nKmADHETOH = 17\\r\\nKmADHNADH = 0.11\\r\\nKmADHNAD = 0.17\\r\\nKiADHACE = 1.1\\r\\nKiADHETOH = 90\\r\\nKiADHNADH = 0.031\\r\\nKiADHNAD = 0.92\\r\\nKATPASE = 39.5\\r\\nKGLYCOGEN = 6\\r\\nKTREHALOSE = 2.4\\r\\nKSUCC = 21.4\\r\\nF26BP = 0.02\\r\\nSUMAXP = 4.1\\r\\nKeqAK = 0.45\\r\\nKeqTPI = 0.045\\r\\ncompartment = 1\\r\\nGlyc = 0.0\\r\\nTrh = 0.0\\r\\nCO2 = 1\\r\\nSUCC = 0.0\\r\\nGLCo = 50\\r\\nETOH = 50\\r\\nGLY = 0.15\\r\\nX = 0.0\\r\\n\\r\\n\", \"events\"=>\"\\r\\n\", \"kinetics\"=>\"v[vGLK] = (VmGLK*(-(G6P[t]*(SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((1-4*KeqAK)*KeqGLK))+GLCi[t]*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/(2-8*KeqAK))/(KmGLKATP*KmGLKGLCi*(1+G6P[t]/KmGLKG6P+GLCi[t]/KmGLKGLCi)*(1+(SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((1-4*KeqAK)*KmGLKADP)+(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmGLKATP))))\\r\\nv[vPGI] = VmPGI/KmPGIG6P*(G6P[t]-F6P[t]/KeqPGI)/(1+G6P[t]/KmPGIG6P+F6P[t]/KmPGIF6P)\\r\\nv[vGLYCO] = KGLYCOGEN\\r\\nv[vTreha] = KTREHALOSE\\r\\nv[vPFK] = gR*VmPFK*F6P[t]*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])*(1+F6P[t]/KmPFKF6P+(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPFKATP)+gR*F6P[t]*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPFKATP*KmPFKF6P))/((2-8*KeqAK)*KmPFKATP*KmPFKF6P*(L0*Power[1+CPFKF26BP*F26BP/KPFKF26BP+CPFKF16BP*F16P[t]/KPFKF16BP,2]*Power[1+2*CPFKAMP*KeqAK*Power[SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5],2]/((-1+4*KeqAK)*KPFKAMP*(SUMAXP-Prb[t]+4*KeqAK*Prb[t]-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])),2]*Power[1+CiPFKATP*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KiPFKATP),2]*Power[1+CPFKATP*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPFKATP),2]/(Power[1+F26BP/KPFKF26BP+F16P[t]/KPFKF16BP,2]*Power[1+2*KeqAK*Power[SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5],2]/((-1+4*KeqAK)*KPFKAMP*(SUMAXP-Prb[t]+4*KeqAK*Prb[t]-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])),2]*Power[1+(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KiPFKATP),2])+Power[1+F6P[t]/KmPFKF6P+(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPFKATP)+gR*F6P[t]*(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPFKATP*KmPFKF6P),2]))\\r\\nv[vALD] = VmALD*(F16P[t]-KeqTPI*Power[TRIO[t],2]/(KeqALD*Power[1+KeqTPI,2]))/(KmALDF16P*(1+F16P[t]/KmALDF16P+TRIO[t]/((1+KeqTPI)*KmALDDHAP)+KeqTPI*TRIO[t]/((1+KeqTPI)*KmALDGAP)+KeqTPI*F16P[t]*TRIO[t]/((1+KeqTPI)*KmALDF16P*KmALDGAPi)+KeqTPI*Power[TRIO[t],2]/(Power[1+KeqTPI,2]*KmALDDHAP*KmALDGAP)))\\r\\nv[vGAPDH] = (-(VmGAPDHr*BPG[t]*NADH[t]/(KmGAPDHBPG*KmGAPDHNADH))+KeqTPI*VmGAPDHf*NAD[t]*TRIO[t]/((1+KeqTPI)*KmGAPDHGAP*KmGAPDHNAD))/((1+NAD[t]/KmGAPDHNAD+NADH[t]/KmGAPDHNADH)*(1+BPG[t]/KmGAPDHBPG+KeqTPI*TRIO[t]/((1+KeqTPI)*KmGAPDHGAP)))\\r\\nv[vPGK] = VmPGK*(KeqPGK*BPG[t]*(SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/(1-4*KeqAK)-(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])*P3G[t]/(2-8*KeqAK))/(KmPGKATP*KmPGKP3G*(1+(SUMAXP-Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((1-4*KeqAK)*KmPGKADP)+(-SUMAXP+Prb[t]-4*KeqAK*Prb[t]+Power[Power[SUMAXP,2]-2*SUMAXP*Prb[t]+8*KeqAK*SUMAXP*Prb[t]+Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2],0.5])/((2-8*KeqAK)*KmPGKATP))*(1+BPG[t]/KmPGKBPG+P3G[t]/KmPGKP3G))\\r\\nv[vPGM] = VmPGM/KmPGMP3G*(P3G[t]-P2G[t]/KeqPGM)/(1+P3G[t]/KmPGMP3G+P2G[t]/KmPGMP2G)\\r\\nv[vENO] = VmENO/KmENOP2G*(P2G[t]-PEP[t]/KeqENO)/(1+P2G[t]/KmENOP2G+PEP[t]/KmENOPEP)\\r\\nv[vPYK] = VmPYK/(KmPYKPEP*KmPYKADP)*(PEP[t]*(SUMAXP-Power[Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2]-2*Prb[t]*SUMAXP+8*KeqAK*Prb[t]*SUMAXP+Power[SUMAXP,2],0.5])/(1-4*KeqAK)-PYR[t]*((Prb[t]-4*KeqAK*Prb[t]-SUMAXP+Power[Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2]-2*Prb[t]*SUMAXP+8*KeqAK*Prb[t]*SUMAXP+Power[SUMAXP,2],0.5])/(2-8*KeqAK))/KeqPYK)/((1+PEP[t]/KmPYKPEP+PYR[t]/KmPYKPYR)*(1+(Prb[t]-4*KeqAK*Prb[t]-SUMAXP+Power[Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2]-2*Prb[t]*SUMAXP+8*KeqAK*Prb[t]*SUMAXP+Power[SUMAXP,2],0.5])/(2-8*KeqAK)/KmPYKATP+(SUMAXP-Power[Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2]-2*Prb[t]*SUMAXP+8*KeqAK*Prb[t]*SUMAXP+Power[SUMAXP,2],0.5])/(1-4*KeqAK)/KmPYKADP))\\r\\nv[vPDC] = VmPDC*(Power[PYR[t],nPDC]/Power[KmPDCPYR,nPDC])/(1+Power[PYR[t],nPDC]/Power[KmPDCPYR,nPDC])\\r\\nv[vSUC] = KSUCC*ACE[t]\\r\\nv[vGLT] = VmGLT*(GLCo-GLCi[t]/KeqGLT)/(KmGLTGLCo*(1+GLCo/KmGLTGLCo+GLCi[t]/KmGLTGLCi+0.91*GLCo*GLCi[t]/(KmGLTGLCi*KmGLTGLCo)))\\r\\nv[vADH] = -(VmADH/(KiADHNAD*KmADHETOH)*(NAD[t]*ETOH-NADH[t]*ACE[t]/KeqADH)/(1+NAD[t]/KiADHNAD+KmADHNAD*ETOH/(KiADHNAD*KmADHETOH)+KmADHNADH*ACE[t]/(KiADHNADH*KmADHACE)+NADH[t]/KiADHNADH+NAD[t]*ETOH/(KiADHNAD*KmADHETOH)+KmADHNADH*NAD[t]*ACE[t]/(KiADHNAD*KiADHNADH*KmADHACE)+KmADHNAD*ETOH*NADH[t]/(KiADHNAD*KmADHETOH*KiADHNADH)+NADH[t]*ACE[t]/(KiADHNADH*KmADHACE)+NAD[t]*ETOH*ACE[t]/(KiADHNAD*KmADHETOH*KiADHACE)+ETOH*NADH[t]*ACE[t]/(KiADHETOH*KiADHNADH*KmADHACE)))\\r\\nv[vG3PDH] = VmG3PDH*(-(GLY*NAD[t]/KeqG3PDH)+NADH[t]*TRIO[t]/(1+KeqTPI))/(KmG3PDHDHAP*KmG3PDHNADH*(1+NAD[t]/KmG3PDHNAD+NADH[t]/KmG3PDHNADH)*(1+GLY/KmG3PDHGLY+TRIO[t]/((1+KeqTPI)*KmG3PDHDHAP)))\\r\\nv[vATP] = KATPASE*((Prb[t]-4*KeqAK*Prb[t]-SUMAXP+Power[Power[Prb[t],2]-4*KeqAK*Power[Prb[t],2]-2*Prb[t]*SUMAXP+8*KeqAK*Prb[t]*SUMAXP+Power[SUMAXP,2],0.5])/(2-8*KeqAK))\\r\\n\\r\\n\", \"functions\"=>\"\\r\\n*Power[?] := ?\\r\\n\", \"controller\"=>\"models\", \"initVal\"=>\"GLCi[0] = 0.087\\r\\nPrb[0] = 5\\r\\nG6P[0] = 1.39\\r\\nF6P[0] = 0.28\\r\\nF16P[0] = 0.1\\r\\nTRIO[0] = 5.17\\r\\nNAD[0] = 1.2\\r\\nBPG[0] = 0.0\\r\\nNADH[0] = 0.39\\r\\nP3G[0] = 0.1\\r\\nP2G[0] = 0.1\\r\\nPEP[0] = 0.1\\r\\nPYR[0] = 3.36\\r\\nACE[0] = 0.04\\r\\n\\r\\n\",\n \"reaction\"=>\"v[vGLK] {1.0}GLCi + {1.0}Prb = {1.0}G6P\\r\\nv[vPGI] {1.0}G6P = {1.0}F6P\\r\\nv[vGLYCO] {1.0}G6P + {1.0}Prb = {1.0}$Glyc\\r\\nv[vTreha] {2.0}G6P + {1.0}Prb = {1.0}$Trh\\r\\nv[vPFK] {1.0}F6P + {1.0}Prb = {1.0}F16P\\r\\nv[vALD] {1.0}F16P = {2.0}TRIO\\r\\nv[vGAPDH] {1.0}TRIO + {1.0}NAD = {1.0}BPG + {1.0}NADH\\r\\nv[vPGK] {1.0}BPG = {1.0}P3G + {1.0}Prb\\r\\nv[vPGM] {1.0}P3G = {1.0}P2G\\r\\nv[vENO] {1.0}P2G = {1.0}PEP\\r\\nv[vPYK] {1.0}PEP = {1.0}PYR + {1.0}Prb\\r\\nv[vPDC] {1.0}PYR = {1.0}$CO2 + {1.0}ACE\\r\\nv[vSUC] {2.0}ACE + {3.0}NAD = {1.0}$SUCC + {3.0}NADH\\r\\nv[vGLT] {1.0}$GLCo = {1.0}GLCi\\r\\nv[vADH] {1.0}ACE + {1.0}NADH = {1.0}NAD + {1.0}$ETOH\\r\\nv[vG3PDH] {1.0}TRIO + {1.0}NADH = {1.0}NAD + {1.0}$GLY\\r\\nv[vATP] {1.0}Prb = {1.0}$X\\r\\n\",\n \"steadystateanalysis\"=>\"on\"\n }.merge additional_params\n\n end", "title": "" }, { "docid": "b3ed433a411892e7786779341701b91a", "score": "0.4923848", "text": "def find_minimum( start_input, max_iterations: 1000, treshold: 10**-9 , learning_rate: 0.01 )\n descent = calculate_descent( start_input )\n iterations = 0\n input = start_input\n while descent.abs > treshold && iterations < max_iterations\n old_input = input\n input = input-descent.to_f*learning_rate\n new_descent = calculate_descent( input )\n learning_rate = learning_rate.to_f/10 if new_descent*descent < 0 # slow down if descent changes\n descent = new_descent\n iterations = iterations+1\n end \n { input: input, descent: descent, learning_rate: learning_rate, output: calculate( input ), iterations: iterations }\n end", "title": "" }, { "docid": "eba4fa1a27fe9d1fbd52cf24bfc36670", "score": "0.4923423", "text": "def mmp; param(1); end", "title": "" }, { "docid": "eba4fa1a27fe9d1fbd52cf24bfc36670", "score": "0.4923423", "text": "def mmp; param(1); end", "title": "" }, { "docid": "29bf192d8ed75e2b0bf545335a313a0c", "score": "0.49208248", "text": "def test_e213_get_maximized_array\n verify_method :e213_get_maximized_array,\n :with => [\n param: 3,\n predicate: Proc.new { |arr| check_min_pass_count(3, arr) }\n ]\n end", "title": "" }, { "docid": "f3cc5359c141c8268b967f3041093040", "score": "0.4917074", "text": "def parameters( test )\n if test == 'all'\n\n return Array.new\n else\n\n return Array.new\n end\n end", "title": "" }, { "docid": "f3cc5359c141c8268b967f3041093040", "score": "0.4917074", "text": "def parameters( test )\n if test == 'all'\n\n return Array.new\n else\n\n return Array.new\n end\n end", "title": "" }, { "docid": "7907abedf1f6d14b6167ffe7907af01c", "score": "0.4913817", "text": "def check_required_parameters()\n params_good = true\n @required_parameters.each do |req_par|\n passed_reqpar = get_arg_value(req_par)\n if passed_reqpar.nil? || passed_reqpar == \"\"\n params_good = false\n end\n end\n\n has_atleast_one = true\n if @requires_atleast_one.size > 0\n has_atleast_one = false\n @requires_atleast_one.each do |least_one|\n luno = get_arg_value(least_one)\n if ! luno.nil? && luno != \"\"\n has_atleast_one = true\n end\n end\n end\n\n if !params_good || ! has_atleast_one\n puts \"Missing parameters: #{@required} #{params_good} && #{has_atleast_one}\"\n exit(1)\n end\n\n end", "title": "" }, { "docid": "9d945abe48f3e93cb1ba8f612379effa", "score": "0.49088785", "text": "def makes_params_4\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n makeCode: \"100\",\n residuals: true,\n onlyPublished: false,\n onlyNew: false,\n rounding: true,\n initialMileage: \"10000\",\n annualMileage: \"17000\",\n condition: \"ROUGH\",\n weighting: \"BUILD\"\n }\n end", "title": "" }, { "docid": "7c277a9838726e632e4b694320b731e2", "score": "0.4906622", "text": "def required_params\n [\"unit_id\", \"number_of_peers\"]\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.49052265", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "a0516363da928dbda30c882c5445f467", "score": "0.4900828", "text": "def model_lines_params_1\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n modelLineId: \"14700\",\n residuals: true\n }\n end", "title": "" }, { "docid": "46c7149733e2f65ba61fef19311d4bb9", "score": "0.49008015", "text": "def fill_blank_params(params)\n\n params[confidence: 'high'] #Default confidence of parsing is high\n\n unless all_values_present?(params)\n top_lookups = Lookup.order_by(:other_domain_hits.desc).limit(5)\n top_lookups.each do |top_lookup|\n params = fill_blanks_given_lookup(params, top_lookup)\n\n if all_values_present? params\n params[confidence: 'medium']\n break\n end\n\n end\n\n unless all_values_present?(params)\n params = fill_blanks_given_lookup(params, Lookup.new(@@default_lookup_hash))\n params[confidence: 'low'] #If I have to use the default parser, the confidence for parsing is low\n end\n end\n\n return params\n end", "title": "" }, { "docid": "2c3f0093782052c79dd37a1a10a1b9dd", "score": "0.48937517", "text": "def get_vertext_min_PL(i_vertices)\n #puts \" --entered get_vertext_min_PL1\"\n #puts \" --input #{i_vertices.length} \" #---\"[294029732]}\"\n min=INFINITY\n x=EMPTY\n i_vertices.each do |cur_vertex|\n #puts \"cur_vertex #{cur_vertex[0]} #{cur_vertex[1].status} path length: #{cur_vertex[1].path_length}\"\n if (cur_vertex[1].status == TEMPORARY and cur_vertex[1].path_length < min ) #perm=pokus...osledni podminka navic and edge.v1.path_length != INFINITY\n #puts \" --vertex.sts= #{cur_vertex[1].status} vertex.path_length(#{cur_vertex[1].path_length}) is less then min #{min}\"\n x=cur_vertex[1]\n min=cur_vertex[1].path_length\n end\n end\n\n #if x != EMPTY\n #puts \" - get_nearest_vertex - about to return #{x.id} with min #{min} value of all connected Vx\"\n #end\n return x\n end", "title": "" }, { "docid": "949759e8887f972b53cb35a3b71998e5", "score": "0.48840812", "text": "def last_required_params\n\t\t\t@last_required_params ||= {}\n\t\tend", "title": "" }, { "docid": "7df292335b7b6e2e4cca74dfe58e09c1", "score": "0.48718736", "text": "def minimum(params, cache=nil, from_cache=true, cache_expiration=nil)\n keen_query(__method__, params, cache, from_cache)\n end", "title": "" }, { "docid": "5f3fbe84ec52f03e6996e2712679efd5", "score": "0.48704088", "text": "def get_required_params\n missing = []\n @required_params.each do |param|\n param_value = get_site_setting(param)\n if param_value.nil?\n missing << param\n else\n self.instance_variable_set \"@#{param.to_s}\", param_value\n end\n end\n unless missing.empty?\n @errors ||= []\n @errors << missing.join(', ')\n end\n end", "title": "" }, { "docid": "b61a818d321cafa7088a262461589e7a", "score": "0.4869581", "text": "def test_params_to_qualifications\n p = { 'qo_01234567890123456789' => '1', 'qv_01234567890123456789' => '2' }\n q = @controller.bypass.params_to_qualifications(p)\n assert_equal q.length, 1\n assert_equal q[0][:id], '01234567890123456789'\n assert_equal q[0][:operation], '1'\n assert_equal q[0][:value], '2'\n end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.48671", "text": "def request_params; end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.48671", "text": "def request_params; end", "title": "" }, { "docid": "13375ecab781ad3c87e987814c5311ad", "score": "0.48633337", "text": "def request_parameters; end", "title": "" }, { "docid": "b2374d08e902978900fc720e85feb95a", "score": "0.48584563", "text": "def needs_params(param_one, param_two)\n [param_one, param_two].sample\nend", "title": "" }, { "docid": "aaf4e6e3a5426d92a81c1cb435ac81d4", "score": "0.48568425", "text": "def min_step\n @min_step ||= ([step] + @filters.map { |f| f.step }).min\n end", "title": "" }, { "docid": "6e756de4caa875b9065003277fd67308", "score": "0.4852915", "text": "def results(baked, missing, low)\n return baked.min if missing.empty? && low.empty?\n\n return 0 if !missing.empty? || !low.empty?\nend", "title": "" }, { "docid": "bcb064104468a1bff6bd73f8f7725b2f", "score": "0.48518246", "text": "def minimal_params_from_array(array)\n array_to_params array, :array_size => (2..2),\n :arguments => [:name, :url]\n end", "title": "" }, { "docid": "6fe80f753c4384dc9b03424dff35b763", "score": "0.4851323", "text": "def best_fit; end", "title": "" }, { "docid": "46e6e1905690b3b0054b0fbf52b83c2a", "score": "0.48503676", "text": "def fake_parameters(m: nil)\n if (@☆ ||= {})[m].nil?\n # We need an instance first of all\n if m.nil? || !@★\n params = required_parameters\n guessed = [].∀(:size => params[:req].size, :samples => [RandomVoid.new])\n guessed.map! { |elem|\n begin\n elem if @★ ||= self.new(*guessed)\n rescue TypeError => e\n ::Kernel.const_get(e.type_data[:required]).new.∀\n end\n }\n @★ ||= self.new(*guessed)\n @☆[nil] = guessed.map(&:class)\n end\n \n # Let’s proceed with method\n unless m.nil?\n params = required_parameters :m => m\n \n guessed = [].∀(:size => params[:req].size, :samples => [RandomVoid.new])\n guessed.map! { |elem|\n begin\n elem if @☆=@★.send(m, *guessed)\n rescue TypeError => e\n ::Kernel.const_get(e.type_data[:required]).new.∀\n end\n }\n @☆[m] = guessed.map(&:class)\n end\n \n guessed\n else\n @☆[m].map(&:∀)\n end\n end", "title": "" }, { "docid": "50edc9e838caead434b5271d9aa5ad65", "score": "0.48499504", "text": "def init_params\n @start = params.fetch(:start, 0).to_i\n @items = [params.fetch(:items, 10).to_i, 100].min\n\n if @start < 0 || @items < 0\n return error(\n error_code: t('api.error_codes.invalid_data'),\n error_messages: [t('api.error_messages.negative_parameter',\n start: params.fetch(:start, 'not provided'),\n items: params.fetch(:items, 'not provided'))]\n )\n end\n @next_page_params = {\n start: @start.to_i + @items.to_i,\n items: params[:items].presence && @items.to_i\n }\n\n @order = params.fetch(:order, 'name ASC').to_s\n end", "title": "" }, { "docid": "da39e9dfc92deeb4d3d4629bb7441000", "score": "0.4847463", "text": "def validate_params\n param_msg = 'names must be an array of name_parameter'\n raise BadRequestError.new(param_msg) unless @names.instance_of? Array\n\n float_msg = 'threshold must be a float'\n thresh_msg = 'threshold must be in the range of 0 to 1'\n if @threshold\n raise BadRequestError.new(float_msg) unless @threshold.is_a?(Float)\n raise BadRequestError.new(thresh_msg) if @threshold.negative? || @threshold > 1\n end\n opt_msg = 'rosette_options can only be an instance of a Hash'\n if @rosette_options\n raise BadRequestError.new(opt_msg) unless @rosette_options.is_a? Hash\n end\n end", "title": "" }, { "docid": "0b47d1844b0dbec69cd5b175116c0996", "score": "0.48450303", "text": "def filled_params\n params.select{ |x| x.filled? }\n end", "title": "" } ]
28351b37974dd50e2d7d886c13e46826
Tells the IRC server who you are. The _nickname_ parameter is the name by which other clients display your messages; _realname_ is a more elaborate name containing the name of the person behind the user agent or (more commonly) a silly witticism. The _passwd_ is +nil+ by default and therefore will not be sent. The mode parameter is an integer bitmask where setting bit 2 requests user mode _w_ be set (the client receives wallops), and setting bit 3 requests mode sets user mode _i_ (marks client invisible).
[ { "docid": "a5e612ec64d178e4d9fa6c9da71ec00f", "score": "0.58266646", "text": "def register(nicknam, realname, passwd = nil, mode = 0)\n pass(passwd) if passwd\n nick(nicknam)\n user(nicknam, realname, mode)\n end", "title": "" } ]
[ { "docid": "3dfd09cd7efb7f091a876c4b072eab04", "score": "0.6654996", "text": "def user_mode(modes = nil, nicknam = nil)\n raise ArgumentError, 'bad user mode' unless modes =~ USER_MODE_REGEX\n raise ArgumentError, 'bad nickname' unless !nick || IRC.nickname?(nicknam)\n send_msg(\"MODE #{nicknam || @nickname} #{modes}\")\n end", "title": "" }, { "docid": "7f2f9a0799452d27f2e5046d2f6ff393", "score": "0.6653962", "text": "def user(username, realname, mode = 0)\n host = TCPSocket.gethostbyname(Socket.gethostname)[0]\n send_msg(\"USER #{username} #{mode} * :#{realname}\")\n end", "title": "" }, { "docid": "94b50a50400000bede429db2187d1014", "score": "0.62696856", "text": "def user(username, mode, realname)\n send_data(\"USER #{username} #{mode} * :#{realname}\")\n end", "title": "" }, { "docid": "5cbc4b48554418ae29c638c34ca62f85", "score": "0.61768717", "text": "def login(user, nick, real_name, flags=8)\n sendmsg \"USER #{user} #{flags} * :#{real_name}\"\n sendmsg \"NICK #{nick}\"\n end", "title": "" }, { "docid": "500ab0195b188077b06a92cda06e9288", "score": "0.6018274", "text": "def setnick(nickname)\n send_command(:setnick, @options[:nickname] = nickname.to_s)\n read_response # \"Nickname set to #{nickname}\"\n self\n end", "title": "" }, { "docid": "9df070c7235aff0ad9dd9ece76b50678", "score": "0.59060067", "text": "def nick(nicknam)\n raise 'invalid nick' unless IRC.nickname?(nicknam)\n @nickname = nicknam\n send_msg(\"NICK #{@nickname}\")\n end", "title": "" }, { "docid": "f43bba5989a9504a58e8317a4980a7bc", "score": "0.5817274", "text": "def getnick(nickname)\n send_command(:getnick, @options[:nickname] = nickname.to_s)\n read_response # \"Nickname set to #{nickname}\"\n self\n end", "title": "" }, { "docid": "0415a7b195a8a3500cb62da75a1dcac6", "score": "0.5811996", "text": "def who(mask, mode = 'o')\n send_data(\"WHO #{mask} #{mode}\")\n end", "title": "" }, { "docid": "e5d9efecb19a963ec2e893090fc5c8e7", "score": "0.5687966", "text": "def connect\n # We open a new socket connection to the server @server on port @port\n @socket = TCPSocket.open(@server, @port)\n\n # We send an IRC message that's sets the bot's nickname to @name\n irc_send(\"NICK #{@name}\")\n\n # We send an IRC message that's sets users usename and real name to @name\n irc_send(\"USER #{@name} 0 * :#{@name}\")\nend", "title": "" }, { "docid": "461f0ffce1684e4c3212e92084937886", "score": "0.5658072", "text": "def on_nick msg\n return unless msg.connection == self\n\n if msg.me?\n @nick = msg.text\n return\n end\n end", "title": "" }, { "docid": "73f66c08ae81a684bf725a1d92db20a9", "score": "0.5627624", "text": "def nick(nick)\n @nick = nick\n sendmsg(\"NICK #{nick}\")\n end", "title": "" }, { "docid": "ab91c50e33a304586e8541584fe8c92d", "score": "0.5606556", "text": "def nick(msg)\n if msg.user.last_nick == @settings['identity']['nick']\n bot.nick = @settings['identity']['nick']\n return\n end\n str = sprintf('*** %s is now known as %s',msg.user.last_nick,msg.user.nick)\n # gotta log to every channel this user is in\n (msg.user.channels & msg.bot.channels).each do |channel|\n log(msg,str,channel)\n end\n @beans[:nick]+=1\n end", "title": "" }, { "docid": "cb69f8adbacc91ed51130129eadc53a3", "score": "0.5598315", "text": "def nick(nickname)\n raw \"NICK #{nickname}\\r\\n\"\n end", "title": "" }, { "docid": "88fa770c903d378f2058d2615f14e07a", "score": "0.5564695", "text": "def change_nick msg\n return if msg.connection != @connection\n return unless has_key? msg.nick_canon\n\n $log.debug(\"Users.add_user\") { \"Renaming user #{msg.nick} on #{@connection.name}\" }\n\n changed_nick_canon = msg.connection.canonize msg.text\n\n # Apparently structs don't let you change values. So just make a\n # new user.\n changed_user = User.new @connection, changed_nick_canon,\n self[msg.nick_canon].user,\n self[msg.nick_canon].host,\n self[msg.nick_canon].level,\n self[msg.nick_canon].account\n\n delete_user msg.nick_canon\n\n self[changed_nick_canon] = changed_user\n end", "title": "" }, { "docid": "154f8817a99b7509d6f2ca814b4a3561", "score": "0.556387", "text": "def irc_mode_event(stem, sender, arguments) # :nodoc:\n names arguments[:channel] if arguments[:parameter] and server_type.privilege_mode?(arguments[:mode])\n end", "title": "" }, { "docid": "d517017083a7bcdd56485538c68028a8", "score": "0.5545791", "text": "def nickname\n @nick\n end", "title": "" }, { "docid": "23e73e84a6a51259497454e7d96251b9", "score": "0.55220574", "text": "def someone_did_gain_usermode(stem, nick, mode, argument, bestower)\n end", "title": "" }, { "docid": "9d07f57039da498dce36bd71e1e16baf", "score": "0.546795", "text": "def nickname=(value)\n @nickname = value\n end", "title": "" }, { "docid": "c5b4ea750dbf07df00db789838b11347", "score": "0.5451455", "text": "def nickname=(nick)\n @nickname ? find_and_update('//apps:nickname', name: [@nickname, nick]) : create('nickname', nick)\n\n @nickname = nick\n end", "title": "" }, { "docid": "2ee5e026680382cce6799b5526386293", "score": "0.5446604", "text": "def nick(nick)\n @socket << \"NICK #{nick}\"\n end", "title": "" }, { "docid": "f7e7a0c8ad0135b342726363174a12c3", "score": "0.5434693", "text": "def out_begin_connection(username, address, realname)\n pass(@password) if @password\n user(username, '0.0.0.0', address, realname)\n nick(@nicknames[0])\n end", "title": "" }, { "docid": "c13a1a5294c82f4e03c3fb9d7bedb657", "score": "0.5384232", "text": "def set_nickname\n @nickname = Nickname.find(params[:id])\n end", "title": "" }, { "docid": "4e12ad1c4e0ebcf4da8cf01c461df19e", "score": "0.5373999", "text": "def change_nick(nick)\n join(nick)\n end", "title": "" }, { "docid": "3879b460043aaf41336f743309b60020", "score": "0.5371028", "text": "def r_nick(fullactor, actor, nickname)\n report \"#{actor} changed nick to #{nickname}\" unless nickname == @me\n end", "title": "" }, { "docid": "bda0f21b6e1f39ebe5f37316cc80dabe", "score": "0.5370973", "text": "def nickname\n user_info['nickname']\n end", "title": "" }, { "docid": "14d5b555cb5c97389dd6d4ce9213b6c1", "score": "0.5335989", "text": "def local_nick(body)\n name1 = _pop_token(body)\n name2 = _pop_token(body)\n raise \"Usage: /nick <old_name> <new_name>\" if name1.to_s.empty?\n if name2.to_s.empty?\n name2 = name1\n name1 = @var[:our_name]\n end\n raise \"Name '#{name2}' is already in use\" if @var[:user_keys][name2]\n\n # Perform the renaming\n kh = @connection.comm.sender_keyhash(name1)\n key = @connection.comm.rsa_keys[name1]\n raise \"Invalid user name: '#{name1}'\" unless kh and key\n @connection.comm.rsa_keys[name2] = key\n @connection.comm.rsa_keys.delete(name1)\n @connection.comm.names[kh] = name2\n @var[:user_keys][name2] = key\n @var[:user_keys].delete name1\n @var[:granted].collect! { |x| x = name2 if x == name1 ; x }\n @var[:granted_by].collect! { |x| x = name2 if x == name1 ; x }\n @var[:revoked].collect! { |x| x = name2 if x == name1 ; x }\n \n # And lastly, if this is us, update our special name attribute\n @var[:our_name] = name2 if @var[:our_name] == name1\n _notice(\"#{name1} is now known as #{name2}\")\n _save_env\nend", "title": "" }, { "docid": "3473db40edddd5d971c17861bde073a8", "score": "0.5311805", "text": "def grant_usermode(nick, property)\n propcode = server_type.usermode.key(property).chr if server_type.usermode.value? property\n propcode ||= property\n mode nick, \"+#{property}\"\n end", "title": "" }, { "docid": "95132d66be7f1678e4e69e9649ed62dd", "score": "0.5286497", "text": "def update_nick!\n discord_user.on(game.text_channel.server).nick = \"(#{score} AP) #{discord_nick}\"\n rescue\n # Fail silently if we can't change nicks\n end", "title": "" }, { "docid": "db52375d4a6e064265338d087ccd70f3", "score": "0.5245568", "text": "def user(username, realname, invisible = true)\n raw \"USER #{username} #{invisible ? 8 : 0} * :#{realname}\\r\\n\"\n end", "title": "" }, { "docid": "f5820d98997d54e7d279fda6a12b967e", "score": "0.51893246", "text": "def change_nick(new_nick)\n nick new_nick\n end", "title": "" }, { "docid": "d6652dc4e163744e8f49996efa4dcbda", "score": "0.5178037", "text": "def start\n @quit = nil\n @socket = self.connect()\n self.on_message(/^PING/) { |event|\n self.send_raw_line(\"PING \"+event[:matchdata].post_match)\n }\n self.on_server_message(353) { |event|\n }\n self.on_server_message(376) do |event|\n if @password and !@authenticated then\n self.message 'NickServ', \"IDENTIFY #{@password}\"\n @authenticated = true\n end\n @channels.each { |channel|\n if channel.kind_of? Hash then\n self.send_raw_line(\"JOIN \"+channel.keys.first+\" \"+channel.values.first)\n else\n self.send_raw_line(\"JOIN \"+channel)\n end\n }\n end\n \n self.send_raw_line(\"USER \"+@nickname+\" \"+@nickname+\" \"+@nickname+\" \"+@nickname)\n self.send_raw_line(\"NICK \"+@nickname)\n begin\n while line = @socket.gets\n handle_raw_line(line) \n end\n rescue IOError => ioe\n raise ioe unless @quit\n end\n end", "title": "" }, { "docid": "19098691435833e28f67670fd1991f05", "score": "0.5170158", "text": "def chk_nickname_available\n @status, @msg, @data = UserValidator.chk_nickname(params)\n end", "title": "" }, { "docid": "092b409d16cabdcf7338be8e02413b85", "score": "0.51517695", "text": "def on_nick(connection, before, after)\n end", "title": "" }, { "docid": "b05fecd9fb7ad31a0226b695ac8192e7", "score": "0.5133536", "text": "def toggle_nick(bot, channel)\n @use_nicks[channel] = (not @use_nicks[channel] == true)\n \n if use_nicks?(channel)\n bot.say(\"Nicks will be sent with messages.\")\n else\n bot.say(\"Nicks will not be sent (omegle users will just see anonymous text)\")\n end\n end", "title": "" }, { "docid": "8ca03a19c3e3d2952b7bda04778e5c36", "score": "0.5124125", "text": "def nick_canon\n @nick_canon ||= @connection.canonize @nick\n end", "title": "" }, { "docid": "11851335e52acc4af8ec2e22ae345e51", "score": "0.5107971", "text": "def irc_nick_event(stem, sender, arguments) # :nodoc:\n @nick = arguments[:nick] if sender[:nick] == @nick\n @chan_mutex.synchronize do\n @channel_members.each { |chan, members| members[arguments[:nick]] = members.delete(sender[:nick]) }\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end", "title": "" }, { "docid": "088a117e6bd5be68458810cff5e5986a", "score": "0.5094065", "text": "def me?\n nick_canon == @connection.canonize(@connection.nick)\n end", "title": "" }, { "docid": "b9ebd6ed134771eb6c5bad56da104e41", "score": "0.50764173", "text": "def nick\r\n return for_context(nil, false) { |c| c.nick }\r\n end", "title": "" }, { "docid": "d20a7327676e14f17fd7bd7afc4f6071", "score": "0.505594", "text": "def modify_current_user_nick(guild_id, nick:)\n response = request(\n :guilds_gid_members_me_nick, guild_id,\n :patch,\n \"guilds/#{guild_id}/members/@me/nick\",\n nick: nick,\n )\n response.body\n end", "title": "" }, { "docid": "6bfac2f9d5935c6a7ab46d7eb0d97a57", "score": "0.50502366", "text": "def nick\n @bot.nick\n end", "title": "" }, { "docid": "fa87bd60d4e6333186f16296fd310846", "score": "0.50332093", "text": "def do_user\n $client.puts \"User Name:\"\n $name = $client.recvfrom(20)[0]\n if $name[0..6] == 'TeaBoss'\n \t$userFlag = ture\n \t$client.puts \"331 User Name is OK, Need Password:\"\n \tdo_pass\n elsif $name[0..8] == 'anonymous'\n \t$userFlag = true\n \t$client.puts \"230 Welcome Anonymous!\"\n else\n \t$client.puts \"430 User Name Error\"\n end\nend", "title": "" }, { "docid": "3984e32d64b00d268105f6909e9fd893", "score": "0.50255597", "text": "def change_nickname(token, server_id, user_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/#{user_id}\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "title": "" }, { "docid": "363b2e8a011614b14b08d2c010185aea", "score": "0.50254804", "text": "def on_nick_in_use msg\n return if @registered or msg.connection != self\n\n if @nick == Bot::Conf[:core][:nick]\n\n if Bot::Conf[:core].key? :altnick\n @nick =Bot::Conf[:core][:altnick]\n else\n @nick = 'TerminusBot'\n end\n\n raw \"NICK #{@nick}\"\n return\n end\n\n @nick << \"_\"\n\n raw \"NICK #{@nick}\"\n end", "title": "" }, { "docid": "e54111320db9ccca6e5bf07f4bbd7eef", "score": "0.50212616", "text": "def nickname\n @nickname\n end", "title": "" }, { "docid": "82711e9fca7f6b67b6a9519452fa0563", "score": "0.50188303", "text": "def setNick(server,nick)\n if(@connectors.has_key?(server))\n @connectors[server].nick=nick\n end\n end", "title": "" }, { "docid": "7f466a4a769c93472bb848c50091f188", "score": "0.49969882", "text": "def renickify \n @bot.msg(\"nickserv\", \"ghost #{bot.nick} pearljam\")\n @bot.msg(\"nickserv\", \"identify pearljam\")\n @bot.nick = 'infobot-clone'\n return \"Renickifying!\"\n end", "title": "" }, { "docid": "c49da885498c64e37c680418c74c4335", "score": "0.49715945", "text": "def isNickAuthed(usr)\n msg(\"NickServ\", \"ACC #{usr}\")\n data = nickservData(@IRCsocket.readline.split(\" \"))\n if(data[\"rusr\"] == \"NickServ\" && data[\"to\"] == @name && data[\"usr\"] == usr && data[\"status\"] == \"3\")\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "6fff75601398c9b32fa3604ca113d70d", "score": "0.49713466", "text": "def connect\n say \"NICK #{@botname}\"\n say \"USER #{@botname} 0 * #{@botname}\"\n say \"JOIN #{@channel}\"\n end", "title": "" }, { "docid": "41561547892a727bc204f6784bf3a7bc", "score": "0.49633765", "text": "def send_nick(n=@nick)\n @nick = n\n @connection.send_data(make_packet(\"nick\", {\"name\" => n}))\n end", "title": "" }, { "docid": "bf168e1deede667d3878a8dc7edc37f9", "score": "0.49436814", "text": "def change_nick(new_nick)\n return false if not User.valid_nick?(new_nick)\n @nick = new_nick.to_s\n true\n end", "title": "" }, { "docid": "2a49cdb48b6cd41000d695f16d1d0768", "score": "0.49302477", "text": "def nicks\n match(/Nicks\\s+:\\s+([^\\s]+(?:\\s[^\\s]+)*)$/).split.map{|nick| Atheme::User.new(@session, nick)} rescue []\n end", "title": "" }, { "docid": "d85351c8c1fe6ffd637dff293ed99009", "score": "0.4921683", "text": "def change_own_nickname(token, server_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/@me/nick\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "title": "" }, { "docid": "5326a0d16b1bb61010d57c5c94f47cd6", "score": "0.49135023", "text": "def connect_login(global = true, verbose = true)\n\t\tircsock = connect(global, verbose)\n\n\t\tres = send_nick(user, ircsock)\n\t\t\n raw_send(\"USER blah blah blah :blah blah\")\n send_user(\"\n sleep 2\n raw_send(\"JOIN #{datastore['CHANNEL']}\")\n\t\t\n\t\treturn true\n\tend\n\n\t#\n\t# This method logs in as the supplied nick by transmitting the IRC\n\t# 'NICK <user>' command.\n\t#\n\tdef send_nick(user, nsock = self.sock)\n\t\traw_send_recv(\"NICK #{user}\", nsock)\n\tend\n\n\t#\n\t# This method sends one command with zero or more parameters\n\t#\n\tdef send_cmd(args, recv = true, nsock = self.sock)\n\t\tcmd = args.join(\" \") + \"\\n\"\n\t\tif (recv)\n\t\t\treturn raw_send_recv(cmd, nsock)\n\t\telse\n\t\t\treturn raw_send(cmd, nsock)\n\t\tend\n\tend", "title": "" }, { "docid": "3b29d711f71a4d23414f8d6c4a39c0a0", "score": "0.49057987", "text": "def update_nick(new_nick)\n @last_nick, @name = @name, new_nick\n @last_id, @id = @id, sanitize(new_nick)\n @bot.user_list.update_nick(self)\n end", "title": "" }, { "docid": "933dc2552ac452d8171ade8ea389b8cf", "score": "0.4902285", "text": "def update!(**args)\n @nickname_option = args[:nickname_option] if args.key?(:nickname_option)\n end", "title": "" }, { "docid": "016f80e3d10873ce08cdd14d854ca87c", "score": "0.48973384", "text": "def start\n @s = TCPSocket.open(@server, @port)\n @s.puts \"USER internbot 0 * InternBot\"\n @s.puts \"NICK #{@nick}\"\n @s.puts \"JOIN #{@channel}\"\n\n # main receive loop\n until @s.eof? do\n msg = @s.gets\n msg_pieces = msg.split(':')\n debug msg\n\n # stay-alive\n if msg.start_with?(\"PING\")\n pongback = \"PONG \" + msg.split(\":\")[1]\n @s.puts pongback\n debug pongback\n # initial userlist\n elsif msg.index(\"#{@nick} = #{@channel} :\")\n userlist = msg_pieces[2].split(' ')\n debug 'userlist: ' + userlist.join(' ')\n userlist.each do |user|\n if user.start_with? '@' # they're opped\n @ops << user[1..-1]\n elsif user.start_with? '+' #they're voiced\n @voices << user[1..-1]\n else # they suck\n @peons << user\n end\n end\n debug 'ops: ' + @ops.join(' ')\n debug 'voices: ' + @voices.join(' ')\n debug 'peons: ' + @peons.join(' ')\n # auto-op the oplisted members\n elsif msg.index(\"JOIN :#{@channel}\")\n user_info = msg_pieces[1].split('@')[0].split('!')\n @peons << user_info[0] unless user_info[0] == @nick\n if InternDB.is_op?(user_info[0], user_info[1])\n @s.puts \"MODE #{@channel} +o #{user_info[0]}\"\n end\n elsif msg.index(\"LEAVE :#{@channel}\")\n user_info = msg_pieces[1].split('@')[0].split('!')\n @ops.delete(user_info[0])\n @voices.delete(user_info[0])\n @peons.delete(user_info[0])\n # command parsing\n elsif msg.index(\"MODE #{@channel} \")\n parts = msg.split(' ')\n if parts[3] == '+o'\n @peons.delete(parts[4])\n @voices.delete(parts[4])\n @ops << parts[4]\n elsif parts[3] == '-o'\n @ops.delete(parts[4])\n @peons << parts[4]\n elsif parts[3] == '+v'\n @peons.delete(parts[4])\n @voices << parts[4]\n elsif\n parts[3] == '-v'\n @voices.delete(parts[4])\n @peons << parts[4]\n end\n debug 'ops: ' + @ops.join(' ')\n debug 'voices: ' + @voices.join(' ')\n debug 'peons: ' + @peons.join(' ')\n elsif msg.index(\"PRIVMSG #{@channel} :\")\n user_info = msg_pieces[1].split('@')[0]\n user_info = user_info.split('!')\n @command_callback.call(false, user_info[0], user_info[1], msg_pieces[2..-1].join(\":\"))\n elsif msg.index(\"PRIVMSG #{@nick} :\")\n user_info = msg_pieces[1].split('@')[0]\n user_info = user_info.split('!')\n @command_callback.call(true, user_info[0], user_info[1], msg_pieces[2..-1].join(\":\"))\n end\n end\n end", "title": "" }, { "docid": "32fa7d423c731eedb14a9ec9f317deab", "score": "0.48937288", "text": "def send_whois(nick)\n send_raw(WHOIS, nick)\n end", "title": "" }, { "docid": "e55f8205f9058cdfd879f96e847a8a45", "score": "0.48575354", "text": "def reveal_author(nick)\n case nick\n when 'lddev' then 'MM'\n when '1bardesign' then 'Geti'\n when 'flieslikeabrick' then 'FliesLikeABrick'\n else I18n.news_fetcher.someone\n end\n end", "title": "" }, { "docid": "c9b78c236dfc8e377d53563fe33fe95f", "score": "0.48495626", "text": "def register_nickname(nick)\n #TODO: fiber blocks on getting the registration form\n # user fills-in the form and submit\n # rooms returns result\n raise NotImplementedError\n end", "title": "" }, { "docid": "5c4e391f289dfbfb1db4bcd999adea9e", "score": "0.4842908", "text": "def parse_messages(msg)\n case @mode\n when :initialize\n # ignore everything until negotiation done\n when :name\n publish(\"[clearline]\") if vtsupport?\n @login_name = msg.proper_name\n if options['guest_accounts'] && @login_name =~ /Guest/i\n self.name = \"Guest#{id}\"\n @character = new_char\n put_object(self)\n world.all_accounts << id\n # make the account non-swappable so we dont lose connection\n Engine.instance.db.makenoswap(id)\n @conn.set(:color, color)\n welcome\n @mode = :playing\n elsif @login_name.empty?\n sendmsg(append_echo(\"login> \"))\n @mode = :name\n else\n acctid = world.all_accounts.find {|a|\n @login_name == get_object(a).name\n }\n @account = get_object(acctid)\n sendmsg(append_echo(\"password> \"))\n @conn.set(:hide, true)\n @mode = :password\n end\n when :password\n @login_passwd = msg\n @conn.set(:hide, false)\n if @account.nil? # new account\n sendmsg(append_echo(\"Create new user?\\n'Y/y' to create, Hit enter to retry login> \"))\n @mode = :newacct\n else\n if @login_passwd.is_passwd?(@account.passwd) # good login\n # deregister all observers here and on connection\n unsubscribe_all\n @conn.unsubscribe_all\n # reregister all observers to @account\n @conn.subscribe(@account.id)\n # make the account non-swappable so we dont lose connection\n Engine.instance.db.makenoswap(@account.id)\n @conn.set(:color, @account.color)\n switch_acct(@account)\n # Check if this account already logged in\n reconnect = false\n if @account.subscriber_count > 0\n @account.publish(:reconnecting)\n @account.unsubscribe_all\n reconnect = true\n end\n @account.subscribe(@conn)\n if options['account_system']\n @account.sendmsg(append_echo(login_menu))\n @account.mode = :menu\n else\n @character = get_object(@account.characters.first)\n # make the character non-swappable so we dont lose references\n Engine.instance.db.makenoswap(@character.id)\n world.connected_characters << @character.id\n @character.account = @account\n @account.character = @character\n welcome(reconnect)\n @account.mode = :playing\n end\n else # bad login\n @checked -= 1\n sendmsg(append_echo(\"Sorry wrong password.\"))\n if @checked < 1\n disconnect\n else\n @mode = :name\n sendmsg(append_echo(\"login> \"))\n end\n end\n end\n when :newacct\n if msg =~ /^y/i\n self.name = @login_name\n self.passwd = @login_passwd.encrypt\n put_object(self)\n # make the account non-swappable so we dont lose connection\n Engine.instance.db.makenoswap(id)\n world.all_accounts << id\n @conn.set(:color, color)\n if options['account_system']\n sendmsg(append_echo(login_menu))\n @mode = :menu\n else\n @character = new_char\n welcome\n @mode = :playing\n end\n else\n @mode = :name\n sendmsg(append_echo(\"login> \"))\n end\n when :menu, :menucr, :menupl\n parse_menu(msg)\n when :playing\n @character.parse(msg)\n else\n log.error \"Account#parse_messages unknown :mode - #{@mode.inspect}\"\n end\n end", "title": "" }, { "docid": "9d3cc51b9322ad1e1159294738613449", "score": "0.48340034", "text": "def login(name, channel, password)\n @name = name\n @ch = channel\n @ch_pw = password\n @IRCsocket.write(\"PASS *\\n\")\n @IRCsocket.write(\"NICK #{@name}\\n\")\n @IRCsocket.write(\"USER #{@name} 8 * :#{@name}\\n\")\n @IRCsocket.write(\"JOIN #{@ch} #{@ch_pw}\\n\")\n end", "title": "" }, { "docid": "34c657614ab38a7614917ba26f843b9c", "score": "0.48328635", "text": "def changenick(m, n)\n @lastchanged = m.user.nick\n bot.nick = n\n end", "title": "" }, { "docid": "236fe4ef169f96e16165eb90288ec5ea", "score": "0.48321873", "text": "def nick_part(nick, reason=nil)\n return if not @names.include?(nick)\n\n @names.delete(nick)\n reason = \" (#{reason})\" if reason\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} just left the IRC channel#{reason}\")\n end", "title": "" }, { "docid": "f9ab0f46987e3eab6ac25d6a812a052b", "score": "0.48084715", "text": "def nick\n @name\n end", "title": "" }, { "docid": "66620b920fc32b4e381f7052e33b5dad", "score": "0.4806463", "text": "def nickname?\r\n return @user.nickname != nil && @user.nickname != \"\"\r\n end", "title": "" }, { "docid": "093eef9d2e15fa09f46364d1d8023d31", "score": "0.48048186", "text": "def eval_first_msg(umsg,sock)\n user_info = umsg.split(\" \")\n if umsg =~ /user_info:/\n @user_info.push({:nickname => user_info[1],:role => \"client\", :channels => [], :mode => \"pull\", :time => Time.now})\n sock.write(\"Welcome #{user_info[1]}\\n\")\n @@connection.insert_user user_info[1]\n @user_info.last[:channels] = @@connection.fill_channels_user(user_info[1])\n elsif (umsg =~ /source_info:/) \n @user_info.push({:nickname => user_info[1],:role => \"editor\",:status => \"logging\"}) \n sock.write(\"password:\\n\")\n elsif (umsg =~ /admin_info:/ )\n @user_info.push({:nickname => user_info[1],:role => \"admin\", :status => \"logging\"}) \n sock.write(\"password:\\n\")\n end \n end", "title": "" }, { "docid": "485a51276cb3f0dfdf02ca032b2869e5", "score": "0.479667", "text": "def nickname=(name)\n write_attribute('preferred_name', name)\n end", "title": "" }, { "docid": "b471cfe6dd23ffafc31f9c250ed99a32", "score": "0.47961992", "text": "def on_open\n\n # Must pass a nickname\n if params[:name].nil?\n response << {event: :error, from: :system, at: Time.now, message: \"Error: cannot connect without a nickname!\"}.to_json\n response.close\n return false\n end\n\n # Can't use admin nicknames\n message = {from: '', at: Time.now}\n name = params[:name]\n if (name.downcase.match(/admin|admn|system|sys|administrator/i))\n message[:event] = :error\n message[:message] = \"The nickname '#{name}' is already taken.\"\n response << message.to_json\n params[:name] = false\n response.close\n return\n end\n\n # Welcome user to chat\n message = {from: '', at: Time.now}\n message[:event] = :chat\n response << message.to_json\n message[:message] = \"#{params[:name]} joined the chatroom.\"\n broadcast :_send_message, message.to_json\n # Explain who is here or if your the first one here\n #message[:message] = list.empty? ? \"You're the first one here.\" : \"#{list[0..-2].join(', ')} #{list[1] ? 'and' : ''} #{list.last} #{list[1] ? 'are' : 'is'} already in the chatroom\"\n end", "title": "" }, { "docid": "679ca3a2a158335881d62ff80023f2a6", "score": "0.4782552", "text": "def change_info(new_name)\n self.nickname = new_name \n end", "title": "" }, { "docid": "8bd82bd487b01ab423c4212340609d3d", "score": "0.47507247", "text": "def run\n begin\n @socket = TCPSocket.open(server, port)\n rescue => e\n puts \"An error occurred: #{e.message}\"\n exit 1\n end\n\n send 'USER ruben 0 * :Ruben'\n send \"NICK #{@nick}\"\n send \"JOIN ##{@channel}\"\n\n listen until @socket.eof?\n end", "title": "" }, { "docid": "6454c41cd9d5b023364d84a9b6c238c4", "score": "0.47416174", "text": "def nick_change(nick, new_nick)\n @names.delete(nick) if @names.include?(nick)\n @names << new_nick \n\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} is now known as #{new_nick}\")\n end", "title": "" }, { "docid": "0c35ac01314c110546275117da30b3a0", "score": "0.47386003", "text": "def nickname\n return @nickname\n end", "title": "" }, { "docid": "baa68b18f12a6ef662d1f26e59124474", "score": "0.47355512", "text": "def update_nickname(member)\n nickname = get_nickname(member)\n if member.display_name != nickname\n member.set_nick nickname\n end\n end", "title": "" }, { "docid": "38f13abec529ef9d9437abdeae706e0d", "score": "0.47320795", "text": "def nickname\n data = get 'name', resource: 'leaderboard'\n data.name\n end", "title": "" }, { "docid": "cda32f1dd8e036b58594de71d37ed25a", "score": "0.4730291", "text": "def connected\n\t\tdo_send(setting(:username), :priority => 0)\n\tend", "title": "" }, { "docid": "1ae96ab5b3626bbef064e294d0230a3f", "score": "0.47282815", "text": "def get_username mode=\"new\"\n\t\tputs \"Please enter your username:\"\n\t\tinput = gets.chomp.downcase\n\t\tuntil !input.empty? && input[0,1]!='.' && input != \"menu\"\n\t\t\tputs \"\",\"The username can't be empty, menu, or start with '.'. \",\"Please enter another username:\"\n\t\t\tinput = gets.chomp\n\t\tend\n\t\t@username = input\n\tend", "title": "" }, { "docid": "d87dfd4c6c7dfef2bb9ac50d06dd2b15", "score": "0.4721586", "text": "def introduce\n write_(\"PASS #{@conf['pass']}\") if @conf['pass'] and !@use_sasl\n write_(\"CAP REQ :sasl\") if @use_sasl\n write_(\"NICK #{@conf['nick']}\")\n write_(\"USER #{@conf['user']} 0 * :#{@conf['rnam']}\")\n end", "title": "" }, { "docid": "f346b22a77c7108f39c438dbe887ca98", "score": "0.47130367", "text": "def nickname\n (f, l) = full_name.split(\" \", 2)\n \"#{f}#{l.split(/[\\s']/).collect(&:first).join}\"\n end", "title": "" }, { "docid": "d4030f0ad234a492e9f471d21a9c2be7", "score": "0.47115716", "text": "def r_nick(event)\n report \"#{event.nick} changed nick to #{event.message}\" unless event.nick == @yail.me\n end", "title": "" }, { "docid": "7ab85f780eddefbf3d61280ce692f868", "score": "0.46978417", "text": "def initialize(nickname)\n @nick = nickname\n end", "title": "" }, { "docid": "db210534714af8b48b15a3d5556d0dae", "score": "0.4674045", "text": "def cwhois(m, nick)\n nick = User(nick)\n if is_supadmin?(m.user) || is_admin?(m.user) || is_chanadmin?(m.channel, m.user) || is_mod?(m.user)\n if userroles(m.channel,nick).empty?\n m.reply \"That's #{nick},\" + (!User(nick).authname.nil? ? \" authenticated as #{User(nick).authname},\" : \" unauthenticated,\") + \" with no roles.\"\n else\n m.reply \"That's #{nick}, \" + (!User(nick).authname.nil? ? \" authenticated as #{User(nick).authname},\" : \" unauthenticated,\") + \" with the following roles #{userroles(m.channel,nick)}.\", true\n end\n else\n m.reply NOTADMIN, true\n end\n end", "title": "" }, { "docid": "5ebdf1f957924ec7919483a3e469042c", "score": "0.4671906", "text": "def event_incoming_server_control(client, cmd, *args)\n whitelist = ['nick', 'logon', 'ping']\n cmd.replace \"(no username)\" unless client.name or whitelist.include? cmd\nend", "title": "" }, { "docid": "4320d2c0068090c77c9c786394d9cb2e", "score": "0.46665508", "text": "def on_registered msg\n return unless msg.connection == self\n\n @isupport, @registered = {}, true\n\n raw \"MODE #{@nick} +#{@config[:umodes]}\" if @config.key? :umodes\n end", "title": "" }, { "docid": "dc63f1517fddea5a322db0816ab560ff", "score": "0.46635437", "text": "def get_mode\n prompt = ''\n @transport.cmd('') { |c| prompt += c }\n match = /(?<hostname>[^\\(-\\)]+)(\\((?<text>[\\w\\-]+)\\))?(?<char>#|>)/.match(prompt)\n\n mode = nil\n\n if match && match['char']\n\n mode = case match['char']\n when '>' then :user\n when '#' then :privileged\n end\n\n end\n\n if match && match['text']\n mode = match['text'].to_sym\n end\n\n mode\n end", "title": "" }, { "docid": "ca0af9e02c40580b47efab579b83332b", "score": "0.4663128", "text": "def nickname\r\n return @user.nickname\r\n end", "title": "" }, { "docid": "9df6f2e01f465f020a68b6af10298cfa", "score": "0.466056", "text": "def setme\n # retrieve the user name\n id = %x{id}.chomp\n if id =~ /uid=\\d+\\(([^\\)]+)\\)/\n @me = $1\n else\n puts id\n end\n raise \"Could not retrieve user name; 'id' did not work\" unless defined?(@me)\n end", "title": "" }, { "docid": "7948677ce60362639dd8ebbaa1191ffa", "score": "0.4650835", "text": "def channel_mode(channel, modes)\n raise ArgumentError, 'bad channel name' unless IRC.channel_name?(channel)\n raise ArgumentError, 'bad channel mode' unless modes =~ CHANNEL_MODE_REGEX\n send_msg(\"MODE #{channel} #{modes}\")\n end", "title": "" }, { "docid": "9e250cde73a5225d1330394a70be3e06", "score": "0.46490732", "text": "def initial_message\n Kh.call(:server_connect)\n post @socket, server_name, RPL_WELCOME, @nick, \"Welcome to the Internet Relay Network #{@prefix}\"\n post @socket, server_name, RPL_YOURHOST, @nick, \"Your host is #{server_name}, running version #{server_version}\"\n post @socket, server_name, RPL_CREATED, @nick, \"This server was created #{Time.now}\"\n post @socket, server_name, RPL_MYINFO, @nick, \"#{server_name} #{server_version} #{available_user_modes} #{available_channel_modes}\"\n end", "title": "" }, { "docid": "28e024ef69c2e9e1cf933e39f0ac219f", "score": "0.46467495", "text": "def connect \n log \"Connecting\"\n @socket = TCPSocket.new(config[:server], 6667)\n write \"USER #{config[:nick]} #{config[:nick]} #{config[:nick]} :#{config[:nick]}\"\n write \"NICK #{config[:nick]}\"\n write \"JOIN ##{config[:channel]}\"\n end", "title": "" }, { "docid": "fa8e2dab1f57d01af232961def14f58e", "score": "0.46418163", "text": "def out_begin_connection(event)\n pass(@password) if @password\n user(event.username, '0.0.0.0', event.address, event.realname)\n nick(@nicknames[0])\n end", "title": "" }, { "docid": "86086f412c0c6f57ab915541b243db41", "score": "0.46399727", "text": "def get_username(prompt = 'Enter Nexpose username: ')\r\n ask(prompt) { |query| query.echo = true }\r\nend", "title": "" }, { "docid": "3fd52d586f83c8fda402d9f067bd8134", "score": "0.46341798", "text": "def cwhoami(m)\n if userroles(m.channel,m.user).empty?\n m.reply \"You're #{m.user.nick},\" + (!m.user.authname.nil? ? \" authenticated as #{User(m.user).authname},\" : \" unauthenticated,\") + \" with no roles.\"\n else\n m.reply \"You're #{m.user.nick},\" + (!m.user.authname.nil? ? \" authenticated as #{User(m.user).authname},\" : \" unauthenticated,\") + \" with the following roles #{userroles(m.channel,m.user)}.\", true\n end\n end", "title": "" }, { "docid": "c20720306f5886f2354e0ba3bb6aab6f", "score": "0.46323478", "text": "def on_isupport msg\n return if msg.connection != self\n\n # Limit iteration to everything between the nick and \":are supported\n # by this server\"\n msg.raw_arr[3...-5].each do |arg|\n key, value = arg.split('=', 2)\n\n @isupport[key.upcase] = value\n end\n\n end", "title": "" }, { "docid": "b0828831f25ad3fa75dfe8544714e709", "score": "0.46273786", "text": "def connect_with nick\n debug 'connect', \"Requesting connection with #{nick}\"\n @connection_timeouts[nick] = EventMachine::Timer.new(10) do\n @connection_timeouts.delete(nick)\n channel << [:connection_timeout, {:nick => nick}]\n end\n\n if config.passive\n hub.send_message 'RevConnectToMe', \"#{self.config.nick} #{nick}\"\n else\n hub.send_message 'ConnectToMe',\n \"#{nick} #{config.address}:#{config.active_port}\"\n end\n end", "title": "" }, { "docid": "26226becc65c5e3e8bd05bd778e949ee", "score": "0.46270174", "text": "def nick_name=(nick_name)\n\n if !nick_name.nil? && nick_name.to_s.length > 30\n fail ArgumentError, \"invalid value for 'nick_name', the character length must be smaller than or equal to 30.\"\n end\n\n @nick_name = nick_name\n end", "title": "" }, { "docid": "270e8019fab029bb0f2d79bf4c979710", "score": "0.46237248", "text": "def post_init\n send_message :PASS, @settings[:server_password] if @settings[:server_password]\n send_message :USER, @settings[:ident], \"0\", \"0\", @settings[:realname]\n send_message :NICK, @settings[:nick]\n end", "title": "" }, { "docid": "d16dc5b93b13375985335d7a97bbfff6", "score": "0.461117", "text": "def handlelogin\n\t\tif $chatserver.reservename @edit.getText\n\t\t\t\n\t\t\t#the name was not yet taken, so we notify the\n\t\t\t#ChatApp object of the name\n\t\t\[email protected]= @edit.getText\t\n\t\t\t\n\t\t\t#accept makes the dialog quit\n\t\t\taccept()\n\t\t\t\n\t\t\t#to make things simpler for the user, we set the\n\t\t\t#focus on the chat input WLineEdit\n\t\t\[email protected]\n\t\telse\n\t\t\t\n\t\t\t#well, the requested name was already taken\n\t\t\t#so suggest a new one, and set it in the WLineEdit, too\n\t\t\tsuggested=$chatserver.suggestname @edit.getText\n\t\t\[email protected] \"sorry, that name is taken, but \" +suggested+ \" is free.\"\n\t\t\[email protected] suggested\n\t\t\t\n\t\tend\n\n\t\n\t\n\tend", "title": "" }, { "docid": "0bfcad36ce1074c3df2087b11679b13a", "score": "0.46095648", "text": "def update\n nick = params[:account_nick] ? params[:account_nick].strip : \"\"\n \n @account.nick = nick\n if @account.save\n update_session_nick(@account.get_nick)\n flash.now[:message] = \"你的昵称已成功修改\"\n else\n flash.now[:error_msg] = \"修改昵称失败, 再试一次吧\"\n end\n\n render :action => \"edit\"\n end", "title": "" }, { "docid": "a7564eb31d08078c2d9faaa97be20c64", "score": "0.4606017", "text": "def register\n raw \"PASS #{@config[:password]}\" if @config.key? :password\n raw \"CAP LS\" if defined? MODULE_LOADED_CLIENT_CAPABILITIES\n\n raw \"NICK #{@nick}\"\n raw \"USER #{@user} 0 0 :#{@realname}\"\n end", "title": "" }, { "docid": "37e081b23d39422fb75daad3a27a122b", "score": "0.46037778", "text": "def on_notice\n if (sender.name.downcase == 'nickserv')\n matches = /^STATUS ([^ ]+) ([0-9])$/i.match(argline)\n return if matches.nil?\n username = matches[1]\n status = matches[2]\n if server.nickname.name.downcase == matches[1]\n server.instance_variable_set('@has_nickserv', true)\n server.instance_variable_set('@has_nickserv_status', true)\n else\n autologin(username)\n end\n end\n end", "title": "" } ]
5c6278a1bb20c28bf48cf5f287c852d4
Get the post from params
[ { "docid": "134bb58574f5678044a5f08be1382eaf", "score": "0.57048315", "text": "def get_post\n @post = Post.find(params[:id])\n end", "title": "" } ]
[ { "docid": "9734c6a114a58454829035809227a33e", "score": "0.78994185", "text": "def post_params\n params[:post]\n end", "title": "" }, { "docid": "1c8dff9afbd0d1d7e58e1ac79c820ef7", "score": "0.76300097", "text": "def post_params\n params[:post]\n end", "title": "" }, { "docid": "6bf8378e2d39e6a49460862a79ab8e6d", "score": "0.7569146", "text": "def post_params\n postParams = params\n end", "title": "" }, { "docid": "98ae8e1fcb634dfffaeacab484ac4dd6", "score": "0.7395517", "text": "def post_params\n\t\tparams[:post]\n\tend", "title": "" }, { "docid": "bf008067d0fe2d804d91a21437140785", "score": "0.7303273", "text": "def post_params\n params.fetch(:post, {})\n end", "title": "" }, { "docid": "bf008067d0fe2d804d91a21437140785", "score": "0.7303273", "text": "def post_params\n params.fetch(:post, {})\n end", "title": "" }, { "docid": "bf008067d0fe2d804d91a21437140785", "score": "0.7303273", "text": "def post_params\n params.fetch(:post, {})\n end", "title": "" }, { "docid": "bf008067d0fe2d804d91a21437140785", "score": "0.7303273", "text": "def post_params\n params.fetch(:post, {})\n end", "title": "" }, { "docid": "9bdb2c88126ccebf479384583b294f8e", "score": "0.6855459", "text": "def params\n\t if method == :post\n#\t\t @post_params.instance_variable_get(\"@hash\")\n\t\t @post_params\n\t else\n#\t\t @get_params.instance_variable_get(\"@hash\")\n\t\t @get_params\n\t end\n end", "title": "" }, { "docid": "6c74a7ff7fa75e7a6d13d3b703927e8b", "score": "0.67170405", "text": "def post_parameters\n request.POST\n end", "title": "" }, { "docid": "a9c7a26321aece97177c8759acb05ab5", "score": "0.6645622", "text": "def params() request.params end", "title": "" }, { "docid": "175e6f992600bdad2e38b6fcde8d49ca", "score": "0.6580735", "text": "def post_data\n @request[\"postData\"]\n end", "title": "" }, { "docid": "7e53b2f26155471b079717931a7e4bdc", "score": "0.6575063", "text": "def user_post_params\n params[:user_post]\n end", "title": "" }, { "docid": "cf9493729f8f1d386b885f36aa79fbaa", "score": "0.6468071", "text": "def post_params\n #params.require(:post)\n end", "title": "" }, { "docid": "ba1dadf7d42fb49bfcf4c8d290c47317", "score": "0.64501566", "text": "def post_params\n \t\t#je push le user id dans mon hash\n \t\ttemp_params = params.require(:post).permit(:title, :content, :user_id)\n \t\ttemp_params.merge!(user_id: session[:user_id])\n \t\tprint temp_params\n \t\treturn temp_params\n \tend", "title": "" }, { "docid": "eff0aa707a2f14223f0a1963e2285b52", "score": "0.64489883", "text": "def params\n self.GET.update(self.POST)\n rescue EOFError => boom\n self.GET\n end", "title": "" }, { "docid": "6dad1ea46193cc2b2150dfb8143fda94", "score": "0.64204955", "text": "def get_params\n params.fetch(:get, {})\n end", "title": "" }, { "docid": "4e84e13234fea2a1214d19bf58aa22b0", "score": "0.6380953", "text": "def post_params\n \t\t#je push le user id dans mon hash\n \t\ttemp_params = params.require(:post).permit(:title, :content, :intro, :image, :user_id)\n \t\ttemp_params.merge!(user_id: session[:user_id])\n \t\tprint temp_params\n \t\treturn temp_params\n \tend", "title": "" }, { "docid": "a20ddfbd6514e4207f1bdc8946a5cd10", "score": "0.63524884", "text": "def params\n @json['params']\n end", "title": "" }, { "docid": "0595bbded25ca66aa52f2711a4ff20d4", "score": "0.6348887", "text": "def params\n request.params\n end", "title": "" }, { "docid": "0595bbded25ca66aa52f2711a4ff20d4", "score": "0.6348887", "text": "def params\n request.params\n end", "title": "" }, { "docid": "40a6ed192210dfecf952eda411900ed8", "score": "0.6331728", "text": "def post\n request_object.post_query\n end", "title": "" }, { "docid": "becba79f56b832668f4926b920b17bc7", "score": "0.6280341", "text": "def post_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:content] )\n end", "title": "" }, { "docid": "938e40304b9b1f3185b1ade2b3aedaf1", "score": "0.62792623", "text": "def params\n # URI parameters take precendence\n @params ||= post_params.merge(get_params.merge(uri_params))\n end", "title": "" }, { "docid": "0beb217daaa888efb961dd867072dc80", "score": "0.62636673", "text": "def get(params={})\n body = get_body(params)\n raw_request = post(body)\n\n parse(raw_request)\n end", "title": "" }, { "docid": "3dcbbad21864cb9a681825bffad104f1", "score": "0.62459195", "text": "def parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "3dcbbad21864cb9a681825bffad104f1", "score": "0.6245475", "text": "def parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "3dcbbad21864cb9a681825bffad104f1", "score": "0.6245475", "text": "def parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "dfc6eea791370246abfa0de4a1be019f", "score": "0.623531", "text": "def params\n return @params\n end", "title": "" }, { "docid": "8b9f35143c17898b8873925d47e1da12", "score": "0.6199167", "text": "def _params\n return params if params.present?\n\n @_params ||= JSON.parse(request.body.read)\n end", "title": "" }, { "docid": "e88ba0e394dbf4cf39eed212e41b0803", "score": "0.6175705", "text": "def post_params\n post_params = params.require(:post).permit(:name, :body, :topic_id, :post_id)\n parent_post_id = post_params[:post_id].to_i\n if parent_post_id > 0\n post_params[:post_id] = Post.where(topic_id: post_params[:topic_id])\n .limit(1)\n .offset(parent_post_id - 1)\n .pluck(:id)[0]\n end\n return post_params\n end", "title": "" }, { "docid": "0c6e8c665610304eaa73ef7493de7628", "score": "0.61613166", "text": "def params\n @params\n end", "title": "" }, { "docid": "0c6e8c665610304eaa73ef7493de7628", "score": "0.61613166", "text": "def params\n @params\n end", "title": "" }, { "docid": "0c6e8c665610304eaa73ef7493de7628", "score": "0.61613166", "text": "def params\n @params\n end", "title": "" }, { "docid": "5d29cada3f648114a065610a58a2e42f", "score": "0.61567396", "text": "def parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "4ea2c2c94454e0dd6f164b0fcf5f3cd1", "score": "0.614824", "text": "def parse(post)\n @raw = post\n post.split('&').each do |line|\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "c7386051d760980f91789845a634ec20", "score": "0.6133159", "text": "def params\n @params\n end", "title": "" }, { "docid": "b1f46d524c51cc50cef88438628af644", "score": "0.6119685", "text": "def params\n @request.params\n end", "title": "" }, { "docid": "cc3ab789ef2ca4eba7cafba09fc1c579", "score": "0.6115011", "text": "def post_event_params\n params[:post_event]\n end", "title": "" }, { "docid": "a0f911def6c57e406ce49799960f7f8d", "score": "0.61123204", "text": "def get_post_body(name, params)\n { 'method' => name, 'params' => params, 'id' => 'jsonrpc' }\n end", "title": "" }, { "docid": "ebd798b1dc6a4a3499d558f7acc8bce1", "score": "0.60834014", "text": "def params\n @request.params\n end", "title": "" }, { "docid": "b61a27ecc60c9ca6275f5ebb91bbec5d", "score": "0.6075944", "text": "def params\n _params\n end", "title": "" }, { "docid": "0040f99d0af1a63521127823df6110f9", "score": "0.60671544", "text": "def post_tag_params\n params.fetch(:post_tag, {})\n end", "title": "" }, { "docid": "0d239f426386d52da5d0b1dfe0c65cd9", "score": "0.60511506", "text": "def parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "35c2d960e1ea6b564a84f52e6f4a9ac9", "score": "0.6038024", "text": "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "title": "" }, { "docid": "35c2d960e1ea6b564a84f52e6f4a9ac9", "score": "0.6038024", "text": "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "title": "" }, { "docid": "22cf58f2aaf18dde59c9b104cc1f2bf8", "score": "0.60371286", "text": "def params\n @req.params\n end", "title": "" }, { "docid": "fdfb6bb9ea58b4bcffc16f7ded88f6cf", "score": "0.6011109", "text": "def params=(pa)\n\t if method == :post\n\t\t @post_params = pa\n\t else\n\t\t @get_params = pa\n\t end\n end", "title": "" }, { "docid": "ec7f22643a21b0cd2e8e15d96962041f", "score": "0.6002761", "text": "def wiki_post_params\n params.fetch(:wiki_post, {})\n end", "title": "" }, { "docid": "1fabedf0ec00448f69686267c3277f90", "score": "0.6002374", "text": "def merchant_post_action_params\n params[:merchant_post_action]\n end", "title": "" }, { "docid": "7b9f79b4485cf839f00d585ae718f6d0", "score": "0.5969821", "text": "def get_param\n @params[name]\n end", "title": "" }, { "docid": "9f7da569f05cc9ad84de1dddfae22b98", "score": "0.5953707", "text": "def parse(post)\n @params ||= Hash.new\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = CGI.unescape(value || '') if key.present?\n #puts \"parsed #{key} => '#{value}', #{ key.present? ? 'aded' : 'NOT added' }\"\n end\n end", "title": "" }, { "docid": "ba21cc5b2d01de684940452139091b86", "score": "0.5951404", "text": "def parse_post params\n p = params\n [:departure, :arrival, :return].each { |x|\n # Skip below if the key we want already exists (convenient for testing)\n next if p.key? x\n\n i_hour = x.to_s + '(4i)'\n i_min = x.to_s + '(5i)'\n p[x] = p[i_hour].to_s + ':' + p[i_min].to_s\n p.delete(i_hour)\n p.delete(i_min)\n }\n\n return p\n end", "title": "" }, { "docid": "ba21cc5b2d01de684940452139091b86", "score": "0.5951404", "text": "def parse_post params\n p = params\n [:departure, :arrival, :return].each { |x|\n # Skip below if the key we want already exists (convenient for testing)\n next if p.key? x\n\n i_hour = x.to_s + '(4i)'\n i_min = x.to_s + '(5i)'\n p[x] = p[i_hour].to_s + ':' + p[i_min].to_s\n p.delete(i_hour)\n p.delete(i_min)\n }\n\n return p\n end", "title": "" }, { "docid": "c5e95eb18baf9d1c4c85a037f5d036b1", "score": "0.5951007", "text": "def params\n return @params if defined?(@params)\n nil\n end", "title": "" }, { "docid": "992dcd17857d9d4f36175bdd9dae303d", "score": "0.5950579", "text": "def params\n controller.params\n end", "title": "" }, { "docid": "7be54e0498668ea29679022ae4d0c9f1", "score": "0.5917036", "text": "def params\n @params ||= {}\n end", "title": "" }, { "docid": "7be54e0498668ea29679022ae4d0c9f1", "score": "0.5917036", "text": "def params\n @params ||= {}\n end", "title": "" }, { "docid": "2c177cfb50806e00e724e60b48a6d05e", "score": "0.5896438", "text": "def parse(post)\n \n rc4 = RubyRc4.new(self.secret_key)\n params = (Hash[ rc4.encrypt(Base64.decode64(post.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n self.params = params\n \n end", "title": "" }, { "docid": "3750e65b6401b0a88c87adeac562d8a5", "score": "0.5890223", "text": "def parse(post)\n if post.is_a? Hash\n @params = post\n elsif post.is_a? String\n @params = JSON.parse(post)\n else\n raise TypeError.new('return parameter must be either a hash or json string')\n end\n end", "title": "" }, { "docid": "44aab931cc608b84583d699fcf5530fb", "score": "0.58830017", "text": "def params\n @_params\n end", "title": "" }, { "docid": "f9e4fa2e6f273f78fe6955d4c368476d", "score": "0.5869858", "text": "def params\n @params ||= {}\n end", "title": "" }, { "docid": "f9e4fa2e6f273f78fe6955d4c368476d", "score": "0.5869858", "text": "def params\n @params ||= {}\n end", "title": "" }, { "docid": "5eab212b1d0d7075557410e979fdcb85", "score": "0.58646715", "text": "def post_params\n permit_params\n end", "title": "" }, { "docid": "92c19c9c4f166b6ca8f9785d1230e1ba", "score": "0.58481705", "text": "def post_params(method, params)\n p = params ? params.clone : {}\n p.delete :post\n sign_params(method, p)\n \n # since we're using Net::HTTP.post_form to do the call,\n # CGI escape is already done for us, so, no escape here\n # p.keys.each { |k| p[k] = CGI.escape(p[k].to_s) } \n p\n end", "title": "" }, { "docid": "bbadd4f8a468e03dc80033f437132c79", "score": "0.5822189", "text": "def parse(post)\n @raw = post\n self.params = Rack::Utils.parse_query(post)\n # Rack allows duplicate keys in queries, we need to use only the last value here\n self.params.each{|k,v| self.params[k] = v.last if v.is_a?(Array)}\n end", "title": "" }, { "docid": "39de82230075ea9c1f75311b2fd79241", "score": "0.5812856", "text": "def post_params\n if request.format.json?\n return params.permit(:title, :description, :media, :category_id)\n end\n params.require(:post).permit(:title, :description, :media, :category_id)\n end", "title": "" }, { "docid": "5a2c0443211169813011f2342f98b048", "score": "0.579733", "text": "def param\n params[0]\n end", "title": "" }, { "docid": "ee26facb8f95a28cf90ecb5d5f4ae238", "score": "0.57903814", "text": "def post(params)\n self.class.post(url, body: params)\n end", "title": "" }, { "docid": "1c5295ec63e14243c3c629b23eb5e189", "score": "0.57899517", "text": "def param_posted?(sym)\n request.post? and params[sym]\n end", "title": "" }, { "docid": "b3b72853f9602f9b58fd4e63a35f67ed", "score": "0.5769538", "text": "def _get_from_params(key)\n if @params.respond_to?(:dig)\n @params.dig(*key.to_s.split(GET_SEPARATOR).map!(&:to_sym))\n else\n @params.get(key)\n end\n end", "title": "" }, { "docid": "5ea6c9c6731af8dbe00c530ac0c7aa00", "score": "0.5751212", "text": "def params\n @opts[:params] || {}\n end", "title": "" }, { "docid": "113884d2c8b958811c1b03a6fd7c069d", "score": "0.575012", "text": "def request_params( params = {} )\n params\n end", "title": "" }, { "docid": "d7e298593bb15e524d436b4cfd9b8088", "score": "0.57366323", "text": "def post(params = nil)\n request.method = :post\n execute(params)\n end", "title": "" }, { "docid": "f75bbc4fe0f00f69219dcb6b0c98da49", "score": "0.57360876", "text": "def params\n return self.class.params\n end", "title": "" }, { "docid": "ab793357b32672853138f652929be24c", "score": "0.57334673", "text": "def params\n @params ||= { }\n end", "title": "" }, { "docid": "ab294f6ee74f84190e159e3fec203b88", "score": "0.5732018", "text": "def post_params\n params.fetch(:post).permit(:title, :content, :posted_on, :post_type, :question_id) \n # params.fetch(:post, {:title, :content})\n end", "title": "" }, { "docid": "f1f6913f57ad5ca3f323459e35ffb01e", "score": "0.5725715", "text": "def params ; @params ||= Waves::Request::Query.new( request.query.merge( captured.to_h ) ) ; end", "title": "" }, { "docid": "5868593123df03c2d8b3ae1b4d6c0c38", "score": "0.57245904", "text": "def parse(post)\r\n @raw = post.to_s\r\n for line in @raw.split('&')\r\n key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\\=(.*)$} ).flatten\r\n params[key] = CGI.unescape(value.to_s) if key.present?\r\n end\r\n end", "title": "" }, { "docid": "b5fe0dfe1de36f7e0353440c00866e9e", "score": "0.5718415", "text": "def parse(post)\n @params ||= Hash.new\n @raw = post.to_s\n #puts (\"-----parsing starts----\") * 8\n for line in @raw.split('&')\n key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\\=(.*)$} ).flatten\n if key.present?\n if self.class.const_defined?(:FIELDS_NOT_TO_BE_UNESCAPED_WHEN_PARSING) \\\n && self.class::FIELDS_NOT_TO_BE_UNESCAPED_WHEN_PARSING.include?(key)\n params[key] = value.to_s\n else\n params[key] = CGI.unescape(value.to_s)\n end\n end\n end\n #puts (\"-----parsing ends----\") * 8\n @params\n end", "title": "" }, { "docid": "5d2b1c96e721a8d5a5b5177d21c89cf0", "score": "0.5715371", "text": "def param_posted?(sym)\n request.post? and params[sym]\n end", "title": "" }, { "docid": "5d2b1c96e721a8d5a5b5177d21c89cf0", "score": "0.5715371", "text": "def param_posted?(sym)\n request.post? and params[sym]\n end", "title": "" }, { "docid": "5d2b1c96e721a8d5a5b5177d21c89cf0", "score": "0.5715371", "text": "def param_posted?(sym)\n request.post? and params[sym]\n end", "title": "" }, { "docid": "5d2b1c96e721a8d5a5b5177d21c89cf0", "score": "0.5715371", "text": "def param_posted?(sym)\n request.post? and params[sym]\n end", "title": "" }, { "docid": "0e945d77f2f1b1ca89c9a3bffffd4713", "score": "0.5707416", "text": "def get_param(key)\n raise TypeError.new('invali rack request instance.') unless @request.is_a?(::Rack::Request)\n return @request.params[key.to_s]\n end", "title": "" }, { "docid": "a137e8b6e183468842812609de83af46", "score": "0.5705665", "text": "def post_params\n # params.fetch(:post {:title, :item, :description})\n params.require(:post).permit(:title, :item, :description, :user_id, :image, :lat, :lng, :address, :latitude, :longitude)\n end", "title": "" }, { "docid": "91fc4ac36b9a0f6f35eb0818c4d77709", "score": "0.5701081", "text": "def post_params\n params.fetch(:post, {}).permit(:titulo, :descricao, :user_id, :search)\n end", "title": "" }, { "docid": "95ed4aeb237911471410f89e42d73599", "score": "0.56949604", "text": "def params\n @controller.params\n end", "title": "" }, { "docid": "95ed4aeb237911471410f89e42d73599", "score": "0.56949604", "text": "def params\n @controller.params\n end", "title": "" }, { "docid": "a31c0e752350049880d8b90786366933", "score": "0.56910026", "text": "def params\n RequestStore.store[:params]\n end", "title": "" }, { "docid": "0302c992e4ea1344419db40ecdbaf318", "score": "0.5668757", "text": "def get(p)\n @params ||= ParamDefaults\n @params[p.to_sym]\n end", "title": "" }, { "docid": "c690b2b78d352a4cf0120a5ec6122533", "score": "0.5666454", "text": "def params\n @@params\n end", "title": "" }, { "docid": "7ae58120b55b7b57c39700be65f0d040", "score": "0.56595385", "text": "def parse_post_for_pseudo_ie_cors\n if(request.post? && request.POST.blank? && request.raw_post.present?)\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n end\n end", "title": "" }, { "docid": "a29ac98c4e4182f073d8916bd4fbcbcb", "score": "0.56525195", "text": "def dynamic_params\n self.params.dynamic_param\n end", "title": "" }, { "docid": "91d4aca1a0c76e405fef61ada176425b", "score": "0.56513464", "text": "def post_params\n params.fetch(:post, {}).permit(:title, :body, :user_id)\n end", "title": "" }, { "docid": "1d66ba58faa1c26d4e0309acc2609771", "score": "0.5636625", "text": "def params_from_json\n return JSON.load(request.body.read)\n end", "title": "" }, { "docid": "5a2516e98c1cc06ddba8020bd27f19bf", "score": "0.5623272", "text": "def post()\n return @http.request(@req)\n end", "title": "" }, { "docid": "19f9cfb257d26cfab3f41ffa594ca4d8", "score": "0.56171894", "text": "def post_params\n params.fetch(:post, {}).permit(\n :title, :firstContent, :secondContent, :thirdContent, :forthContent, :fifthContent, :rname, :is_display, :status\n )\n end", "title": "" }, { "docid": "9536edfa996ecd0d8622e90cc2d3b2d9", "score": "0.55939186", "text": "def parse(post)\n @raw = post.to_s\n for line in @raw.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = CGI.unescape(value || '')\n end\n end", "title": "" }, { "docid": "0d8a1477e78e35aeb98e2c1e59fa12dc", "score": "0.55803573", "text": "def parse(post)\n @raw = post.to_s\n for line in @raw.split('&')\n key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\\=(.*)$} ).flatten\n params[key] = CGI.unescape(value.to_s) if key.present?\n end\n end", "title": "" } ]
03c2dc5b533a48fb76aa319ba64b728a
Return the total number of strings in the provided array using the count enumerable i created an empty variable to return the total number of strings in my array, i started by selecting my array and using the count enumerable to count the total number of objects, then from those ojbects selecting only the number of strings , and getting the total number of strings in my arrays. get the elements in the array assign it to a class from those elements make it equal to collect strings
[ { "docid": "8d4a789dcff04ac9181db81c95b610ef", "score": "0.6053077", "text": "def count_empty_strings(array)\n array.count do |element|\n # element == \"\"\n element.class == String && element.empty?\n end\nend", "title": "" } ]
[ { "docid": "0557e74984120f891d2d4776ebea92db", "score": "0.69784737", "text": "def count_elements(array)\n array.uniq.collect do |word|\n word[:count] = array.count(word)\n word\n end\nend", "title": "" }, { "docid": "c78fdd7bd304e003020d7f3e3bb4df68", "score": "0.68128914", "text": "def count_elements(array)\n newArray = []\n array.each do |obj|\n newArray.push(obj)\n obj[:count] = 0\n #if newArray.length > 0\n newArray.each do |obj|\n if obj.include?(:count)\n obj[:count] += 1\n else\n obj[:count] = 1\n end\n #binding.pry\n end\n #end\n end\n newArray.shift\n return newArray\nend", "title": "" }, { "docid": "1b5ff419c03f11afd9a860dc26953f06", "score": "0.6701918", "text": "def count_elements(array)\n new_array = []\n\n array.each do |original_array_element|\n\n #now inside the array looking at each indv hash\n \tif new_array.empty?\n\n \t\tfirst_new_element = {name: original_array_element[:name], count: 1}\n \t\tnew_array.push(first_new_element)\n\n \telse\n name_found = false\n \t\tnew_array.each do |new_hash_item|\n \t\t\t#binding.pry\n \t\t\tif new_hash_item.has_value?(original_array_element[:name])\n \t\t\t\tnew_hash_item[:count] += 1\n name_found = true\n \t\t\tend\n end\n if name_found == false\n new_element = {name: original_array_element[:name], count: 1}\n new_array.push(new_element)\n end\n \tend\n end\n return new_array\nend", "title": "" }, { "docid": "aa2a83a7acf1aa18a39e25b11fd3f699", "score": "0.66866577", "text": "def count_elements(array)\n counted = []\n array.each do |item|\n item[:count] = array.count(item)\n counted << item\n end\n return counted.uniq{ |item|\n item[:name]\n }\nend", "title": "" }, { "docid": "9bdf11f3823797bf4f9a6b620feec6ff", "score": "0.66535664", "text": "def count_empty_strings(array)\n count = 0\n array.each do |string|\n if string == \"\"\n count += 1\n end\n end\n count\n # Return the total number of EMPTY strings in the provided array using the count enumerable\nend", "title": "" }, { "docid": "3ac86351539e79a17a4cfefd26b8851a", "score": "0.6613011", "text": "def count_elements(array)\n new_array = []\n for person in array.uniq\n new_array.push{:name => person[:name], :count => array.count(name)}\n end\nend", "title": "" }, { "docid": "a326cdf33e36e0c0f00553af0c63c9e8", "score": "0.6562656", "text": "def gem_element arr\n freq = Hash.new(0)\n count = 0\n\n combo = arr.map(&:chars).map(&:uniq).flatten\n combo.each{ |key| freq[key]+=1 }\n freq.each{ |k,v| count +=1 if v == arr.size }\n count\n \nend", "title": "" }, { "docid": "f1eab4b38d9e1e2bd058ec2cdff42ccf", "score": "0.6543756", "text": "def actor_list(array)\n #the variable actors is equal to a new array that only has the key actors in each of the movies\n actor_in_bond = array.map {|movie| movie[:actor]}\n #list variable gives me the array of unique people out of the list of array\n list = actor_in_bond.uniq\n #variable movies per actor is equal to a iterator that will give me a new array of the movie actor from the list and\n #check the number of times the actor's name shows up in the array actor in bond then it will\n #give me an array of the actors name with the number of movie it is in\n movies_per_actor = list.map {|movie| \"#{movie} => #{actor_in_bond.count(movie)}\"}\n #outputs the list of actors with number of movies they are in\n puts movies_per_actor\nend", "title": "" }, { "docid": "6c389f2567a29bbe7756dcb4c60bbf45", "score": "0.65233445", "text": "def count_elements (array)\n result_array = []\n\n array.each do |data|\n flag =0\n result_array.each do |k|\n if k[:name] == data[:name]\n k[:count] +=1\n flag =1\n end\n end\n if(flag == 0)\n data[:count] = 1\n result_array << data\n end\n end\n result_array\nend", "title": "" }, { "docid": "245fd9fdacf876fb3e992f0bf5b52b29", "score": "0.6425905", "text": "def count_elements(array)\n\nend", "title": "" }, { "docid": "d1109bd46a459931fe96746048722f58", "score": "0.63430214", "text": "def count_items(elective_array)\n return elective_array.length\nend", "title": "" }, { "docid": "a404c2db6f2e1a63d10437eddf4b6dc8", "score": "0.63349974", "text": "def element_count(array)\n\nend", "title": "" }, { "docid": "438bf9b9cd41b43b72a5748320dbd5a5", "score": "0.6277142", "text": "def count_elements(abc)\n\n z=0\n i=1\n xyz=Array.new()\n xyz[0]=abc[0]\n\n\n xyz[0][:count]=1\n while i<abc.size do\n\n if xyz[z][:name]==abc[i][:name]\n\n\n xyz[z][:count]+=1\n i+=1\n\n else\n z+=1\n\n xyz[z]=abc[i]\n\n xyz[z][:count]=1\n i+=1\n\n end\n end\n #puts xyz.size\n print xyz\nend", "title": "" }, { "docid": "759cf1e99f6fac6058961123a415b7fd", "score": "0.6271611", "text": "def count_elements(array)\n array.group_by(&:itself).map { |key, value| key.merge(count: value.length)} # counts number of times occur\nend", "title": "" }, { "docid": "37be4e03f46d53ab778524f1296aff54", "score": "0.6221936", "text": "def count_elements(array)\n\t# My attempt:\n\t# hash = {}\n\t# array.each do |e|\n\t# \thash[e] = 1\n\t# end\n\t# new_array = []\n\t# hash.each do |animal, count|\n\t# \tnew_array = hash.select{|animal2, count2| animal2 == animal}\n\t# end\n\t# new_array\n\n\t# Stack Overflow:\n\tcounts = Hash.new(0) # sets default value (the value that is returned when trying to access key that does not exist) to 0 instead of nil\n\tarray.each { |e| counts[e] += 1 }\n\tcounts\nend", "title": "" }, { "docid": "1634665e1fbcbda59709d38600abb722", "score": "0.62017065", "text": "def count_elements(array)\n new_array = array.uniq\n new_array.each do |hash|\n hash[:count] = array.count(hash)\n end\n new_array\nend", "title": "" }, { "docid": "e4c19114c632c4d98c34c56ae78684ab", "score": "0.61943364", "text": "def count_elements(array)\n counts = Hash.new 0\n unique_elements = array.uniq\n\n unique_elements.each do |item|\n item[:count] = array.count(item)\n end\n\n unique_elements\nend", "title": "" }, { "docid": "ca722e30349bb5b08ff07938efb2e8a0", "score": "0.6192083", "text": "def count_elements(array)\n #Build hash where key = name and val = count\n counts = Hash.new(0)\n array.each do |element|\n counts[element[:name]] += 1\n end\n\n #Turn this into array of hashes\n ret = []\n counts.map do |key, val|\n h = {}\n h[:name] = key\n h[:count] = val\n ret << h\n end\n ret\nend", "title": "" }, { "docid": "4e5b28ec71865bfce3a3d0331d76fd46", "score": "0.6172177", "text": "def count_elements(arr)\n counter = Array.new\n counter_helper = Array.new\n arr.each do |element|\n if counter_helper.include?(element)\n counter[counter_helper.find_index(element)][:count] += 1\n else\n counter_helper.push(element.clone)\n element[:count] = 1\n counter.push(element)\n end\n end\n counter\nend", "title": "" }, { "docid": "3f24e0a5ca4422aa0cd8e44213e468f1", "score": "0.6167855", "text": "def count_items(electives)\n electives.length #counts number of items in the array\nend", "title": "" }, { "docid": "53dd6d364145a64f105f0a6e316e7b85", "score": "0.61669755", "text": "def list_of_companies(array)\n new_array = []\n array.each do |company|\n new_array << company.name + \" - \" + company.size.to_s\n end\n new_array\nend", "title": "" }, { "docid": "1dc1a7b04520ccc5109d97b004fc3e5b", "score": "0.61577666", "text": "def count_empty_strings(array)\narray.count \"\"\nend", "title": "" }, { "docid": "e9393d603c7d86f2b66be09a096bd4c8", "score": "0.615326", "text": "def count_occurence(array)\n counts = Hash.new(0)\n array.each { |name| counts[name] += 1 }\n puts counts\n\n price_calculator=PriceCalculator.new\n price_calculator.sepitem_quantity(counts)\n\n end", "title": "" }, { "docid": "24e79b64257bc40529798838f0de344b", "score": "0.61420506", "text": "def turn_count(arr)\r\n arr.count do |arr_item|\r\n arr_item != \" \"\r\n end\r\nend", "title": "" }, { "docid": "5be39fa2bc72d133ef12d858e541aa32", "score": "0.6140675", "text": "def count_occurrences(array)\n return puts('Invalid Array') unless array.is_a?(Array)\n return puts('There is nothing to count') if array.empty?\n\n counts = array.each_with_object(Hash.new(0)) do |word, hash|\n hash[word] += 1\n end\n\n counts.each do |word, count|\n puts \"#{word} => #{count}\"\n end\nend", "title": "" }, { "docid": "246be140de72f85579630639c9e8f14d", "score": "0.61268586", "text": "def count_occurrences1(array)\n occurrences = {}\n\n array.map(&:downcase).each do |element|\n occurrences[element] = array.count(element)\n end\n\n occurrences.each do |element, count|\n puts \"#{element} => #{count}\"\n end\nend", "title": "" }, { "docid": "7346731034eb81c10641f3ae93f8c0c2", "score": "0.611063", "text": "def count_elements(array_of_hashes)\n array_of_hashes.each do |hashes|\n hashes[:count] = 0\n # this creates a new key-value in our hash, count: 0\n name = hashes[:name]\n # this creates a new variable 'name' and assigns it the name from each hash\n array_of_hashes.each do |hash|\n # repeats the loop of iteration through array_of_hashes\n if name == hash[:name]\n # tests our variable 'name' == the :name key\n hashes[:count] += 1\n #if so, adds +1 to our count key.\n end\n end\n end.uniq\n # This removes any duplicates\n # We can apply this to the end of our loop by adding it to 'end'\nend", "title": "" }, { "docid": "cb592e7e672df5edb9fbf3068314b7e3", "score": "0.6099611", "text": "def count_empty_strings(array)\n array.count(\"\")\nend", "title": "" }, { "docid": "20538bd794613cedcf4e1804bf1be635", "score": "0.60870945", "text": "def company_list(array)\n array.each do |company|\n puts \"#{company.name} - #{company.size}\"\n end\nend", "title": "" }, { "docid": "ca3b5f6c1e1a6c803173f08770c2dab9", "score": "0.6045823", "text": "def count_elements(collection)\n count_array = []\n hash_array = []\n\n collection.each do |hash|\n\n if count_array.include?(hash[:name])\n hash_array.each do |value|\n if value[:name] == hash[:name]\n value[:count] = value[:count] + 1\n end\n end\n else\n new_hash = {}\n new_hash[:name] = hash[:name]\n new_hash[:count] = 1\n\n count_array << hash[:name]\n hash_array << new_hash\n end\n\n\n end\n\n return hash_array\nend", "title": "" }, { "docid": "932670f56e34f2c2d03e5d08c6a72225", "score": "0.60192174", "text": "def count_elements(array)\n array.each_with_object(Hash.new(0)){|arr, hash| hash[arr[:name]] += 1}.map{|key, value|{:name=>key, :count=>value}}\nend", "title": "" }, { "docid": "5cef55bf69e22e33060d84286a564658", "score": "0.601574", "text": "def count_occurrences(array)\n array.uniq.each { |word| puts \"#{word} => #{array.count(word)}\"}\nend", "title": "" }, { "docid": "621405f6c0065c966f772cc05da395d4", "score": "0.60155743", "text": "def count_eggs(chicken_array)\n total_eggs = 0\n for chicken in chicken_array\n total_eggs += chicken[:eggs]\n end\n return total_eggs\nend", "title": "" }, { "docid": "ef4d08902584fce3b47143dbc1e6f2b4", "score": "0.60061646", "text": "def length_finder(input_array)\n #input_array.map { |s| s.length }\n input_array.map(&:length)\nend", "title": "" }, { "docid": "415dfd831fb381052f9ed10c0c24d71b", "score": "0.5986149", "text": "def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend", "title": "" }, { "docid": "240ed5e94b146fd049417343b6859dea", "score": "0.5968501", "text": "def solution(a)\n # write your code in Ruby\n grouped_array = a.group_by(&:itself).values\n grouped_array.max_by(&:length).count\nend", "title": "" }, { "docid": "32da586709046df7ac7307aeed6af9df", "score": "0.5959479", "text": "def count_occurrences(array)\n count = ''\n output = { }\n\n array.each do |item|\n count = array.count(item)\n output[item] = count\n end\n output.each do |key, value|\n puts \"#{key} => #{value}\"\n end\nend", "title": "" }, { "docid": "5833c1bdf275a21d9b2f067a9a25030d", "score": "0.5957168", "text": "def length_finder(input_array)\n input_array.map {|word| word.size}\nend", "title": "" }, { "docid": "e3276957113f4288438e40b0c55d3d1c", "score": "0.59561694", "text": "def count_empty_strings(array)\narray.count {\n |string| string.class == String && string.length == 0}\nend", "title": "" }, { "docid": "e7f8327ff79f1059a37dd7b05fdb9413", "score": "0.5949823", "text": "def character_count(array)\nend", "title": "" }, { "docid": "4d684faf2ef9a7b7231bbdaa5047cd9b", "score": "0.59427464", "text": "def string_lengths(arr_of_str)\n arr_of_str.map{|str| str=str.size}\nend", "title": "" }, { "docid": "fb2a0872fedc8fc8b392d61ced98c999", "score": "0.59425056", "text": "def count_occurrences(arr)\n unique_elements = arr.uniq\n unique_elements.each { |element| puts \"#{element} => #{arr.count(element)}\"}\nend", "title": "" }, { "docid": "acc24ed757108bbff88ae924a502cd0d", "score": "0.593401", "text": "def customer_pet_count(customer_array)\n customer_array[:pets].count\nend", "title": "" }, { "docid": "83f19724faee1cb57a82f8579548d7e9", "score": "0.5930243", "text": "def numUnique(array)\n\n uniques = {}\n counter = 0\n\n for element in array\n if uniques[element]\n uniques[element] = uniques[element] + 1\n else\n uniques[element] = 1\n end\n end\n\n count_uniques = 0\n\n for element in uniques\n count_uniques += 1\n end\n\n return count_uniques\n\nend", "title": "" }, { "docid": "49220c444e2555a5f9f7ceae39b1133f", "score": "0.59113777", "text": "def element_count(arr)\n # Write your code here\n array = arr.uniq\n result = {}\n i = 0\n x = array.length\n loop do\n result.store(array[i],arr.count(array[i]))\n i += 1\n break if i == x\n end \nreturn result\nend", "title": "" }, { "docid": "1ef53f687b1dcb2ce36d1e36504d121a", "score": "0.58924764", "text": "def counter(arr)\n arr.count do |str|\n str.length < 4\n end\nend", "title": "" }, { "docid": "afe1262fd84c884264fc9d733c66de67", "score": "0.5875761", "text": "def length_finder(input_array)\n input_array.map { |elem| elem.size }\nend", "title": "" }, { "docid": "7018bdf14e1d52b8d721f0eb92f6effd", "score": "0.58742386", "text": "def count_occurrences(array)\n\toccurences = {}\n\n\tarray.each do |element|\n\t\toccurences[element] = array.count(element)\n\tend\n\n\toccurences.each do |element, count|\n\t\tputs \"#{element} => #{count}\"\n\tend\t\nend", "title": "" }, { "docid": "85973b3837137d59bca6b8c7e4885917", "score": "0.5871912", "text": "def rep_items(array, rep_bills)\n array << rep_bills.reject {|bill| bill.introduced_on.nil? }.size\n array << rep_bills.reject {|bill| bill.referred_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_hearing_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_markup_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.reported_by_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.referred_to_subcommittee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.subcommittee_hearing_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.subcommittee_markup_held_on.nil? }.size\n array << rep_bills.reject {|bill| bill.forwarded_from_subcommittee_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.committee_hearing_held_on.nil? and bill.committee_markup_held_on.nil? and bill.reported_by_committee_on.nil? and bill.subcommittee_hearing_held_on.nil? and bill.subcommittee_markup_held_on.nil? and bill.forwarded_from_subcommittee_to_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.reported_by_committee_on.nil? and bill.rule_reported_on.nil? and bill.rules_suspended_on.nil? and bill.considered_by_unanimous_consent_on.nil? and bill.passed_house_on.nil? and bill.failed_house_on.nil? and bill.received_in_senate_on.nil? and bill.placed_on_union_calendar_on.nil? and bill.placed_on_house_calendar_on.nil? and bill.placed_on_private_calendar_on.nil? and bill.placed_on_corrections_calendar_on.nil? and bill.placed_on_discharge_calendar_on.nil? and bill.placed_on_consent_calendar_on.nil? and bill.placed_on_senate_legislative_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_union_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_house_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_private_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_corrections_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.placed_on_discharge_calendar_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rule_reported_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rule_passed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.rules_suspended_on.nil? }.size\n array << rep_bills.reject {|bill| bill.considered_by_unanimous_consent_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.failed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.received_in_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.failed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.sent_to_conference_committee_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_report_issued_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_passed_house_on.nil? }.size\n array << rep_bills.reject {|bill| bill.conference_committee_passed_senate_on.nil? }.size\n array << rep_bills.reject {|bill| bill.presented_to_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.signed_by_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.vetoed_by_president_on.nil? }.size\n array << rep_bills.reject {|bill| bill.house_veto_override_on.nil? }.size\n array << rep_bills.reject {|bill| bill.senate_veto_override_on.nil? }.size\n array << rep_bills.reject {|bill| bill.house_veto_override_failed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.senate_veto_override_failed_on.nil? }.size\n array << rep_bills.reject {|bill| bill.passed == false }.size\n end", "title": "" }, { "docid": "1349d5206305a33f57613231d93be8e9", "score": "0.58517116", "text": "def stock_count(stock_count_array)\n stock_count_array[:pets].count\nend", "title": "" }, { "docid": "82a26e08767c7fa678bd4d0dcc0f5e5d", "score": "0.58427924", "text": "def count\n elements.count\n end", "title": "" }, { "docid": "c62fab2814305823faeb91fcb7507e74", "score": "0.58422387", "text": "def sentiments_counts\n #This will get the sentiments related to each instance\n x = self.sentiments\n\n #These two lines are instantiated for the while loop below\n y = 0\n sentiments_count = []\n\n #This is a loop taking 'positive', 'negative', or 'neutral' from the instances\n while y < x.count\n sentiments_count << x[y][:sentiment]\n y += 1\n end\n\n #This creates a hash and counts each of the words' occurrences in the array\n #The output will look something like:\n # {\"Positive\" => 2, \"Neutral\" => 1, \"Negative\" => 3}\n hash = sentiments_count.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n hash.map {|key, value| puts \"#{key} - #{value}\"}\n end", "title": "" }, { "docid": "07e4e40560c88d6806ee3c4bf6abf510", "score": "0.5841678", "text": "def test_returns_count\n assert(\n FromArray.new([1, 2, 3]).count == 3\n )\n assert(\n FromArray.new([]).count.zero?\n )\n end", "title": "" }, { "docid": "894bbcad50be6881130ccf740bade501", "score": "0.5821956", "text": "def count\n to_a.size\n end", "title": "" }, { "docid": "894bbcad50be6881130ccf740bade501", "score": "0.5821956", "text": "def count\n to_a.size\n end", "title": "" }, { "docid": "4a1b29ef8fa5ddf17e61ee3fc02e9c52", "score": "0.5821597", "text": "def possibilities(arrx) #convert shortened array into characters\n\ty= File.select!{|valcount| valcount =~ arry} #break down array into strings of specified length\n\n\t#need to count every letter from each string and match with positions and count the occurence of said letters\n\nend", "title": "" }, { "docid": "dd7ba3e7e020ee77b94d550b25714de8", "score": "0.58162385", "text": "def string_lengths(array)\n array.map! {|element| element.length}\n p array\nend", "title": "" }, { "docid": "f0697a11ccee540dc6d44afed8427f9d", "score": "0.5810987", "text": "def subarray_count(subarray)\n\t\t\t\t\teach_cons(subarray.length).count(subarray)\n\t\t\t end", "title": "" }, { "docid": "6365f7894ae5bf04312ca88fc4b9be0d", "score": "0.5807629", "text": "def str_length(array)\n \n array.map {|elem| elem.length}\n \nend", "title": "" }, { "docid": "5aa253f6450673721402cf996c6acee1", "score": "0.58053887", "text": "def count_smileys(arr)\n return 0 if arr.empty?\n valid = {\"eyes\"=>[\":\", \";\"], \"nose\"=>[\"-\", \"~\"], \"mouth\"=>[\")\", \"D\"]}\n valid_two = arr.select { |smile| smile.size == 2 }\n valid_three = arr.select { |smile| smile.size == 3 }\n\n valid_smiles = []\n\n valid_two.each do |smile|\n if valid[\"eyes\"].include?(smile[0]) &&\n valid[\"mouth\"].include?(smile[1])\n valid_smiles << smile\n end\n end\n\n valid_three.each do |smile|\n if valid[\"eyes\"].include?(smile[0]) &&\n valid[\"nose\"].include?(smile[1]) &&\n valid[\"mouth\"].include?(smile[2])\n valid_smiles << smile\n end\n end\n\n valid_smiles.size\nend", "title": "" }, { "docid": "4731d50df55f3107ad17db6e87a9ebb5", "score": "0.5790529", "text": "def custom_count(array)\n counter = 0\n array.each do |elem|\n if elem != nil\n counter += 1\n end\n end\n counter\nend", "title": "" }, { "docid": "74bc5da8cafbe41461ca46e80b1cb085", "score": "0.5776024", "text": "def count_all (array)\n count = 0\n i = 0\n while i < array.length\n count += array[i].length\n i += 1\n end\n return count\nend", "title": "" }, { "docid": "6864b13773cca51743c8c0e0734f317b", "score": "0.5769329", "text": "def count(array)\n hash = {}\n array.each do |item|\n hash[item] = array.count(item)\n end\n hash\nend", "title": "" }, { "docid": "baebe21bdaba4f9133ffacfa5132e73d", "score": "0.5764489", "text": "def solve(array)\n alphabet = ('a'..'z').to_a.join\n results = []\n \n array.each do |string|\n count = 0\n string.downcase!\n string.chars.each_with_index do |char, index|\n count += 1 if string[index] == alphabet[index]\n end\n results << count\n end\n results \nend", "title": "" }, { "docid": "ae6deb239306700b10c90864f26bf1f9", "score": "0.57605535", "text": "def count_elements\nend", "title": "" }, { "docid": "46530dd09e96aefb3c83bd7492c4abed", "score": "0.5757203", "text": "def count\n to_a.size\n end", "title": "" }, { "docid": "6c80b3f02c71905be53d64beb37e04b0", "score": "0.5752416", "text": "def how_many(srt)\n arr = srt.split(\" \")\n count = {}\n\n #arr.map{ |s| \"#{s} #{arr.count s}\" }\n\n # arr.each do |s|\n # s.downcase!\n # count[s] = count.key?(s) ? count[s]+1 : 1\n # end\nend", "title": "" }, { "docid": "217dbe1edf8155017e254bb7a1419998", "score": "0.57481086", "text": "def word_count(arr)\n count = Hash.new(0)\n arr.each { |i| count[i] += 1 }\n \n return count\nend", "title": "" }, { "docid": "bfcee622f946e4210bcf128f552f6c1b", "score": "0.5742937", "text": "def length_finder(input_array)\n\toutput_array = input_array.map{ |string| string.length}\nend", "title": "" }, { "docid": "257e5cddcdc6f7f1cba1c3b2aecbdfff", "score": "0.573079", "text": "def string_lengths input_array\n\n results = []\n input_array.each do |n| \n results.push(n.length)\n end\n results\nend", "title": "" }, { "docid": "38f756ff627756f44a9ef54d5729cd96", "score": "0.5730691", "text": "def length_finder(input_array)\n result=Array.new\n input_array.each do |string|\n result << string.length\n end\n return result\nend", "title": "" }, { "docid": "21b0976d9edfa7a88492cde9251a879b", "score": "0.57281697", "text": "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "title": "" }, { "docid": "0248f9c9223f6875d5cbab5bb2bb3902", "score": "0.57112235", "text": "def sizes(companies)\n companies.reduce(0) do |sum, company|\n sum + \"#{company.size}\".to_i\n end \nend", "title": "" }, { "docid": "0dc6eb2f1ead7d169be355ff368765f7", "score": "0.5710837", "text": "def one_rv\n count = 0\n for x in [email protected]\n if @elements[x].remaining_vals.length == 1\n count+=1\n end\n end\n count\n end", "title": "" }, { "docid": "1996b27a96ab416f9a4fa752fb987f5e", "score": "0.5710403", "text": "def genotype_count(genome_array)\n\n gcount = Hash.new(0)\n\n #This block of code will generate a list of homozygous genotypes, and a list of heterozygous genotypes\n nucleotides = \"ACTG\"\n homozygous_genotypes_array = []\n heterozygous_genotypes_array = []\n nucleotides.each_char {|ele1| \n nucleotides.each_char {|ele2|\t\n homozygous_genotypes_array<<(ele1 + ele2) if ele1 == ele2\t\n heterozygous_genotypes_array<<(ele1 + ele2) if ele1 != ele2}}\n \n #This adds up the number of different genotypes in the genome\n genome_array.each {|entry|\n if heterozygous_genotypes_array.include?(entry[3]) \n gcount[\"Heterozygous\"] += 1 \n elsif homozygous_genotypes_array.include?(entry[3])\n\t gcount[\"Homozygous\"] += 1\n elsif nucleotides.include?(entry[3])\n gcount[\"Haploid\"] += 1 \n else\n gcount[\"Missing\"] += 1 \n end\n }\n gcount.each {|genotype, count| puts count.to_s + \" \" + genotype + \" data points\"}\nend", "title": "" }, { "docid": "d95e54b4ba88c193178e99244b734aaf", "score": "0.57079333", "text": "def count_results(result_array)\n results = empty_counter\n result_array.each do |topic|\n topic.keys.each {|key| results[key] += topic[key]}\n end\n results\n end", "title": "" }, { "docid": "a8aa17cbbc3e120886781ae31d6859b0", "score": "0.5707396", "text": "def Occurrence_count(arr)\n\th1={}\n\tarr.each do |element|\n\t\th1[\"#{element}\"].nil? ? h1[\"#{element}\"]=1 : h1[\"#{element}\"]+=1\n\tend\n\th1.each do |key,value|\n\t\tputs \"\tOccurrence of #{ key } in the array is #{value} times \"\n\tend\t\nend", "title": "" }, { "docid": "0576011390fe345bb0ce1127520a6ff5", "score": "0.57052124", "text": "def company_strings(companies)\n companies.map do |company|\n \"#{company.name} - #{company.size}\"\n end\nend", "title": "" }, { "docid": "d7fc9ac4f61c1deb01520b15840bf771", "score": "0.5703171", "text": "def count_elements(animals)\n animal_hash = {}\n animals.each do |animal| \n animals.count(animal)\n animal_hash[animal] = animals.count(animal)\n end\n animal_hash\nend", "title": "" }, { "docid": "4f68f3b6e8153098c67666cfbbf4c506", "score": "0.56926256", "text": "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "title": "" }, { "docid": "ee09a2ef8aba7afc19c728a6c1a64ccc", "score": "0.56901354", "text": "def compare_array(sub_strings, dictionary)\n sub_strings.reduce(Hash.new(0)) do |hash, word|\n dictionary.each do |dict_word|\n if word == dict_word\n hash[dict_word] += 1\n end\n end\n hash\n end\nend", "title": "" }, { "docid": "80b40d056b5b411addc5b02caf395977", "score": "0.56896794", "text": "def get_Table(value, elements)\n #arr_data = values.clone #recivimos el arreglo de elementos y copiamos\n countArray = Array.new()\n array = value.split(\"\")\n\n for i in 0..(elements.length - 1)\n elements[i].setTimes(array.count(elements[i].getCode()))##Cargamos los datos al objeto Inormation\n end\n return elements\n end", "title": "" }, { "docid": "7052cf4e4727dd715d99cf23834100c2", "score": "0.56878227", "text": "def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end", "title": "" }, { "docid": "445c1f7e59860efc7832c8382b34042a", "score": "0.5676193", "text": "def cat_count\n total_arr = []\n counter = 0\n #cat_array1 = [\"Characters\", \"Films\", \"Planets\", \"Starships\", \"Species\"]\n\n 5.times do\n #x = cat_array1[0]\n url_array = [\"http://www.swapi.co/api/people\", \"http://www.swapi.co/api/films\",\n \"http://www.swapi.co/api/planets\", \"http://www.swapi.co/api/starships\",\n \"http://www.swapi.co/api/species\"]\n response_string = RestClient.get(url_array[counter])\n response_hash = JSON.parse(response_string)\n total = response_hash[\"count\"]\n total_arr << total\n counter = counter + 1\n end\n total_arr\nend", "title": "" }, { "docid": "9a238c0a93dd403e80d1585fdcb5d4de", "score": "0.56752855", "text": "def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize method\n # collection() is a private accessor method at the bottom of this class that accesses @collection\n collection.count\n end", "title": "" }, { "docid": "3e12ab6267b8430c0bf8d0fdd2e2e7f0", "score": "0.56694204", "text": "def solve(array)\n aplhabet = ('a'..'z').to_a\n array.map do |string|\n count = 0\n string.chars.each_with_index do |char, idx|\n count += 1 if char.downcase == aplhabet[idx]\n end\n count\n end\nend", "title": "" }, { "docid": "38ffe96ff4ce1afcf3894f81a46e4a5b", "score": "0.5659852", "text": "def solution(a)\n a.uniq.count\nend", "title": "" }, { "docid": "ceae66d95af66c70b032aa7c410fa5e7", "score": "0.56537676", "text": "def lengths(arr)\n lenOfStrings = arr.map{|index| index.length}\n p lenOfStrings\nend", "title": "" }, { "docid": "bd584b42a756afb03ae4a08c58918c38", "score": "0.56498635", "text": "def frequency(a)\r\n a.group_by do |e|\r\n e\r\n end.map do |key, values|\r\n [values.size]\r\n end\r\nend", "title": "" }, { "docid": "01593a0ccce078ffda5a9f8b89832ec4", "score": "0.5649067", "text": "def length_finder(input_array)\n total = []\n input_array.each { |word| total << word.length }\n return total\nend", "title": "" }, { "docid": "e9ba0d136936e5bd3d7a6b3533266537", "score": "0.5648141", "text": "def count_occurences(arr)\n count = Hash.new(0)\n arr.each { |item| count[item.downcase] += 1 }\n count.each { |key, value| puts \"#{key} => #{value}\"}\nend", "title": "" }, { "docid": "ed6b0532db10d9d57f6571adcd048848", "score": "0.56401604", "text": "def count_occurences(array)\n\n # interate over array and add unique values as keys to a new hash\n unique_values = {}\n\n array.each do |item|\n if unique_values.keys.include?(item) == false\n unique_values[item] = 0\n end\n end\n # ------------\n\n\n # interate over hash and array, +1 the value of key for every match in array\n unique_values.each_key do |key|\n array.each do |item|\n if key == item\n unique_values[key] += 1\n end\n end\n end\n\n unique_values\nend", "title": "" }, { "docid": "43273d7ac3c32797051a90fe07e14c39", "score": "0.5635081", "text": "def count_freq(array)\n array.each_with_object(Hash.new(0)) { |obj, counts| counts[obj] += 1 }\n end", "title": "" }, { "docid": "e982bc13bfaa4c3babea989ba49df39e", "score": "0.5632977", "text": "def counts_one_line(array)\n array.each_with_object(hello = Hash.new(0)) {|x, counts| counts[x] += 1}\n hello\nend", "title": "" }, { "docid": "e2d5c1857e88edd140a0dad25535ee90", "score": "0.5627396", "text": "def count_occurrences(array)\n \n count_hash = {}\n \n array.map(&:downcase!)\n \n array.uniq.each do |ele|\n count_hash[ele] = 0\n end\n \n array.each do |ele|\n count_hash[ele] += 1\n end\n \n puts count_hash\nend", "title": "" }, { "docid": "a36dbf91834f1754166d71adf4335416", "score": "0.56247723", "text": "def lengths(arrayOfStrings)\n return arrayOfStrings.map { |i| i.length }\nend", "title": "" }, { "docid": "5b461dd01a4ba73e4da08790eaef9a27", "score": "0.56237644", "text": "def count_occurrences(arr)\n dc_arr = arr.map { |i| i.downcase }\n dc_arr.each do |i|\n i = ??\n end\nend", "title": "" }, { "docid": "18e530470334ecb1f218ece83c74b472", "score": "0.5617941", "text": "def gem_stones array\n\n gem_list = []\n\n array.map! do |x|\n x.chars.uniq.sort\n end\n\n sum_of_array = array.flatten\n freq = Hash.new(0)\n sum_of_array.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq.each do |key, value|\n if value == array.size\n gem_list << key\n end\n end\n gem_list \nend", "title": "" }, { "docid": "219cb4188252216fffd8b7237f9d7394", "score": "0.5610946", "text": "def analysis\n hash = {}\n @array.each do |item|\n chars = item.chars.to_a - @used_chars\n\n chars.each do |char|\n if hash[char] == nil\n hash[char] = 1\n else\n hash[char] += 1\n end\n end\n end\n\n hash.sort_by { |_, v| -v }\n end", "title": "" }, { "docid": "9a52d9b3f92426a9270b826de669a460", "score": "0.5604677", "text": "def length_of_array(array)\n programming_languages = [\"Ruby\", \"Javascript\", \"Python\", \"C++\", \"Java\", \"Lisp\", \"PHP\", \"Clojure\"]\n programming_languages.length # => 8\n end", "title": "" } ]
3c85ed037c8a385681e22da5fd0833ac
Get xAPI statements for a Registration Returns xAPI statements for the registration.
[ { "docid": "acfc09bd336cd03eb1d7be7fa3f6c832", "score": "0.54694486", "text": "def get_registration_statements(registration_id, opts = {})\n data, _status_code, _headers = get_registration_statements_with_http_info(registration_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "5be79e081333cdb6e5bc14cb052925e7", "score": "0.639766", "text": "def get_registration_statements_with_http_info(registration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registration_statements ...'\n end\n # verify the required parameter 'registration_id' is set\n if registration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'registration_id' when calling RegistrationApi.get_registration_statements\"\n end\n # resource path\n local_var_path = '/registrations/{registrationId}/xAPIStatements'.sub('{' + 'registrationId' + '}', registration_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'XapiStatementResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registration_statements\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "faebd827d5f1008c7fba7df71f8c8812", "score": "0.6371561", "text": "def get_registration_statements_with_http_info(registration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registration_statements ...'\n end\n # verify the required parameter 'registration_id' is set\n if @api_client.config.client_side_validation && registration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'registration_id' when calling RegistrationApi.get_registration_statements\"\n end\n # resource path\n local_var_path = '/registrations/{registrationId}/xAPIStatements'.sub('{' + 'registrationId' + '}', registration_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'XapiStatementResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registration_statements\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0cc482c8f0676f2fc6c373846ca34938", "score": "0.5587104", "text": "def get_registration_instance_statements_with_http_info(registration_id, instance_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registration_instance_statements ...'\n end\n # verify the required parameter 'registration_id' is set\n if registration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'registration_id' when calling RegistrationApi.get_registration_instance_statements\"\n end\n # verify the required parameter 'instance_id' is set\n if instance_id.nil?\n fail ArgumentError, \"Missing the required parameter 'instance_id' when calling RegistrationApi.get_registration_instance_statements\"\n end\n # resource path\n local_var_path = '/registrations/{registrationId}/instances/{instanceId}/xAPIStatements'.sub('{' + 'registrationId' + '}', registration_id.to_s).sub('{' + 'instanceId' + '}', instance_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'XapiStatementResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registration_instance_statements\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4495d0907301ddd645354633d67477a8", "score": "0.521722", "text": "def get_registration_instance_statements_with_http_info(registration_id, instance_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registration_instance_statements ...'\n end\n # verify the required parameter 'registration_id' is set\n if @api_client.config.client_side_validation && registration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'registration_id' when calling RegistrationApi.get_registration_instance_statements\"\n end\n # verify the required parameter 'instance_id' is set\n if @api_client.config.client_side_validation && instance_id.nil?\n fail ArgumentError, \"Missing the required parameter 'instance_id' when calling RegistrationApi.get_registration_instance_statements\"\n end\n if @api_client.config.client_side_validation && instance_id < 0\n fail ArgumentError, 'invalid value for \"instance_id\" when calling RegistrationApi.get_registration_instance_statements, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/registrations/{registrationId}/instances/{instanceId}/xAPIStatements'.sub('{' + 'registrationId' + '}', registration_id.to_s).sub('{' + 'instanceId' + '}', instance_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'XapiStatementResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registration_instance_statements\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "fb4214f9188d1d7369359196431a36d5", "score": "0.51642376", "text": "def index\n @instrument_registrations = InstrumentRegistration.all\n end", "title": "" }, { "docid": "0a99a9274e76ddf491e16d4b5f334a90", "score": "0.5019921", "text": "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "title": "" }, { "docid": "0a99a9274e76ddf491e16d4b5f334a90", "score": "0.5019921", "text": "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "title": "" }, { "docid": "b887224b714fbc0ed9d8ef7e9f1c411b", "score": "0.49959812", "text": "def index\n @simple_registrations = SimpleRegistration.all\n end", "title": "" }, { "docid": "e8e6d56ad63c6a9a135288bff668e7c3", "score": "0.49309278", "text": "def index\n @sregistrations = Sregistration.all\n end", "title": "" }, { "docid": "f06bd0b7803720810a14bba86c0f754b", "score": "0.49228716", "text": "def index\n @user_registrations = User::Registration.all\n end", "title": "" }, { "docid": "d6961c7c2447ae8c58611420f9f704ee", "score": "0.49209577", "text": "def index\n @registration_requests = RegistrationRequest.all\n end", "title": "" }, { "docid": "aa078c34559bb927d6b7dc972f731e91", "score": "0.49162096", "text": "def index\n @registrationns = Registrationn.all\n end", "title": "" }, { "docid": "7fde601502474fbb4c08cba73867ef4a", "score": "0.4911817", "text": "def index\n params[:page] ||= 1\n params[:per] ||= 25\n params[:sort] ||= 'date_registered'\n params[:direction] ||= 'DESC'\n registrations = Registration.active.order('date_registered')\n sort_order = params[:sort] == 'display_name' ? 'last_name' : params[:sort]\n if params[:q].present?\n keyword = params[:q].strip.downcase\n registrations = registrations.where('TRIM(LOWER(first_name)) LIKE :keyword OR TRIM(LOWER(middle_name)) LIKE :keyword OR TRIM(LOWER(last_name)) LIKE :keyword OR registration_no LIKE :keyword OR TRIM(LOWER(grp_org_comp)) LIKE :keyword OR TRIM(LOWER(residential_address)) LIKE :keyword', keyword: \"%#{keyword}%\")\n end\n if params[:cat].present?\n registrations = registrations.where(category: params[:cat])\n end\n if params[:s].present? && Registration::STATUS.include?(params[:s].capitalize)\n registrations = registrations.send(params[:s].strip.downcase)\n end\n if params[:singlet].present? && Registration::SINGLET.include?(params[:singlet])\n registrations = registrations.where(singlet: params[:singlet])\n end\n @registrations = registrations.reorder(\"#{sort_order} #{params[:direction]}\").page(params[:page]).per(params[:per])\n respond_to do |format|\n format.html\n format.xlsx do\n @registrations = Registration.active.approved.includes(:approver).order('registration_no')\n response.headers['Content-Disposition'] = 'attachment; filename=\"registrations_report.xlsx\"'\n end\n end\n end", "title": "" }, { "docid": "9ed481e74aa0a219bb856d7950f9b03a", "score": "0.4907842", "text": "def crud_actions\n @apis.select do |api|\n # TODO make {name} more generic\n api[\"path\"].match(/\\/#{@resource_name}\\/{name}[\\/]{0,1}$/) || api[\"path\"].match(/\\/#{@resource_name}$/)\n end\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "ac390140f7685801586fed00843cc796", "score": "0.48983794", "text": "def index\n @registrations = Registration.all\n end", "title": "" }, { "docid": "99cd200be775f04c99ea616b1ad26860", "score": "0.4885437", "text": "def list_registration\n @title = 'Admin - List Registered'\n @registrations = Registration.find(:all, :conditions => [\"event_id = ?\",@main_event.id], :order => \"last_name\")\n respond_to do |format|\n format.html # list_registration.html.erb\n format.xml { render :xml => @registrations, :layout => false }\n format.csv { render :csv => @registrations, :layout => false }\n end\n end", "title": "" }, { "docid": "34c18bd019148328bebc92baad4addd1", "score": "0.47593114", "text": "def get_registration_instance_statements(registration_id, instance_id, opts = {})\n data, _status_code, _headers = get_registration_instance_statements_with_http_info(registration_id, instance_id, opts)\n data\n end", "title": "" }, { "docid": "34c18bd019148328bebc92baad4addd1", "score": "0.47593114", "text": "def get_registration_instance_statements(registration_id, instance_id, opts = {})\n data, _status_code, _headers = get_registration_instance_statements_with_http_info(registration_id, instance_id, opts)\n data\n end", "title": "" }, { "docid": "775d5005001bf945bf418a7e61d7195d", "score": "0.4755373", "text": "def get_api_ids\n cb = {api_id: 1, callback: self.method(:on_get_api_id)}\n\n database(cb)\n history(cb)\n network_broadcast(cb)\n\n # this by default is disabled by api-access.json\n # we don't need it normally\n # network_node(cb)\n end", "title": "" }, { "docid": "8b234543e5191babfd75f9633a47cd12", "score": "0.47520956", "text": "def transactional(api_name)\n get \"#{base_url}/journeys/transactional/#{api_name}\"\n end", "title": "" }, { "docid": "f649dc693b8431a69617379c60c31829", "score": "0.474181", "text": "def index\n if @sip_account.nil?\n @extensions = Extension.accessible_by( current_ability, :index ).all\n else\n @extensions = @sip_account.extensions.accessible_by( current_ability, :index )\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @extensions }\n end\n end", "title": "" }, { "docid": "78c5545f148eb4b35612f85406e88918", "score": "0.47389418", "text": "def index\n @registrations = Match.active.registrations_with_shooters_and_invoice\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations.as_json(methods: [:shooter_name, :shooter_waiver]), root: false }\n end\n end", "title": "" }, { "docid": "e71541f184011e8fdba4bf71a1b572b0", "score": "0.47301644", "text": "def api(action: nil, ids: nil, props: nil, languages: 'en', entity: nil, property: nil)\n query_options = [\n :format,\n :action,\n :props,\n :languages,\n :ids,\n :sitelinks,\n :entity,\n :property\n ]\n query_options_string = query_options.join(',')\n \n template = Addressable::Template.new(\"https://www.wikidata.org/w/api.php{?#{query_options_string}}\")\n template = template.expand({\n 'action': action,\n 'format': 'json',\n 'ids': ids,\n 'languages': languages,\n 'props': props,\n 'entity': entity,\n 'property': property\n })\n\n puts template if ENV['DEBUG']\n api_uri = URI.parse(template.to_s)\n\n response = JSON.load(URI.open(api_uri))\n\n if response['success'] && action == 'wbgetentities'\n return response['entities']\n elsif action == 'wbgetclaims'\n return response['claims']\n else\n return nil\n end\n end", "title": "" }, { "docid": "8a6036ed82d1c874684378f454d8f160", "score": "0.47269475", "text": "def index\n @registration_responses = @registration.registration_responses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registration_responses }\n end\n end", "title": "" }, { "docid": "05ff6ce6c350923c3b8e5d82135d0839", "score": "0.4723966", "text": "def get_api\n # For now we only have one.\n @api = Api.first\n if @api == nil\n #\n # @api = Api.find_by_major_version\n # So far, we just ignore, and give them this one.\n #\n @api = Api.new\n @api.major_version = 1\n @api.minor_version = 1\n\n text = \"<API\\n\"\n text += \"majorVersion= '#{@api.major_version}'\\n\"\n text += \"minorVersion= '#{@api.minor_version}'\\n\"\n text += \"getRouteJourneyIds = '#{CONTROLLER_URL}/pass/route_journeys.text'\\n\"\n text += \"getRouteDefinition = '#{CONTROLLER_URL}/pass/route_journey/'\\n\"\n text += \"getJourneyLocation = '#{CONTROLLER_URL}/pass/curloc/'\\n\"\n text += \"/>\"\n @api.definition = text\n end\n respond_to do |format|\n format.html { render :nothing, :status => 403 } #forbidden\n format.xml { render :xml => @api.definition }\n end\n end", "title": "" }, { "docid": "4b30bd8efdc585bb2d1a308cf5db9d69", "score": "0.47127426", "text": "def get_statement_pipes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: XapiApi.get_statement_pipes ...'\n end\n # resource path\n local_var_path = '/xapi/statementPipes'\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 = ['APP_NORMAL', 'OAUTH']\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 => 'XapiStatementPipeListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: XapiApi#get_statement_pipes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f2bad77acd39787a1d0cb3d312628ccb", "score": "0.4703696", "text": "def index\n @registerations = Registeration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registerations }\n end\n end", "title": "" }, { "docid": "3ee983f47354a71e06c527c7089a6004", "score": "0.47003567", "text": "def index\n @course_registrations = CourseRegistration.all\n end", "title": "" }, { "docid": "68a8bcea60b5dd6657c925d839b28303", "score": "0.46885866", "text": "def get_registration\n path = self.api_root + '/register'\n process_firecloud_request(:get, path)\n end", "title": "" }, { "docid": "ad90fb4a553e838e03be01985239a91d", "score": "0.4687454", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"registries\", json_api_params, @registries).to_json }\n end\n end", "title": "" }, { "docid": "f33b2eca813b8f247860d745eb2862fe", "score": "0.46750456", "text": "def query_spdx\n # Call the ROR API and log any errors\n resp = http_get(uri: \"#{api_base_url}#{list_path}\", additional_headers: {}, debug: false)\n\n unless resp.present? && resp.code == 200\n handle_http_failure(method: 'SPDX list', http_response: resp)\n return []\n end\n json = JSON.parse(resp.body)\n return [] unless json.fetch('licenses', []).any?\n\n json['licenses']\n rescue JSON::ParserError => e\n log_error(method: 'SPDX search', error: e)\n []\n end", "title": "" }, { "docid": "8db182e2e7b5087e1097d1f25935b865", "score": "0.4656408", "text": "def ql\n returns = params[:batch].to_unsafe_h.map do |batch_resource, query|\n batch_resource = batch_resource.to_s\n batch_module = batch_resource.underscore\n resource = batch_resource.classify.constantize\n authorize_for(action: :index,\n resource: batch_module.singularize.to_sym)\n records = resource.ransack(parsed_query(query)).result(distinct: true).as_json\n [batch_module, records]\n end.to_h\n render json: returns\n end", "title": "" }, { "docid": "7f58107970e319cd417df18cac49896a", "score": "0.46540615", "text": "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "title": "" }, { "docid": "7f58107970e319cd417df18cac49896a", "score": "0.46540615", "text": "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "title": "" }, { "docid": "7974f03ed79faec01b434f30a4c71d99", "score": "0.46434793", "text": "def instrument_get_active_and_indices(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: InstrumentApi#instrument_get_active_and_indices ...\"\n end\n \n # resource path\n path = \"/instrument/activeAndIndices\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Instrument>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: InstrumentApi#instrument_get_active_and_indices. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "90d08ca8d44909c9149fc209148896b5", "score": "0.46430144", "text": "def index\n @api_tokens = ApiToken.all\n end", "title": "" }, { "docid": "b84469a79b9bfcb51044c3300e05ea4f", "score": "0.4633485", "text": "def index\n @registers = Register.all\n end", "title": "" }, { "docid": "b84469a79b9bfcb51044c3300e05ea4f", "score": "0.4633485", "text": "def index\n @registers = Register.all\n end", "title": "" }, { "docid": "b84469a79b9bfcb51044c3300e05ea4f", "score": "0.4633485", "text": "def index\n @registers = Register.all\n end", "title": "" }, { "docid": "b84469a79b9bfcb51044c3300e05ea4f", "score": "0.4633485", "text": "def index\n @registers = Register.all\n end", "title": "" }, { "docid": "3122423e1fe42fef63d30e4571ac2e46", "score": "0.46160877", "text": "def index\n\t\t@sip_gateways = SipGateway.accessible_by( current_ability, :index ).all\n\t\t\n\t\t@freeswitch_gateways = ::XmlRpc::sofia_gateway_states( ::SipGateway::FREESWITCH_GATEWAYS_PROFILE )\n\t\t#Rails.logger.info \"-------------- #{@freeswitch_gateways.inspect}\"\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @sip_gateways }\n\t\tend\n\tend", "title": "" }, { "docid": "872d12fe9e81747ddb454d602913243e", "score": "0.46160075", "text": "def index\n @registrations = Registration.where(year: 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "title": "" }, { "docid": "f71e26719657a9e10fd7477ac4883a2b", "score": "0.4607451", "text": "def index\n @user_registrations = UserRegistration.all\n puts\"============ Index ================\"\n puts @user_registrations.to_json\n puts\"============================\"\n\n end", "title": "" }, { "docid": "3c3825abcdc0304306c20c27855bd1b4", "score": "0.46031725", "text": "def index\n @regiestrations = Regiestration.all\n end", "title": "" }, { "docid": "18f3ae1014599e24646d4537c027e57d", "score": "0.45916826", "text": "def capability_statement\n resource = FHIR::CapabilityStatement.new(\n status: 'active',\n kind: 'instance',\n date: DateTime.parse('2021-05-04').strftime('%FT%T%:z'),\n software: FHIR::CapabilityStatement::Software.new(\n name: 'Sara Alert',\n version: ADMIN_OPTIONS['version']\n ),\n implementation: FHIR::CapabilityStatement::Implementation.new(\n description: 'Sara Alert API'\n ),\n fhirVersion: '4.0.1',\n format: %w[json],\n rest: FHIR::CapabilityStatement::Rest.new(\n mode: 'server',\n security: FHIR::CapabilityStatement::Rest::Security.new(\n cors: true,\n service: FHIR::CodeableConcept.new(\n coding: [\n FHIR::Coding.new(code: 'SMART-on-FHIR', system: 'http://hl7.org/fhir/restful-security-service')\n ],\n text: 'OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'\n ),\n extension: [\n FHIR::Extension.new(\n url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',\n extension: [\n FHIR::Extension.new(url: 'token', valueUri: \"#{root_url}oauth/token\"),\n FHIR::Extension.new(url: 'authorize', valueUri: \"#{root_url}oauth/authorize\"),\n FHIR::Extension.new(url: 'introspect', valueUri: \"#{root_url}oauth/introspect\"),\n FHIR::Extension.new(url: 'revoke', valueUri: \"#{root_url}oauth/revoke\")\n ]\n )\n ]\n ),\n resource: [\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Patient',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'family', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'given', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'telecom', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'email', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'active', type: 'boolean'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'RelatedPerson',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'patient', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Immunization',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'patient', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Observation',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'QuestionnaireResponse',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Provenance',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'patient', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n )\n ]\n )\n )\n status_ok(resource) && return\n end", "title": "" }, { "docid": "f405228d764fc61db6f0423c45792431", "score": "0.45894003", "text": "def list\n deprecation_warning\n api.get('')\n end", "title": "" }, { "docid": "2200fdc894248e9c7b1a6a637b840e32", "score": "0.45872012", "text": "def capability_statement\n resource = FHIR::CapabilityStatement.new(\n status: 'active',\n kind: 'instance',\n date: DateTime.parse('2021-04-01').strftime('%FT%T%:z'),\n software: FHIR::CapabilityStatement::Software.new(\n name: 'Sara Alert',\n version: ADMIN_OPTIONS['version']\n ),\n implementation: FHIR::CapabilityStatement::Implementation.new(\n description: 'Sara Alert API'\n ),\n fhirVersion: '4.0.1',\n format: %w[json],\n rest: FHIR::CapabilityStatement::Rest.new(\n mode: 'server',\n security: FHIR::CapabilityStatement::Rest::Security.new(\n cors: true,\n service: FHIR::CodeableConcept.new(\n coding: [\n FHIR::Coding.new(code: 'SMART-on-FHIR', system: 'http://hl7.org/fhir/restful-security-service')\n ],\n text: 'OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'\n ),\n extension: [\n FHIR::Extension.new(\n url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',\n extension: [\n FHIR::Extension.new(url: 'token', valueUri: \"#{root_url}oauth/token\"),\n FHIR::Extension.new(url: 'authorize', valueUri: \"#{root_url}oauth/authorize\"),\n FHIR::Extension.new(url: 'introspect', valueUri: \"#{root_url}oauth/introspect\"),\n FHIR::Extension.new(url: 'revoke', valueUri: \"#{root_url}oauth/revoke\")\n ]\n )\n ]\n ),\n resource: [\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Patient',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'family', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'given', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'telecom', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'email', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'active', type: 'boolean'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'RelatedPerson',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'patient', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Immunization',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'patch'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'patient', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Observation',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'QuestionnaireResponse',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n )\n ]\n )\n )\n status_ok(resource) && return\n end", "title": "" }, { "docid": "ddbcf3025ad6f53c1b6b62e5ba3a4550", "score": "0.45698887", "text": "def index\n @academy_workshop_registrations = Academy::WorkshopRegistration.all\n end", "title": "" }, { "docid": "5ce2c87ca195745ced048aa0717ad9d4", "score": "0.45649502", "text": "def get_registrations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registrations ...'\n end\n # resource path\n local_var_path = '/registrations'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'learnerId'] = opts[:'learner_id'] if !opts[:'learner_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeChildResults'] = opts[:'include_child_results'] if !opts[:'include_child_results'].nil?\n query_params[:'includeInteractionsAndObjectives'] = opts[:'include_interactions_and_objectives'] if !opts[:'include_interactions_and_objectives'].nil?\n query_params[:'includeRuntime'] = opts[:'include_runtime'] if !opts[:'include_runtime'].nil?\n query_params[:'includeTotalCount'] = opts[:'include_total_count'] if !opts[:'include_total_count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'RegistrationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b9d68b17f900a4d7a615fe6526df1964", "score": "0.45572218", "text": "def index\n @registrations = @course.registrations.all\n end", "title": "" }, { "docid": "bcc753090a4245670d903677ce054ff9", "score": "0.4553794", "text": "def get_registrations\n end", "title": "" }, { "docid": "d59ce4331379042cd253e3146412d56e", "score": "0.4544464", "text": "def capability_statement\n resource = FHIR::CapabilityStatement.new(\n status: 'active',\n kind: 'instance',\n date: DateTime.parse('2020-05-28').strftime('%FT%T%:z'),\n software: FHIR::CapabilityStatement::Software.new(\n name: ADMIN_OPTIONS['app_name'],\n version: ADMIN_OPTIONS['version']\n ),\n implementation: FHIR::CapabilityStatement::Implementation.new(\n description: \"#{ADMIN_OPTIONS['app_name']} API\"\n ),\n fhirVersion: '4.0.1',\n format: %w[json],\n rest: FHIR::CapabilityStatement::Rest.new(\n mode: 'server',\n security: FHIR::CapabilityStatement::Rest::Security.new(\n cors: true,\n service: FHIR::CodeableConcept.new(\n coding: [\n FHIR::Coding.new(code: 'SMART-on-FHIR', system: 'http://hl7.org/fhir/restful-security-service')\n ],\n text: 'OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'\n ),\n extension: [\n FHIR::Extension.new(\n url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',\n extension: [\n FHIR::Extension.new(url: 'token', valueUri: \"#{root_url}oauth/token\"),\n FHIR::Extension.new(url: 'authorize', valueUri: \"#{root_url}oauth/authorize\"),\n FHIR::Extension.new(url: 'introspect', valueUri: \"#{root_url}oauth/introspect\"),\n FHIR::Extension.new(url: 'revoke', valueUri: \"#{root_url}oauth/revoke\")\n ]\n )\n ]\n ),\n resource: [\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Patient',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'update'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'create'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'family', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'given', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'telecom', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'email', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'active', type: 'boolean'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'Observation',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n ),\n FHIR::CapabilityStatement::Rest::Resource.new(\n type: 'QuestionnaireResponse',\n interaction: [\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'read'),\n FHIR::CapabilityStatement::Rest::Resource::Interaction.new(code: 'search-type')\n ],\n searchParam: [\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: 'subject', type: 'reference'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_id', type: 'string'),\n FHIR::CapabilityStatement::Rest::Resource::SearchParam.new(name: '_count', type: 'string')\n ]\n )\n ]\n )\n )\n status_ok(resource) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end", "title": "" }, { "docid": "2036f91622445bf2f24767d13b859c43", "score": "0.45402312", "text": "def xmlrpc\n api\n end", "title": "" }, { "docid": "b21b01559960aaaf25b27d8a4e3d83cf", "score": "0.45371798", "text": "def show\n registration = Registration.find(params[:id])\n invoices = Invoice.where(registration_id: params[:id])\n render json: { status: '200', message: \"Loaded Registration with id #{params[:id]}\", data: registration, invoices: invoices }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Registration with id #{params[:id]}\", data: registration }, status: :not_found\n end", "title": "" }, { "docid": "3e93d15933cd7bea175b57534d5f4d7c", "score": "0.45342362", "text": "def index\n @api_resources = ApiResource.all\n end", "title": "" }, { "docid": "8feb651e54465be7988e03342887cbbc", "score": "0.4534039", "text": "def xapi\n @xapi ||= begin\n verify = XenBackup.configuration.ssl_validate ? :verify_peer : :verify_none\n session = XenApi::Client.new(\n XenBackup.configuration.uri,\n XenBackup.configuration.timeout,\n verify)\n session.login_with_password(\n XenBackup.configuration.user,\n XenBackup.configuration.pass)\n session\n end\n end", "title": "" }, { "docid": "ca0c2801f7a40cdcf6b87e9d50ead7bf", "score": "0.45340213", "text": "def index\n @registers = Register.all\n\n \n end", "title": "" }, { "docid": "b57326545685b8d686384aed6418c82b", "score": "0.45282626", "text": "def get_registrations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registrations ...'\n end\n # resource path\n local_var_path = '/registrations'\n\n # query parameters\n query_params = {}\n query_params[:'courseId'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n query_params[:'learnerId'] = opts[:'learner_id'] if !opts[:'learner_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeChildResults'] = opts[:'include_child_results'] if !opts[:'include_child_results'].nil?\n query_params[:'includeInteractionsAndObjectives'] = opts[:'include_interactions_and_objectives'] if !opts[:'include_interactions_and_objectives'].nil?\n query_params[:'includeRuntime'] = opts[:'include_runtime'] if !opts[:'include_runtime'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # 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 = ['APP_NORMAL', 'OAUTH']\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 => 'RegistrationListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RegistrationApi#get_registrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e745439e26e565168702faec87d6fb66", "score": "0.4517663", "text": "def index\n @regs = Reg.all\n end", "title": "" }, { "docid": "e745439e26e565168702faec87d6fb66", "score": "0.4517663", "text": "def index\n @regs = Reg.all\n end", "title": "" }, { "docid": "90504ada945e266df6977942b45d9443", "score": "0.45167005", "text": "def index\n @source_apis = SourceApi.all\n end", "title": "" }, { "docid": "bf8472113a0fb65f064f859fd952eccc", "score": "0.45134643", "text": "def index\n @u2_f_registrations = U2FRegistration.all\n end", "title": "" }, { "docid": "442d7a57bbc6842461b484a8b15b8338", "score": "0.45094588", "text": "def show\n\t\t@ptaxregistration = Ptaxregistration.find(params[:id])\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @ptaxregistrations }\t\t#Render to XML File\n\t\tend\n\tend", "title": "" }, { "docid": "a97f263e7861b3aad8f4b328b8241126", "score": "0.4508125", "text": "def index\n @registration_head2s = RegistrationHead2.all\n end", "title": "" }, { "docid": "3249ca3aa8db818b6914aaec8d41cc55", "score": "0.45060977", "text": "def registrations\n software_registrations + hardware_registrations\n end", "title": "" }, { "docid": "cbaf0d1ef37d10264e462bd387f9e968", "score": "0.4505214", "text": "def instrument_get_indices(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: InstrumentApi#instrument_get_indices ...\"\n end\n \n # resource path\n path = \"/instrument/indices\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Instrument>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: InstrumentApi#instrument_get_indices. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "bb6d60c792a99068865d54f3b967913d", "score": "0.44919965", "text": "def index\n @test_registrations = TestRegistration.all\n end", "title": "" }, { "docid": "674ce1621a9d68a273735e0f5366b778", "score": "0.44815513", "text": "def index\n @api_keys = ApiKey.all\n end", "title": "" }, { "docid": "674ce1621a9d68a273735e0f5366b778", "score": "0.44815513", "text": "def index\n @api_keys = ApiKey.all\n end", "title": "" }, { "docid": "674ce1621a9d68a273735e0f5366b778", "score": "0.44815513", "text": "def index\n @api_keys = ApiKey.all\n end", "title": "" }, { "docid": "8428012a9d4fa40ed3994068475985bb", "score": "0.4481345", "text": "def index\n @regattas = apply_scopes(Regatta).all\n end", "title": "" }, { "docid": "8be887af9fb2c9f183a9302683552349", "score": "0.44794932", "text": "def index\n @api_users = ApiUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @api_users }\n end\n end", "title": "" }, { "docid": "cda04cb108eaca92fbb8f7934a520f39", "score": "0.4478356", "text": "def index\n #puts params\n response = get_gringotts_resources(RESOURCE, build_search_params(query_params))\n #logger.info \"response: #{response.body}\"\n if response.success?\n @conditions = Fhir::Condition.parse_ehmbr_list(response.body)\n else\n send_operation_outcome(response)\n end\n end", "title": "" }, { "docid": "3b02417f08ad59c5faa8bcb6e7d25f4a", "score": "0.4477831", "text": "def index\n do_authorize_class\n\n @responses, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.responses(current_user, study_id: params[:study_id]),\n Response,\n Response.filter_settings\n )\n respond_index(opts)\n end", "title": "" }, { "docid": "5eeca007894a63dcf5b7a7bf545bdfff", "score": "0.44759756", "text": "def index\n @campaign_registrations = CampaignRegistration.all\n end", "title": "" }, { "docid": "e454b96dfa1e1c247605f3ef87f33f51", "score": "0.4464375", "text": "def registers\n command('-data-list-register-names').\n results[:register_names].\n map { |reg| reg.empty? ? nil : reg.to_sym }\n end", "title": "" }, { "docid": "da4a0caec79d6c5ddcbbe141d7135bb2", "score": "0.44628632", "text": "def registrations; end", "title": "" }, { "docid": "da4a0caec79d6c5ddcbbe141d7135bb2", "score": "0.44628632", "text": "def registrations; end", "title": "" }, { "docid": "da4a0caec79d6c5ddcbbe141d7135bb2", "score": "0.44628632", "text": "def registrations; end", "title": "" }, { "docid": "28d30116dd7bf3732f0e465cb4460a7c", "score": "0.44590575", "text": "def index\n @registration_periods = RegistrationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "d9667abc489aeb5b3cbbda46f0d24c70", "score": "0.4458012", "text": "def integrations\n # Register all namespaced integrations\n @integrations\n end", "title": "" }, { "docid": "7db4b17d21e1265b843de06031684a3e", "score": "0.445159", "text": "def instrument_get_active(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: InstrumentApi#instrument_get_active ...\"\n end\n \n # resource path\n path = \"/instrument/active\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Instrument>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: InstrumentApi#instrument_get_active. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "82ffd3e0671164a2beab1fa68f1ba57f", "score": "0.44488722", "text": "def list\n url = @uri + \"?api-version=#{api_version}\"\n url\n end", "title": "" }, { "docid": "e7fe06c1d0d5178ae990f4066d1c36c6", "score": "0.44443494", "text": "def team_registrations_all\n @team_registrations = TeamRegistration.all(:conditions => \"event_id = #{params['event_id']}\")\n @report_type = 'all'\n team_registrations\n end", "title": "" }, { "docid": "76e453787cf89de974b1de6156dae5cb", "score": "0.44441965", "text": "def index\n @regist_1s = Regist1.all\n end", "title": "" }, { "docid": "27a7a2e61b4603a2ee23104a515dca7e", "score": "0.44424003", "text": "def index\n @api_resources = ApiResource.where(user: current_user) if !current_user.admin\n @api_resources = ApiResource.all if current_user.admin\n end", "title": "" }, { "docid": "f2b5d7851f5e58a0b0ae9cef4574e040", "score": "0.4441926", "text": "def registrants\n @registrants ||= StudentRegistrationCourse.find(:all, \n :conditions => [\"regis_yr = ? AND regis_qtr = ? AND sln = ? AND \n (request_status = 'A' OR request_status = 'C' OR request_status = 'R')\",\n ts_year, ts_quarter, sln],\n :include => { :student_record => { \n :student_person => {\n :service_learning_placements => :evaluation \n }\n }\n },\n :joins => :student_record,\n :order => \"student_name\" )\n end", "title": "" }, { "docid": "c5b7d43f6e766d249090dd3f416d70c4", "score": "0.44306034", "text": "def index\n @appexts = Appext.all\n end", "title": "" }, { "docid": "163c3f47bb0b4e94debe5e31d41e34c0", "score": "0.44266123", "text": "def get_statements\n if self.chargify_customer_id.blank? || Rails.env == \"test\"\n []\n else\n chargify_subscription = Chargify::Subscription.find_by_customer_reference(self.id)\n chargify_subscription.statements\n end\n end", "title": "" }, { "docid": "ee0f56496d068df917d24e980cb68988", "score": "0.44239253", "text": "def registrations\n @registrations ||= []\n end", "title": "" } ]
3c34c5097ef215e4394a21ae8f243f22
Creates new user, starting credit set to 0
[ { "docid": "e581626145d558526978a21d591effa1", "score": "0.0", "text": "def create\n @user = User.new(user_params)\n if (@user.isFilled(session)) # Checks if the form was filled. If not it adds an error message \n User.all.each do | sel | # This checks every other user in the user-verse\n if @user.email == sel.email # This checks if this new (not yet saved) user's email matches an existing user's email\n addErrorMessage(session, \"That email is already taken!\") # This says yeeeeet (correct error message)\n @user.delete # Gets rid of the lame user account\n redirect_to signup_path # redirects \n end\n end\n @user.credit = 0\n @user.save # Adds the new user to the databse\n clearErrorMessage(session) # Safety check, keeps session errors empty\n set_current_user(session, @user) # sets the current session \n redirect_to user_path(@user) # send to the user show page\n else\n addErrorMessage(session, \"Please Fill all Fields\") #Adds the correct error message\n redirect_to signup_path # Sends back to signin, this time with session[:errors] occupied\n end\n end", "title": "" } ]
[ { "docid": "f09b18f59fb4fc7c830846175351d062", "score": "0.76850396", "text": "def create_new_user\n begin\n # Creates hash of the password enetered by the user\n password = Utility.encrypt_password(@password)\n # Insert a new entry in the database for a user\n @client.query(\"\n INSERT INTO Users (username,first_name,last_name,created_at,updated_at,password)\n VALUES ('#{@username}','','','#{Utility.get_timestamp}','#{Utility.get_timestamp}','#{password}')\")\n \n @prompt.ok(\"Account created sucessfully.\")\n sleep 1\n @prompt.ok(\"Please login to your account => \")\n login\n rescue => exception\n @prompt.error(\"Invalid username enter a new one.\")\n signup\n end\n end", "title": "" }, { "docid": "f69982fb5b67a57163146303a9d7ccb8", "score": "0.7506939", "text": "def new_user(user_name, first, last, password, quota=nil)\n set_values suspended: 'false', username: user_name, password: password, first_name: first, last_name: last, quota: quota\n \t\tend", "title": "" }, { "docid": "c9eaf6165bfb30c96c35a195eee07ba4", "score": "0.7411401", "text": "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n @user.credit = 10;\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec9c812c1e03febd0d6c5617e738c688", "score": "0.74050087", "text": "def create_new_user \n User.create(sign_up_prompt)\n end", "title": "" }, { "docid": "d9c718f0d0eb279cc966253a966eb15c", "score": "0.7371163", "text": "def create_user_account\n user = User.new do |u|\n u.email = email\n u.password = customer_number\n u.save\n end\n\n end", "title": "" }, { "docid": "5e4ea00b9a24c337f89b0ecb43e457c7", "score": "0.73280036", "text": "def create_user\n userName = $prompt.ask(\"Please enter a username: \", default: ENV['USER'])\n while !User.all.find_by(userName: userName).nil? \n puts \"Sorry, this user already exists!\"\n userName = $prompt.ask(\"Please try again with a new username: \", default: ENV['USER'])\n end \n currency = get_currency(\"account\")\n password = $prompt.mask(\"Please enter a password: \")\n new_user = User.new(userName: userName, currency: currency)\n new_user.password = password\n new_user.save #store it to the database\n new_user \n end", "title": "" }, { "docid": "9dd1d9897fcebb3b7868416c13c228cb", "score": "0.7303885", "text": "def create_user\n u = get_console_string(\"Username:\")\n p = get_console_string(\"Password:\")\n n = get_console_string(\"Name:\")\n l = get_console_string(\"Lastname:\")\n \n usr = @um.add_user(u,p,n,l)\n\n if usr == nil\n puts \"Error: User already exists\";\n return -1;\n end\n print \"Successfuly created User: \"\n puts usr.username\n return 0;\n end", "title": "" }, { "docid": "0e06c4f1c493579a2be7d89179c370e0", "score": "0.729811", "text": "def create\n @user = User.new(user_parames)\n if User.last\n @user.number = User.last_active.number\n else\n @user.number = 0\n end\n @user.status = 1\n unless @first_user.present?\n @user.privilegio = 7\n end\n if @user.save\n Notificacion.bienvenida(@user).deliver\n flash[:notice] = \"User created correctly.\" \n redirect_to admins_path\n else\n flash[:notice] = \"Wrong data or less password to 8 characters.\"\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "d47bac6ae73148c6fa6a473078f6ebbd", "score": "0.72971237", "text": "def create_new_user\n\t\t@user = User.new(params.require(:user).permit(:username, :password, :email))\n\n @user.lastEntryTime = 0 # 1970 January 1st 00:00:00\n @user.defaultCity = \"Vancouver\"\n @user.defaultSleep = 8.0\n @user.defaultExercise = 0.5\n\n\t\tif @user.save\n\t\t\tlog_in(@user)\n\t \tredirect_to(\"/welcome/index\")\n\t\telse\n\t\t render 'registration'\n\t\tend\n end", "title": "" }, { "docid": "aa839393cbeb9ce85efd2c2139195904", "score": "0.7283214", "text": "def create\n Puppet.info \"cobbler_digest_user: updating user: #{@resource[:name]}\"\n rm_user\n create_user\n end", "title": "" }, { "docid": "60b5c6bec2dcf039ef1ec30b4cd29418", "score": "0.7241103", "text": "def create\n\n @user = User.new params[:user]\n\n if @user.save\n load_user @user\n flash[:notice] = \"Congratulations, your Heritage Cookbook account has been created!\"\n \n # Once user is saved, `password` and `password_confirmation` must be cleared.\n # By default, `password` is automatically cleared after save but not `password_confirmation`.\n @user.password_confirmation = nil\n\n # Send an email to the user with its credentials.\n AccountMailer.delay.signup_details(@user, login_url)\n\n # Put the user on the proper plan and ask for payment if needed.\n is_payment_needed = @user.switch_to_plan params[:user][:plan_id]\n if is_payment_needed\n redirect_to upgrade_account_path(@user, plan_id: params[:user][:plan_id])\n else\n redirect_to root_path\n end\n else\n render :new\n end\n end", "title": "" }, { "docid": "23910255ca68bad93a081a1664fc67a0", "score": "0.72403383", "text": "def create\n params[:current_user_id] = current_user.id\n @user_process = UserProcess.new(params)\n @user = @user_process.setup\n @user.create_account(name: @user.display_name)\n redirect_to @user_process.redirect_path, notice: \"New user successfully created.\"\n end", "title": "" }, { "docid": "c7bfb4edcfadef0dac0bc1cc4b09c71a", "score": "0.7183063", "text": "def create_user(data)\n data[:id] = @next_user_id\n @next_user_id += 1\n @users[data[:id]] = data\n build_user(data)\n end", "title": "" }, { "docid": "082711b10962b74826b3527a26e389bb", "score": "0.7129196", "text": "def create\n @user = User.new(\n name: params[:name],\n contact: params[:contact],\n address: params[:address],\n password: params[:password],\n number_of_products: 0,\n wallet: 5000\n )\n if @user.save\n session[:user_id] = @user.id\n redirect_to(\"/users/dashboard\")\n else\n render(\"/users/new\")\n end\n end", "title": "" }, { "docid": "016ca08b321b354882eb156c480c34fc", "score": "0.71030825", "text": "def create\n @user = current_user.organization.users.new(params[:user])\n if @user.save\n $statsd.increment 'user.created'\n flash[:notice] = 'User was successfully created.'\n else\n flash[:error] = 'User was not successfully created.'\n end\n \n redirect_to :back\n end", "title": "" }, { "docid": "3af20cc3cd622c7f1e055a351d935538", "score": "0.7087236", "text": "def new_user\n system \"clear\"\n @prompt.say(\"I needz more info\")\n @user = @prompt.collect do\n key(:name).ask('ENTER YOUR NAME?')\n key(:email).ask('ENTER YOUR EMAIL?')\n end\n\n ## this was fun... saving the new creation of user allowed me to create a new\n ## user, then purchase new items without having to go back and log new user in\n @user= User.create(@user)\n main_menu()\n end", "title": "" }, { "docid": "e0d39488974e6dd054bf2bda9d444f12", "score": "0.7082597", "text": "def create_user user\n begin\n customers = @openpay.create(:customers)\n customer_hash = {\n #external_id: user.id,\n name: user.first_name,\n last_name: user.last_name,\n email: user.email,\n requires_account: true,\n }\n result_hash = customers.create(customer_hash)\n if result_hash[\"error_code\"]\n raise result_hash[\"error_code\"] \n else\n return result_hash[\"id\"]\n end\n rescue Exception => e\n raise \"Error creando usuario en Openpay - #{e.message}\"\n end\n end", "title": "" }, { "docid": "ea8a717613a8a40d2ff8ba139a978402", "score": "0.70637816", "text": "def create(user_info)\n # TODO Enter workflow to create a new user in the OLE system.\n save_user(user_info) if user_info[:save?]\n end", "title": "" }, { "docid": "13aa81215b0c28cd7a10e2f8c5fdf275", "score": "0.7051101", "text": "def create_user\n username = @@prompt.ask(\"Please Enter Your Desired Username: \", active_color: :magenta)\n password = @@prompt.ask(\"Please Enter Your Desired Password: \", active_color: :magenta)\n User.create(username: username, password: password)\n end", "title": "" }, { "docid": "26a741f7ba312bd82e1a99c24d4eae5d", "score": "0.7047742", "text": "def create_user\n puts \"What is your name?\"\n @name = gets.chomp.to_s\n puts \"Where are you going?\"\n @destination = gets.chomp.to_s.capitalize\n puts \"What is the duration of your trip?\"\n @duration = gets.chomp.to_i\n \n @user = User.new(name, destination, duration)\n \n end", "title": "" }, { "docid": "9a226014dd8ca228223844e2a725bf9d", "score": "0.70441663", "text": "def create\n @user = User.new(params[:user])\n # Saving without session maintenance to skip\n # auto-login which can't happen here because\n # the User has not yet been activated\n # Check to see if the user's email ended in .edu\n # If not, they're just a regular user who needs to pay\n # ;)\n if ( params[:user][:email][-4,4] == \".edu\" )\n @user.is_student = true\n end\n respond_to do |format|\n if @user.save\n @init_credits = Credit.new({:user_id => @user.id})\n @init_credits.save\n UserMailer.activation_email(@user).deliver\n flash[:notice] = \"Your account has been created. An e-mail has been sent to: \" + @user.email.to_s + \". Please check your e-mail for your account activation instructions!\"\n format.html { redirect_to(:controller => :home) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8da5d6ef48570a0d83c0d1ed3650399d", "score": "0.7042982", "text": "def create\n @user = User.new(\n :firstname=> params[:firstname], \n :lastname=> params[:lastname], \n :email => params[:email], \n :password => params[:password]\n )\n @user.points = 0\n \n @user.save do |result|\n if result\n \n flash[:notice] = \"Your account has been created. Please check your e-mail for your account activation instructions!\"\n \n #If user signs up with twitter/facebook/linked_in\n #skip sending email and go to 'users/:id' page\n if @user.authenticated_with.empty?\n @user.deliver_activation_instructions!\t\n redirect_to actions_url and return\n else\n session[:current_user] = @user\n # seesion = UserSession.find\n # puts seesion\n # puts seesion.record\n # puts result\n redirect_to user_path(@user) and return\n end\n\n redirect_to actions_url and return\n else\n redirect_to actions_url and return\n end\n end\n end", "title": "" }, { "docid": "2bcd73e6196939ec104578f848f833f2", "score": "0.7039979", "text": "def test_new_user\n \n resultBob = User.newUser(\"Bob\", \"secure\", 0, 0);\n\n assert_equal true, resultBob\n\n resultBill = User.newUser(\"Bill\", \"password\", 1, 0)\n\n assert_equal true, resultBill\n\n end", "title": "" }, { "docid": "5f59e2258f2fe0b25ca95ca803465bae", "score": "0.7037247", "text": "def create_new_user(user)\n logger.info \"Creating user '#{user.name}'\"\n click_element admin_users_link\n click_create_new_button\n\n wait_for_element_and_type(email_field_locator, user.username)\n wait_for_element_and_type(username_field_locator, user.name)\n element(password_field_locator).send_keys user.password\n # Entering text in the password confirmation field is a bit flaky, so retry if it doesn't stick\n tries = 2\n begin\n tries -= 1\n element(confirm_password_field_locator).send_keys user.password\n hit_tab\n wait_until(Config.short_wait) { !element_value(confirm_password_field_locator).empty? }\n rescue => e\n logger.error e.message\n tries.zero? ? fail : retry\n end\n\n user.roles.each { |role| wait_for_element_and_click role_locator(role.name) }\n\n logger.debug \"BENCHMARK ACTION - saving a new user\"\n save_record\n end", "title": "" }, { "docid": "1dfc4f7e3f74cf409cd2afcc94c2c14f", "score": "0.7025702", "text": "def create\n\t\tauthorize! :create, User\n\t\t@user = User.new(params[:user])\n\t\[email protected]_confirmation!\n\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Created user '#{params[:user][:username]}(\\##{@user.id})'\"\n\t\t\tredirect_to :action => :index\n\t\telse\n\t\t\trender :action => :new, :status => :unprocessable_entity\n\t\tend\n\tend", "title": "" }, { "docid": "1d67c1a32554df04c28174e219218f3b", "score": "0.7025268", "text": "def new_user\n save_user data\n update_users\n end", "title": "" }, { "docid": "750c350628ed72096dda6d18acffcc86", "score": "0.7024425", "text": "def create_user(params = {})\n defaults = {:name => \"test user #{get_id}\", :email => \"test_user#{get_id}@railer.im\", :company_name => \"co test\", :public_repo_count => 1, :blog => 'http://blog.user.com', :github_id => 'repo-1212', :public_gist_count => 1, :login => \"test_user_#{get_id}\", :password => 'testing_password_123', :password_confirmation => 'testing_password_123' }.merge(params)\n setup_octopi_user(defaults[:login], defaults[:email])\n user = User.create!(defaults)\n user.activate!\n user\n end", "title": "" }, { "docid": "1b1e7534ffd5a2a6d2a408c830334781", "score": "0.7021251", "text": "def new_user\n u = User.new\n u.create(get_next_id)\n @db << u\n save_db\n @signed_in = true\n\n return u #User should be signed in after creation\n end", "title": "" }, { "docid": "70f76f66576bc9212995c41f9c8911f4", "score": "0.7017959", "text": "def signup\n enterCredentials\n create_new_user\n end", "title": "" }, { "docid": "49615cb2c4ff65c1b8a8a10da4a31cb0", "score": "0.7012552", "text": "def create_user_account\n user = User.new do |u|\n u.first_name = first_name\n u.last_name = last_name\n u.username = employee_number\n u.employee_id = id\n u.password = employee_number\n u.role = 'Employee'\n u.email = email\n if User.current\n u.general_setting_id = User.current.general_setting.id\n else\n u.general_setting_id = 1\n end\n end\n user.save\n end", "title": "" }, { "docid": "c39938317b7525630cbdb5803745b49c", "score": "0.70097554", "text": "def create_user\n user = User.find_by(username: self.username)\n if !user\n user = User.new(username: self.username, name: self.student_name)\n user.password = self.password\n user.save\n end\n user\n end", "title": "" }, { "docid": "62358ea1e489ff762a6c4e04cf5b8f63", "score": "0.6990975", "text": "def create_user(params)\n user = new_user(params)\n user.save\n user\n end", "title": "" }, { "docid": "1d68551abf8002d47d22ccc90eea21f2", "score": "0.69843924", "text": "def create\n\n @user = User.new(user_params)\n\n premUser = PremiumUser.find_by_name(@user.name)\n if premUser\n @user.premiumoverride = true\n premUser.destroy!\n end\n\n # newuid = 0\n # for user in User.all\n # if Integer(user.userid) > newuid\n # newuid = Integer(user.userid)\n # end\n # end\n @user.projectids = \"\"\n @user.name = @user.name.downcase\n # @user.userid = String(newuid + 1)\n respond_to do |format|\n if @user.save\n Thread.new do\n params = {\n :name => @user.name,\n :password => user_params[:password]\n }\n UserMailer.welcome_email(@user).deliver\n ActiveRecord::Base.connection.close\n end\n session[:userid] = @user.id\n format.html { redirect_to tour_path }\n format.json { render action: 'show', status: :created, location: @user }\n else\n flash[:error] = \"The account could not be created\"\n format.html { render action: 'new', error: \"The account could not be created\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1addb872e3e0f574d615770650536ae", "score": "0.6961764", "text": "def create_user(user)\n create_user_database(user)\n end", "title": "" }, { "docid": "13536846b9590ea1c840b6acad72e6bc", "score": "0.69446", "text": "def new_test_user\n @user = User.new(id: 999,\n name: \"User Example\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\",\n admin: false)\n end", "title": "" }, { "docid": "030390f947d1545eff929e4457e11df8", "score": "0.693779", "text": "def new_user(args = {})\n tu = DismalTony::UserIdentity.new(user_data: args)\n commit_user(serialize_out(tu))\n tu\n end", "title": "" }, { "docid": "a85e0e81ff450d579f8f077440883925", "score": "0.69343513", "text": "def create\n logger.debug '> Users: create.'\n Api::Accounts.new.create(params) do |acct|\n store_credentials acct\n mail_status = UserMailer.welcome(acct).deliver_now\n Nilavu::OTP::Infobip.new.send_confirm(\"#{params['phone']}\", \"#{params['email']}\") if Ind.notification.has_key?(\"infobip\")\n if mail_status\n toast_success(cockpits_path, \"Click <b>marketplaces</b> to get started\")\n else\n toast_warn(cockpits_path, \"Click <b>marketplaces<b> to get started\")\n end\n end\n end", "title": "" }, { "docid": "3047e38aec06022d2f03f0e366509671", "score": "0.6929519", "text": "def create\n\n @user = User.new(user_params)\n if @user.balance.nil?\n @user.balance=0\n end\n\n if @user.is_client.nil?\n @user.is_client = true\n end\n\n # puts(\"\\n\\n\\n\\n\\n\\n\\n\\nWAAAAA\\n\\n\\n\\n\\n\\n\\n\\n\")\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a1dc4ec775152b4269878e4be8c2056", "score": "0.69289124", "text": "def create_user(username, password, bio)\n \n # if existing_user != []\n # puts \"Sorry, That Username Is Not Available! 😅\".colorize(:red)\n \n # else \n new_user = User.create(name: \"#{username}\", password: \"#{password}\", bio: \"#{bio}\")\n puts \"Congrats, You Just Created A New Account! 🥳\"\n new_user\n end", "title": "" }, { "docid": "f5895a4180d38edc6673cedcb60829a7", "score": "0.69287974", "text": "def create_user_account\n user = User.new do |u|\n u.first_name = first_name\n u.last_name = last_name\n u.username = email\n u.student_id = student.id\n u.password = 'P' + student.admission_no\n u.role = 'Parent'\n u.email = email\n u.general_setting_id = User.current.general_setting.id\n end\n user.save\n p user.errors\n end", "title": "" }, { "docid": "c08e0b803c9d3e186197023f26f50726", "score": "0.69166857", "text": "def test_new_user_creation\n\t\tUser.create(@@user_details['name'], @@user_details['email'], @@user_details['credit_limit'])\n\t\tquery = \"select email, credit_limit from user where name=\\\"#{@@user_details['name']}\\\";\"\n\t\tresult = EntityHelper.execute_command(query)\n\t\tassert_equal(result[0][1], 400)\n\t\tassert_equal(result[0][0], '[email protected]')\n\tend", "title": "" }, { "docid": "0baf55eba3d491e8d4c3cceb3ca09a5d", "score": "0.6916448", "text": "def create\n\t\t@user = User.new()\n\t\t\n\tend", "title": "" }, { "docid": "f10974fa488bc027a477b5e424987bec", "score": "0.6899245", "text": "def create\n @user = User.new(params[:user])\n\n\t_save\n end", "title": "" }, { "docid": "657636636fd8bdbaa51b44c3e9f6c427", "score": "0.68978995", "text": "def create\n\t\t#create new_user variable using User.new (not user create)... to ensure a save based on validations\n\t\t@new_user = User.new(\n\t\t\t:name => params[:name],\n :email => params[:email],\n :password => params[:password],\n :password_confirmation => [:password_confirmation]\n\t\t)\n\n\t\tif @new_user.save\n\t\t\tredirect_to(root_path)\n\n\t\telse\n\t\t\tflash[:error] = 'You made an error. Do it again'\n\t\t\trender :new\n\t\t\t#there is another command here I can use...\n\t\tend\n\n\n\tend", "title": "" }, { "docid": "d50fdfb3e42ed536425d34bf5a70949b", "score": "0.68971086", "text": "def create_user(user_name)\n\n user = User.new \n user.name = user_name \n user.save\n\n end", "title": "" }, { "docid": "4a3d6b1a220b8886bd6802daba8af388", "score": "0.6879369", "text": "def call(user_info:)\n result = User.transaction(requires_new: true) do\n create_user(user_info)\n end\n\n response.success = true if result == :success\n response\n end", "title": "" }, { "docid": "8b8422f62483510f99e4ba7736946420", "score": "0.687252", "text": "def createUser(username, password, first_name, last_name)\r\n\tuser = User.new\r\n\tuser.username = username\r\n\tuser.password = Digest::MD5.hexdigest(password)\r\n\tuser.first_name = first_name\r\n\tuser.last_name = last_name\r\n user.image = 'http://www.corporatetraveller.ca/assets/images/profile-placeholder.gif'\r\n\tuser.save\r\n\treturn 1\r\nend", "title": "" }, { "docid": "61dfd68b3f31b3789e584d0dcb572d55", "score": "0.6867359", "text": "def create\n @user = User.new(params[:user])\n @user.identity = 1\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_main_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c83d6499ec2e8e200c7b9ab4204e4e66", "score": "0.6865963", "text": "def create\n @user = User.new(user_params)\n @user.wins = 0\n @user.losses = 0\n @user.ties = 0\n respond_to do |format|\n if @user.save\n format.html {\n redirect_to new_credential_path,\n notice: 'You have successfully registered!'\n }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "097640a47a4b5a687eb58bd70b319091", "score": "0.6863653", "text": "def assign_initial_credit\n admin = User.admins.last ||\n User.create(\n email: '[email protected]',\n is_admin: true,\n password: rand(36**11).to_s(36).upcase[0, 8]\n )\n\n Transaction.create(sender: admin, recipient: self, num_credits: 100)\n end", "title": "" }, { "docid": "c28283a6b49d0c391226f21b182eb5f3", "score": "0.68584836", "text": "def create\n @user = User.new(user_params)\n\n if @user.save\n flash[:success] = \"User account created\"\n redirect_to @user\n else\n redirect_to new_user_path\n end\n end", "title": "" }, { "docid": "72589ad717069dde25860187531948af", "score": "0.68394876", "text": "def create_user_account\n user = User.new do |u|\n u.email = email\n u.employee_id = id \n u.password = employee_number\n u.role = 'Employee'\n u.general_setting_id = if User.current\n User.current.general_setting_id\n else\n 1\n end\n end\n user.save\n end", "title": "" }, { "docid": "53d777c1b343e769075ec5db54fb83ba", "score": "0.6839041", "text": "def create\n @user = User.new(user_params)\n @user.funds = 0\n if @user.save\n if !logged_in?\n session[:user_id] = @user.id\n redirect_to home_path, notice: \"Welcome, #{@user.first_name}. Thank you for signing up!\"\n end\n else\n flash[:error] = \"This user could not be created.\"\n render \"new\"\n end\n end", "title": "" }, { "docid": "92218cbe5d3d9dd33355ad7b2b4af720", "score": "0.68302655", "text": "def user_add\n \n @user = User.new\n \n end", "title": "" }, { "docid": "9c12bb9526ff89d48557a9b20431b540", "score": "0.6821939", "text": "def create\n @user = User.new\n cu = current_user\n\n # If the current user has permissions to sell tickets but not any more than the created user must be a student\n if cu.has_permission?(:users)\n @user.accessible = :all\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to [:admin, @user], :notice => \"User was successfully created.\" }\n else\n flash[:error] = \"User was not created.\"\n format.html { render active_admin_template(:new) }\n end\n end\n end", "title": "" }, { "docid": "058e832fc36f35139eef7e65c51415c4", "score": "0.6819316", "text": "def create\n @user = User.new(username: params[:user][:username], balance: 0)\n if @user.save\n redirect_to users_url\n else\n flash.now[:errors] = @user.errors.full_messages\n render :new\n end\n end", "title": "" }, { "docid": "9ae1f8fc2e6563802ca3f648bfba7315", "score": "0.68189836", "text": "def create_user(db, name, age, zipcode, instagram, activity, comment, activity_location, motivation_id, accomplished_id)\n\tdb.execute(\"INSERT INTO users (name, age, zipcode, instagram, activity, comment, activity_location, motivation_id, accomplished_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\", [name, age, zipcode, instagram, activity, comment, activity_location, motivation_id, accomplished_id])\nend", "title": "" }, { "docid": "4fbf8205919e47e99f506634a45c710b", "score": "0.68174255", "text": "def create_first_user\n return true unless User.count == 0\n user = User.new :admin => 1\n user.save_with_validation false\n session[:user_id] = user.id\n redirect_to home_url\n end", "title": "" }, { "docid": "7a24db3051acfa5550f13e8aadd3e42c", "score": "0.68157166", "text": "def create\n\t @user = User.new(params[:user])\n\t @user.created_by = 15\n\t \n\t @user.save\n\t flash[:message] =\"User created successfully!\"\n\t redirect_to \"/users\"\n\t \n\t # have to put the code in case of error\n\t \n end", "title": "" }, { "docid": "f0f21fc99059289c08a7a9b63a5773a6", "score": "0.68129766", "text": "def create\n @user = User.new(params[:user])\n @last_id_usr = User.find(:first, :order => 'id DESC')\n @user.id = @last_id_usr.id + 1\n prof_id = new_profile(session[:user])\n @user.profile_id = prof_id\n if @user.save\n @current_user = @user\n session[:user] = @user.id\n flash[:notice] = 'successfuly signed up!'\n redirect_to :action => 'show', :id => @user.id\n \n else\n render :action => 'new'\n flash[:notice] = 'oops, something went wrong!' \n end\n end", "title": "" }, { "docid": "4623887820cdc60714740614cd3c956a", "score": "0.68113506", "text": "def create_user(login,\n password=nil,\n options={})\n\n @user = User.create(login,password,options)\n\n start_session(@user)\n\n\n if new_user_handler\n Rengine::WorkRequest.create(\"#{new_user_handler}('#{@user.login.escape}','#{$language}')\"); \n end\n flash[:notice] = l(\"Thanks for signing up!\")#l(\"Thanks for signing up!\")\n @user\n end", "title": "" }, { "docid": "8c2f2faf11b5f6fb526aee53b56d697b", "score": "0.68109196", "text": "def create\n \tsuper\n \t@user = User.create( params[:user] )\n end", "title": "" }, { "docid": "c1b50058545ae163b2e33e5c741f39af", "score": "0.68105644", "text": "def dscl_create_user\n run_dscl(\"create\", \"/Users/#{new_resource.username}\")\n end", "title": "" }, { "docid": "bc8ac7a8fa16d4b98110bdf965dd984c", "score": "0.68064", "text": "def create\n user = User.new(user_params)\n approved = ApprovedAccount.find_by_email(user.email)\n if approved\n user = User.new(user_params)\n user.bio = \"No bio yet.\"\n user.division = approved.division\n if user.save\n session[:user_id] = user.id\n approved.destroy\n redirect_to '/'\n else\n redirect_to '/member_portal/signup'\n end\n else\n flash[:notice] = 'Account is not approved for creation.'\n redirect_to '/member_portal/users/signup'\n end\n end", "title": "" }, { "docid": "b077427fd45b1de973910258e9423e64", "score": "0.6804863", "text": "def create\n @user = User.new(params[:user])\n \n if @user.save\n session[:user_id] = @user.id # \"auto-login\"\n flash[:notice] = \"Account successfully created.\"\n redirect_to(:root)\n else\n render \"new\"\n end\n end", "title": "" }, { "docid": "b1a2e6d598cd6fdf944bee53eca259fd", "score": "0.6799773", "text": "def create_account\n @user = User.new(user_params)\n if [email protected]?\n render :sign_up\n elsif @user.save!\n create\n else\n render :sign_up\n end\n end", "title": "" }, { "docid": "858780b26a07ca8cdae6aa25a81c8215", "score": "0.6798159", "text": "def add_user\n create\n end", "title": "" }, { "docid": "e04625a2395349db587be6d1ab1ab128", "score": "0.67969376", "text": "def add_user(atts)\n u = User.new(atts)\n #u.change_password\n # WARNNING: 'add_user' produces status => \"normal\" user\n u.status = 1\n u.save!\n end", "title": "" }, { "docid": "93b4100f9d2ce478e8bd1363a0e476df", "score": "0.6795608", "text": "def newUser(username, password)\n return \"User name in use.\" if @accounts.assoc(username)\n return \"Invalid password.\" if password == nil || password == \"\"\n e = encrypt(password)\n newUser = username + \":\" + e\n File.open(@file, 'a') { |f| f.write(newUser) }\n @accounts << [username, e]\n @accounts.sort\n return \"Account created.\"\n end", "title": "" }, { "docid": "e07f7adaf560dafc7dbf354c4a66483e", "score": "0.6791965", "text": "def create\n if @user.save\n flash[:notice] = t(\"users.create.flash.success\")\n Admin::UserMailer.account_created(@user).deliver\n redirect_to(users_path)\n else\n flash[:error] = t(\"scaffolds.generic.flash.error\")\n render scaffold_template(:new)\n end\n end", "title": "" }, { "docid": "5f2dcd9f2d4701e18bf06103d27a07cb", "score": "0.6785007", "text": "def create\n @user = User.create_user_with_random_pass(user_params)\n @user.admin = current_admin\n @user.save\n if @user.valid?\n render status: 200, json: { success: I18n.translate('models.user.created') }\n else\n render status: 400, json: { message: @user.errors.full_messages.join(\"\\n\") }\n end\n end", "title": "" }, { "docid": "31725038c9850a8af5ba85fc01c653c7", "score": "0.6783348", "text": "def CreateUser(username, userhandle, useremail, userpass)\n if NewUserAvailable(useremail, userhandle)\n CreateAUser(username, userhandle, useremail, userpass)\n else\n 'USERERROR-CREDENTIALSTAKEN'\n end\n end", "title": "" }, { "docid": "ebaa9e453fe17bf274881dcfc53c841a", "score": "0.67791116", "text": "def createUser()\n db = db_settings()\n\n hash_password = BCrypt::Password.create( params[\"password\"])\n\n db.execute(\"INSERT INTO users(name, password) VALUES(?, ?)\", params[\"nickname\"], hash_password)\n\n redirect(\"/\")\n end", "title": "" }, { "docid": "6b310e1cde0b5ecb91497e7982ba199f", "score": "0.6778276", "text": "def newUser\n @newUser = User.new()\n end", "title": "" }, { "docid": "175bc1f33ff2067b3bebd096830bd7f7", "score": "0.67773765", "text": "def create_user (user)\n is_save = user.save\n end", "title": "" }, { "docid": "de0edaac4c7fd9c01102f14cbe99a197", "score": "0.6776421", "text": "def add_user(db, name, merchant, budget, remaining)\n db.execute(\"INSERT INTO users (name, merchant, budget, remaining) \n \tVALUES (?, ?, ?, ?)\", [name, merchant, budget, remaining]\n \t)\nend", "title": "" }, { "docid": "855cd4e72f656d9972f87df68fc2f7af", "score": "0.67691207", "text": "def create_user\n @user = User.create(\n login: github_login,\n login_type: @response[\"type\"],\n name: @response[\"name\"],\n bio: @response[\"bio\"],\n public_repos: @response[\"public_repos\"],\n avatar_url: @response[\"avatar_url\"],\n gravatar_id: @response[\"gravatar_id\"],\n language: @winner\n )\n @user.save\n end", "title": "" }, { "docid": "8f2b13346b0dc3588baf86eec988a3e3", "score": "0.6768097", "text": "def create_user params\n user_attr = post(\"/admin/tenants/#{current_user.tenant_id}/users.json\", params)\n Cliskip2::User.new(user_attr['user'])\n end", "title": "" }, { "docid": "748d9b4b2cf33e31a4a5bf24370c91fa", "score": "0.6767415", "text": "def create\n\t\t@user = User.create(user_params)\n\t\tlogin(@user) #login the user\n\t\tredirect_to \"/users/#{@user.id}\" #show user.id in url\n\tend", "title": "" }, { "docid": "a162118054e91f015b6898cad1055950", "score": "0.6762569", "text": "def create\n if !current_user # check if not logged in\n @user = User.new(attributes) # this is handled by model validations\n if @user && @user.save\n\n # creating activation token - not used for this test just emulation\n begin\n token = SecureRandom.urlsafe_base64\n @user.activation_token = BCrypt::Password.create(token)\n end while User.exists?(activation_token: @user.activation_token)\n @user.avatar = 'none'\n @user.activation_request_at = DateTime.now\n @user.activation_status = 'Activated'\n\n if @user.save\n flash[:message] = t(:new_profile)\n redirect_to login_form_path\n else\n render 'new'\n end\n else\n render 'new'\n end\n else\n flash[:alert] = t(:must_be_logged_out)\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "4a3d6882895f845b854802bcddd3384d", "score": "0.6756316", "text": "def new_user\r\n @user = User.new\r\n end", "title": "" }, { "docid": "a33c0e168125252fa684dd279c22aa97", "score": "0.6755468", "text": "def create_user(**args)\n request_post('/user', **args)\n end", "title": "" }, { "docid": "97a5c0ed5955efa656a775abb9ccde8d", "score": "0.6754126", "text": "def create_user(username, password)\n user = MealPlan::User.new(username, password)\n MealPlan::UserData.add_user(user)\n @current_user = user\n # take to logged in user interface\n rescue MealPlan::UsernameError => error\n # inform user about failure\n puts error.message\n end", "title": "" }, { "docid": "390a15ac306c3e8b96156870ea5f687a", "score": "0.675256", "text": "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\t#this will be changed later to send an activation email to the user to activate his account\n\t\t\tflash[:success] = \"User saved successfully\"\n\t\t\tredirect_to root_url #modify it to redirect to th requesting url\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "title": "" }, { "docid": "335ac5afcdebcc3d66e3d79387c06325", "score": "0.67517775", "text": "def create_user\n @user = User.new(normal_user_params)\n @user.role = :user\n\n if @user.save\n render '/users/create_user.json.jbuilder'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "238d79a96ef82edd146139f41168117b", "score": "0.6751699", "text": "def create\n @user = User.new(params[:user])\n raise PermissionViolation unless @user.creatable_by?(current_user)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "794f8514dbd2988a0ad5982cad7807d0", "score": "0.67496246", "text": "def create\n \t@user = User.new(user_params)\n \[email protected]=0\n \[email protected]=0\n \[email protected]=0\n \tif @user.save\n log_in @user\n flash[:success] = \"Welcome to BattleShip\"\n redirect_to @user\n \telse\n \t\trender 'new'\n \tend\nend", "title": "" }, { "docid": "afe127accd4644a782805e2bf2a435ab", "score": "0.67489064", "text": "def create_user(username, given_name, family_name, password, passwd_hash_function=nil, quota=nil)\n msg = ProvisioningMessage.new\n msg.about_login(username,password,passwd_hash_function,\"false\",\"false\", \"true\")\n msg.about_name(family_name, given_name)\n msg.about_quota(quota.to_s) if quota\n response = @apps.request(:user_create,nil, msg.to_s)\n #user_entry = UserEntry.new(response.elements[\"entry\"])\n end", "title": "" }, { "docid": "13cb2b0a5795cfb711d832d1285fe43b", "score": "0.6748684", "text": "def user_creation opts = {}\n u = User.new\n yield u\n u.confirm!\n u.save\n if opts[:generate_profile]\n u.profile.name = Faker::Lorem.word\n u.profile.avatar = File.open pick_random_image\n u.profile.save!\n end\n end", "title": "" }, { "docid": "219cb1573fc012e275a27191f0577d21", "score": "0.67458665", "text": "def createUser(user)\n user.role = user.role == \"Admin\" ? 0 : 1\n isSaveUser = UserRepository.createUser(user)\n end", "title": "" }, { "docid": "eb13a31cc92d02a48b09293baa7752cd", "score": "0.6743486", "text": "def create_user(user_id, pin)\n @user.create(@management_client, user_id, pin)\n end", "title": "" }, { "docid": "bf1de442e7c087e6867f3087a55c82dc", "score": "0.67368555", "text": "def mount_user\n if user_id == -1\n secret_temp_password = UUIDTools::UUID.timestamp_create().to_s\n \n new_user = User.where(account_id: account_id, email: email)\n .first_or_create(account_id: account_id, \n name: get_name, \n email: email, \n role: 'Customer',\n password: secret_temp_password,\n password_confirmation: secret_temp_password, \n activated: false)\n self.user_id = new_user.id\n self.save!\n\n \n end\n end", "title": "" }, { "docid": "ce92131560d7ebd38570b2bf32a1d14e", "score": "0.67344105", "text": "def create_user_account\n user = User.new do |u|\n u.email = email\n u.password = admin_no\n u.role = 'Admin'\n u.general_setting_id = if User.current\n User.current.general_setting_id\n else\n 1\n end\n end\n user.save\n end", "title": "" }, { "docid": "6f4b28f00c7ccbdf0dc5306f759de818", "score": "0.67328566", "text": "def create\n @user = User.new do |u|\n u.email = user_session_email\n u.multiplier = user_params[:multiplier]\n u.shopify_id = user_session_shop_id\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eaf4057875585f0414084bb4d7230324", "score": "0.6728324", "text": "def user(num)\n id = \"user#{num}\"\n name = words.shuffle.take(2).map {|word| word.capitalize }.join(' ')\n User.create(\n id: id,\n name: name,\n email: \"#{id}@example.com\",\n bio: \"This is the bio text for #{name}.\",\n password: \"#{id} password\",\n lang: %w[de en es fr].sample,\n location: %w[England France Germany Spain USA].sample,\n url: 'http://www.google.com/',\n protect: rand(1000) == 0,\n verified: rand(10000) == 0)\n end", "title": "" }, { "docid": "17862109c4eb18797222a7386b05094c", "score": "0.6725721", "text": "def create\n @breadcrumb = 'create'\n @user = User.new(params[:user])\n @user.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: crud_notice('created', @user) }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0aa642d0089088695e058c632bc727cf", "score": "0.67255986", "text": "def create\n @user = User.new(user_params)\n @user.save\n redirect_to root_path\n end", "title": "" }, { "docid": "756f913b2b90b70dc7f63160cd22fcb5", "score": "0.6724154", "text": "def create_user\n @user_password = generate_password\n run \"useradd #{project_name} -p #{@user_password.crypt(project_name)} -s /bin/bash\"\n end", "title": "" }, { "docid": "7b4ce00457079827a7ab01fbc8b5bb3b", "score": "0.6715966", "text": "def create\r\n @user = User.new(params[:user])\r\n if User.all().empty?\r\n @user.admin = true\r\n end\r\n if @user.save\r\n if Setting.user_signup == :needs_approval\r\n flash[:notice] = \"您的账号已经创建,在等待系统管理员的审核\"\r\n redirect_to login_url\r\n else\r\n flash[:notice] = \"成功注册,欢迎进入企业内部管理系统\"\r\n redirect_back_or_default profile_url\r\n end\r\n else\r\n render :action => :new\r\n end\r\n end", "title": "" }, { "docid": "7482871a3cd894dfde21a7647a79ac64", "score": "0.67146075", "text": "def create_user(options={})\n new_users = Array.new\n new_users << options\n create_users new_users\n end", "title": "" }, { "docid": "666f9d26abea9ffafe3f377f7131c4f1", "score": "0.6714414", "text": "def create\n @user = User.new(user_params)\n @user.account = current_account\n if @user.save\n redirect_to users_path, notice: 'User was successfully created.'\n else\n render :new\n end\n end", "title": "" } ]
9cba8df50db57d5dd0e5178fbb08b8cb
Main control method of application
[ { "docid": "4cdd04a6f1c3ccd9f55583eeb9f3d944", "score": "0.0", "text": "def controler(args)\n check_severity(args)\n\tif args[:hosts]\n\t\tparse_scan_for_report(args[:hosts])\n\t\tmatch_hosts_to_findings(args[:hosts], args)\n\t\tScanhost.display_all_hosts(SCANHOSTS, args)\n\telsif args[:nessusscan]\n\t\tparse_scan_for_report(args[:nessusscan])\n\t\tmatch_hosts_to_findings(args[:nessusscan], args)\n\t\tif args[:hostname]\n\t\t\tgenerate_host_summary(SCANHOSTS, args)\n\t\t\texit!\n\t\tend\n\t\tif args[:pluginid]\n\t\t\tget_plugin_info(args[:pluginid])\n\t\t\texit!\n\t\tend\n\t\tif !args[:hostname] && !args[:pluginid] && !args[:microsoft]\n\t\t\tFinding.display_all_findings(FINDINGS, args)\n\t\tend\n\telsif args[:microsoft]\n\t\tparse_scan_for_report(args[:microsoft])\n\t\tmatch_hosts_to_findings(args[:microsoft], args)\n\t\tparse_ms_findings(SCANHOSTS)\n\tend\nend", "title": "" } ]
[ { "docid": "e95cfad9c46711f2a05857f5bcaad7b7", "score": "0.82403064", "text": "def main\n\n end", "title": "" }, { "docid": "e95cfad9c46711f2a05857f5bcaad7b7", "score": "0.82403064", "text": "def main\n\n end", "title": "" }, { "docid": "c821ff4ec859b1dd0f587dc9e2ae4730", "score": "0.7697247", "text": "def main\n end", "title": "" }, { "docid": "efa7967c369e2852cbce412d933637df", "score": "0.76580703", "text": "def main; end", "title": "" }, { "docid": "efa7967c369e2852cbce412d933637df", "score": "0.76580703", "text": "def main; end", "title": "" }, { "docid": "efa7967c369e2852cbce412d933637df", "score": "0.76580703", "text": "def main; end", "title": "" }, { "docid": "9255eaf4b8901bca51572204ff2f3705", "score": "0.7604797", "text": "def main\n ## main method of program. run first\n\nend", "title": "" }, { "docid": "c3db4e3ba396c45aa76c8eb91c62621b", "score": "0.7501187", "text": "def main\n\t\nend", "title": "" }, { "docid": "613a8e040a7596af8348364440cde65c", "score": "0.7397169", "text": "def launch\n end", "title": "" }, { "docid": "41a0a3b53e721d6ee12e038bf45ec423", "score": "0.7339615", "text": "def run\n setup\n main\n ensure\n shutdown\n end", "title": "" }, { "docid": "0244421043663659b64cfe93dc4477c4", "score": "0.73181105", "text": "def main\n begin\n self.app_start\n self.app_main\n rescue ConsoleInterrupt\n # ignored\n rescue ConsoleError\n # ignored\n end\n self.app_exit\n self.exit_session\n end", "title": "" }, { "docid": "dc7168d3279b0cf2a6d7b53a6e659257", "score": "0.7247173", "text": "def run\n\t\t\t\t#puts 'App run'\n\t\t\t\t\n\t\t\t\tloop_cycle = 0\n\t\t\t\twhile !@exit\n\t\t\t\t\tloop_cycle += 1\n\t\t\t\t\t\n\t\t\t\t\trun_cycle\n\t\t\t\t\t#sleep @run_cycle_sleep\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "2a006c0105921e24ea012ff030164e2c", "score": "0.72373545", "text": "def main\n\nend", "title": "" }, { "docid": "71a9074b5fcd728ee59a6ac58987b9eb", "score": "0.7223985", "text": "def set_main\n end", "title": "" }, { "docid": "c376309f69511ff11b1194127d783fa1", "score": "0.71552205", "text": "def run\n end", "title": "" }, { "docid": "c376309f69511ff11b1194127d783fa1", "score": "0.71552205", "text": "def run\n end", "title": "" }, { "docid": "c376309f69511ff11b1194127d783fa1", "score": "0.71552205", "text": "def run\n end", "title": "" }, { "docid": "c376309f69511ff11b1194127d783fa1", "score": "0.71552205", "text": "def run\n end", "title": "" }, { "docid": "bc3e0880d8b9c0c44e60030e2f8d8933", "score": "0.7141514", "text": "def run\n\n\t\tend", "title": "" }, { "docid": "b8ee34de88292c9d31d624e61ca1ced9", "score": "0.7102916", "text": "def run\n application_parse_options\n validate_configuration(configuration) if respond_to?(:validate_configuration)\n Util.setup_windows_sleeper if Util.windows?\n main\n end", "title": "" }, { "docid": "c05b1b7880cca5e1d7b31d4c4f3bc858", "score": "0.7077921", "text": "def application; end", "title": "" }, { "docid": "c05b1b7880cca5e1d7b31d4c4f3bc858", "score": "0.7077921", "text": "def application; end", "title": "" }, { "docid": "1534ac6ca27621262c7e0de67a05c53f", "score": "0.7076806", "text": "def run\n\n\tend", "title": "" }, { "docid": "d2f6ad8b8ddcd7bb3a25d594dac2b522", "score": "0.7065077", "text": "def startup; end", "title": "" }, { "docid": "17eb58aa9f92dcb6be3fee7b2f6f9cea", "score": "0.70333153", "text": "def startup\n end", "title": "" }, { "docid": "ffa1eb19efb64ef161988201fbfb9c0b", "score": "0.703107", "text": "def run\n reconfigure\n setup_application\n run_application\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "e9cd853f591171bbbc814e48cde80903", "score": "0.7027172", "text": "def run\n end", "title": "" }, { "docid": "bcf52dd5441d6ff5dcd8d865d5c63bd8", "score": "0.70232797", "text": "def startup\n\t\tend", "title": "" }, { "docid": "f5355cb651885602f0556180870bf9b7", "score": "0.70170754", "text": "def startup\n end", "title": "" }, { "docid": "5d804175f6c1933f94ff09f46eddfedd", "score": "0.70139474", "text": "def main()\n\n\nend", "title": "" }, { "docid": "08d440b67a39928ad88d52a61e072407", "score": "0.7011809", "text": "def main?; false end", "title": "" }, { "docid": "836676732bea92195c574af0ba92a7d7", "score": "0.69984394", "text": "def startup\n end", "title": "" }, { "docid": "4da8b4c3bd5770e60b33f86f7d85b9b4", "score": "0.6991243", "text": "def run\n end", "title": "" }, { "docid": "a6a83b9b545172ef994b53098a53914a", "score": "0.69826895", "text": "def main\n warn \"Applications need to supply a 'main' method\"\n exit 1\n end", "title": "" }, { "docid": "ca7fc706773f48563824bad7d82564f9", "score": "0.6942227", "text": "def main\n parse_options()\n before()\n run()\n after()\n end", "title": "" }, { "docid": "301680d01fd7a0a12e79a13c009adef6", "score": "0.69368094", "text": "def run\n header\n main\n end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "c15dfedd7107cb6b4fa66c5c93dbcf6f", "score": "0.6922954", "text": "def app; end", "title": "" }, { "docid": "b78a92b83e9ff38e434c5bb508ae4fd9", "score": "0.6921965", "text": "def run!\n intro\n while @active\n begin\n main\n rescue InvalidRequest => e\n puts \"#{e.message} is not a valid command\"\n end\n end\n end", "title": "" }, { "docid": "1fcda6480f0c45cf47cf39e3b33fad91", "score": "0.690339", "text": "def runner\n greet\n\t\tmain_menu\n\tend", "title": "" }, { "docid": "adaf5790b2481b56dc786b1bf29d871d", "score": "0.6898078", "text": "def run\n\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "1c9c08652ac159a03e23f73ac1a84d94", "score": "0.6897592", "text": "def run\n end", "title": "" }, { "docid": "233691e280f06ab3c2c87d10926c1b89", "score": "0.6877445", "text": "def main_window ; end", "title": "" }, { "docid": "e0123370b26cfa773c4c720803904043", "score": "0.6876661", "text": "def run_program\n # Display welcome screen\n welcome_screen\n\n # Display user menu choices\n get_goal_management_choice\n end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.68402404", "text": "def run; end", "title": "" }, { "docid": "a1084004f26c85d907ef7471b95afd71", "score": "0.680602", "text": "def start\n\tend", "title": "" }, { "docid": "5b01a50320384314d10e7571451a3b94", "score": "0.6789422", "text": "def main\n bootstrap\nend", "title": "" }, { "docid": "29495216f9afde3a8d573121980ce744", "score": "0.67884994", "text": "def run\n puts # Add a line of white space before the heading\n \n # Output the welcome message.\n # puts_heading is a method we created to format our\n # headings for us using rainbow (see below).\n puts_heading \"Welcome to the Rental App!\"\n \n # Now run the method that shows the user the list\n # of actions by number and then reacts to their selection.\n # See below for the details of this method.\n select_main_options\n end", "title": "" }, { "docid": "6c02f1cabf0a12e8795afbae111e3db9", "score": "0.6784154", "text": "def start\n\t\tend", "title": "" }, { "docid": "6c02f1cabf0a12e8795afbae111e3db9", "score": "0.6784154", "text": "def start\n\t\tend", "title": "" }, { "docid": "f79d059914471adf23ea254eb6d3e21d", "score": "0.6774146", "text": "def launch!\n run!\n end", "title": "" }, { "docid": "970f3611de14cfc4377a1e1d95698be2", "score": "0.67541444", "text": "def start\n end", "title": "" } ]
37f88620fab067c2f2f4214f3b5764ca
All nested set queries should use this nested_set_scope, which performs finds on the base ActiveRecord class, using the :scope declared in the acts_as_nested_set declaration.
[ { "docid": "ec60d3ae32ad973cffd39a1372d90929", "score": "0.7651104", "text": "def nested_set_scope\n conditions = scope_column_names.inject({}) do |cnd, attr|\n cnd.merge attr => self[attr]\n end\n\n self.class.base_class.order(q_left).where(conditions)\n end", "title": "" } ]
[ { "docid": "0b59ac927a1d882ac26ee73a307fd323", "score": "0.7323871", "text": "def nestable_scope\n self.class.base_class.where(self.class.nestable_options[:scope].inject({}) { |scope, field| scope.merge!(field => send(field)) })\n end", "title": "" }, { "docid": "83c07ae21aea8cce83d6e35cb4473ac4", "score": "0.69623303", "text": "def nested_set_scope\n scopes = Array(acts_as_nested_set_options[:scope])\n conditions = scopes.inject({}) do |conditions,attr|\n conditions.merge attr => self[attr]\n end unless scopes.empty?\n macro = conditions.present? ? scope_class.criteria.where(conditions) : scope_class.criteria\n macro.asc(left_field_name)\n end", "title": "" }, { "docid": "9f8ccb418b411f5dcdfa55cb21aee1b2", "score": "0.69311416", "text": "def self_and_descendants\n self.reload\n nested_set_scope.where(\"#{self.class.quoted_table_name}.#{connection.quote_column_name(Taxonomy.nested_set_options[:left_column])} >= ? AND #{self.class.quoted_table_name}.#{connection.quote_column_name(Taxonomy.nested_set_options[:right_column])} <= ?\", left, right)\n end", "title": "" }, { "docid": "a3b422a8c3bbf7503f01bd9c61a62e7f", "score": "0.6849424", "text": "def nested_set\n # TODO add option for serving it as a nested array\n self.model.base_model.all(nested_set_scope.merge(:order => [:lft.asc]))\n end", "title": "" }, { "docid": "e59801e288bf141dbbcbe964a1845ccf", "score": "0.6795823", "text": "def target_scope\n scope = super\n chain[1..-1].each do |reflection|\n scope = scope.merge(\n reflection.klass.scoped.with_default_scope.\n except(:select, :create_with, :includes, :preload, :joins, :eager_load)\n )\n end\n scope\n end", "title": "" }, { "docid": "61f31e8d384d5f98ca929b1b4ab42fab", "score": "0.67395043", "text": "def self_and_ancestors\n self.reload\n nested_set_scope.where(\"#{self.class.quoted_table_name}.#{connection.quote_column_name(Taxonomy.nested_set_options[:left_column])} <= ? AND #{self.class.quoted_table_name}.#{connection.quote_column_name(Taxonomy.nested_set_options[:right_column])} >= ?\", left, right)\n end", "title": "" }, { "docid": "25e260b3a8170e9310c92062a0b425c8", "score": "0.66845804", "text": "def base_scope\n q = @ref.klass.all\n q = q.instance_exec(&@ref.scope) if @ref.scope\n q = @scope.(q) if @scope\n q\n end", "title": "" }, { "docid": "f94c46e8eb3a64e138789dbc0a1ae16f", "score": "0.6669811", "text": "def nested_set_scope\n self.class.base_class.scoped.order(connection.quote_column_name(Taxonomy.nested_set_options[:left_column])) # options\n end", "title": "" }, { "docid": "611d0d5b5b2c60f07802ebace7ed9c4d", "score": "0.66558087", "text": "def base_scope\n q = @ref.klass.all\n q = q.instance_exec(&@ref.scope) if @ref.scope\n q = q.instance_exec(&@scope) if @scope\n q\n end", "title": "" }, { "docid": "1f0f170cf98a4171238fdb3951a906dc", "score": "0.6646349", "text": "def target_scope\n scope = super\n reflection.chain.drop(1).each do |reflection|\n relation = reflection.klass.all\n\n reflection_scope = reflection.scope\n if reflection_scope && reflection_scope.arity.zero?\n relation = relation.merge(reflection_scope)\n end\n\n scope.merge!(\n relation.except(:select, :create_with, :includes, :preload, :joins, :eager_load)\n )\n end\n scope\n end", "title": "" }, { "docid": "da4970647ad282ae51c55c39e22b3922", "score": "0.6620425", "text": "def self_and_descendants_of_root\n nested_set_scope.scoped( :conditions => [\n \"#{self.class.table_name}.#{quoted_left_column_name} >= ? AND #{self.class.table_name}.#{quoted_right_column_name} <= ? and root_id = ?\", left, right, self.root_id\n ])\n end", "title": "" }, { "docid": "3836e9ad9320094fa4216666ecc42b80", "score": "0.6543084", "text": "def self_and_descendants\n # TODO supply filtering-option?\n nested_set.all(:lft => lft..rgt)\n end", "title": "" }, { "docid": "9c1bafcbebfefb7d879d44fda89f7c45", "score": "0.6525921", "text": "def self_and_children\n nested_set_scope.where(\"#{q_parent} = :id or #{q_primary_key} = :id\", :id => self)\n end", "title": "" }, { "docid": "1b7da0a43ce2344c2b1a6fdb978a91df", "score": "0.6516854", "text": "def self_and_siblings\n # Rails 3, but not really. scoped.where(Taxonomy.nested_set_options[:parent_column] => parent_id)\n nested_set_scope.where([\"#{Taxonomy.nested_set_options[:parent_column]} == #{parent_id}\"])\n end", "title": "" }, { "docid": "6c183b445b981dfc8e5b532f702bf721", "score": "0.64781094", "text": "def self_and_children\n nested_set_scope.where(\"#{q_parent} = :id or #{q_primary_key} = :id\", :id => self)\n end", "title": "" }, { "docid": "2328837c30376db7af3a839ae3724a6b", "score": "0.64759374", "text": "def self_and_descendants\n nested_set_scope.where(\"#{q_left} >= ? AND #{q_right} <= ?\", left, right)\n end", "title": "" }, { "docid": "c73e074e7d456346be96e23d4856429a", "score": "0.6474746", "text": "def self_and_nsp_ancestors\n nested_set_scope.scoped :conditions => [\n \"type = ? AND codes.lft <= ? AND codes.rgt >= ?\", NSP_TYPE, left, right\n ]\n #self_and_ancestors.select{|a| a.type == self.type} #old\n end", "title": "" }, { "docid": "fe706b7532aaa310e7b66b86c402adbd", "score": "0.6413088", "text": "def base_scope\n if @search\n @search.make_query\n else\n base_class\n end\n end", "title": "" }, { "docid": "f1fddd8807a2364432db350d038c11a7", "score": "0.6408966", "text": "def self_and_descendants\n nested_set_scope.where(\"#{q_left} >= ? AND #{q_right} <= ?\", left, right)\n end", "title": "" }, { "docid": "4fbdc080073114a6b77632f1450b1b7e", "score": "0.6366005", "text": "def descendents\n self.class.where(\"#{self.class.table_name}.id IN (#{self.class.descendants_sql_for(self)})\")\n end", "title": "" }, { "docid": "3def5ee07ef9a7f8fffe8e4d89d76c5a", "score": "0.63328344", "text": "def target_scope\n scope = super\n reflection.chain.drop(1).each do |reflection|\n relation = reflection.klass.scope_for_association\n scope.merge!(\n relation.except(:select, :create_with, :includes, :preload, :eager_load, :joins, :left_outer_joins)\n )\n end\n scope\n end", "title": "" }, { "docid": "d8aada3734791235a4bd0b49d75520ed", "score": "0.6329932", "text": "def self_and_descendants\n tree_scope.scoped(:conditions =>\n {path_column => (send(path_column)..send(path_column)+'ZZ')})\n end", "title": "" }, { "docid": "dc825a3b3aa678f8cddac2b04ed3cbf5", "score": "0.63214624", "text": "def self_and_ancestors\n get_class.all(scope_hash.merge(:lft.lte => lft, :rgt.gte => rgt, :order => [:lft.asc]))\n end", "title": "" }, { "docid": "b38e787740a0861b6698ab04ec709cbe", "score": "0.6304613", "text": "def self_and_siblings\n nested_set_scope.where(parent_column_name => parent_id)\n end", "title": "" }, { "docid": "a59dff9538c75a1a6fba5ca1a39f5b5a", "score": "0.6231424", "text": "def self_and_descendants\n # using _left_ for both sides here lets us benefit from an index on that column if one exists\n nested_set_scope.right_of(left).left_of(right)\n end", "title": "" }, { "docid": "d7f9d933fc69826638e8cb478f0f2bea", "score": "0.61996645", "text": "def self_and_descendants\n nested_set_scope.where(\n left_field_name => {\"$gte\" => left},\n right_field_name => {\"$lte\" => right}\n )\n end", "title": "" }, { "docid": "57befc8597e8e6cf601d2d6971942e05", "score": "0.61879593", "text": "def self_and_ancestors\n nested_set_scope.where(\"#{q_left} <= ? AND #{q_right} >= ?\", left, right)\n end", "title": "" }, { "docid": "8d06ab6c3a7dd83d31355d2ce08356d7", "score": "0.6174663", "text": "def self_and_siblings\n nested_set_scope.where(parent_column_name => parent_id)\n end", "title": "" }, { "docid": "6c97f61c7f8ec0a512a15b31d62b6ba9", "score": "0.61523616", "text": "def find_with_nested_set(*args)\n result = find(*args)\n if result.respond_to?(:cache_nested_set)\n result.cache_nested_set\n elsif result.respond_to?(:each)\n result.each do |node|\n node.cache_nested_set\n end\n end\n result\n end", "title": "" }, { "docid": "a4e94cddefd379c9097b79418dfb635d", "score": "0.61446095", "text": "def self_and_siblings\n nested_set_scope.where(parent_field_name => parent_id)\n end", "title": "" }, { "docid": "6d7bec22d2c67ca846ed5aed8bf8f8d9", "score": "0.61443985", "text": "def self_and_siblings\n nested_set.scoped(:conditions => { :parent_id => parent_id })\n end", "title": "" }, { "docid": "68d52cac6c80ec3888e501498c874b1a", "score": "0.6121444", "text": "def self_and_ancestors\n ap = ancestor_paths(true)\n tree_scope.scoped(:conditions => {path_column => ap})\n end", "title": "" }, { "docid": "f461ab94da52a07b563e1e430c32c2d0", "score": "0.61066604", "text": "def self_and_ancestors\n nested_set_scope.where(\"#{q_left} <= ? AND #{q_right} >= ?\", left, right)\n end", "title": "" }, { "docid": "1fa541bd41d268e3eb7a29ce1833d1c3", "score": "0.60903287", "text": "def descendents\n get_class.all(scope_hash.merge(:rgt.lt => rgt, :lft.gt => lft, :order => [:lft.asc]))\n end", "title": "" }, { "docid": "7902612231aa21b33363349e01b49a7a", "score": "0.60828596", "text": "def model_scope_with_nesting\n if parent.present?\n parent_scope\n else\n model_scope_without_nesting\n end\n end", "title": "" }, { "docid": "073717bbf42a626c6e19908ade534105", "score": "0.6077704", "text": "def descendants\n base_class.where(:parent_ids => self.id)\n end", "title": "" }, { "docid": "78f18f46859d9ecf1716c84afbecc634", "score": "0.6075568", "text": "def ancestors\n nested_set.scoped(:conditions => \"lft < #{lft} AND rgt > #{rgt}\")\n end", "title": "" }, { "docid": "e934fcbe7e3ac1ffcf238a031557c8bc", "score": "0.6067128", "text": "def base_and_descendants_cte(with_depth: false)\n cte = SQL::RecursiveCTE.new(:base_and_descendants)\n\n base_query = descendants_base.except(:order)\n base_query = base_query.select(\"1 AS #{DEPTH_COLUMN}\", \"ARRAY[id] AS tree_path\", \"false AS tree_cycle\", objects_table[Arel.star]) if with_depth\n\n cte << base_query\n\n # Recursively get all the descendants of the base set.\n descendants_query = model\n .from([objects_table, cte.table])\n .where(objects_table[:parent_id].eq(cte.table[:id]))\n .except(:order)\n\n if with_depth\n quoted_objects_table_name = model.connection.quote_table_name(objects_table.name)\n\n descendants_query = descendants_query.select(\n cte.table[DEPTH_COLUMN] + 1,\n \"tree_path || #{quoted_objects_table_name}.id\",\n \"#{quoted_objects_table_name}.id = ANY(tree_path)\",\n objects_table[Arel.star]\n ).where(cte.table[:tree_cycle].eq(false))\n end\n\n cte << descendants_query\n cte\n end", "title": "" }, { "docid": "ffe86cc7d596e73b98593670daaff6cb", "score": "0.60585994", "text": "def self_and_descendants\n scope.where(Sequel.lit(\"#{table_name}.#{ltree_column} <@ ?\", ltree_path))\n end", "title": "" }, { "docid": "71e4a4c346ee76e2d09c9166b5c71511", "score": "0.60531896", "text": "def direct_children\n self.class.find(:all, :conditions => \"#{scope_condition} AND #{parent_column} = #{self.id}\")\n end", "title": "" }, { "docid": "27183cddb43869de2d5d0cf5fbae874f", "score": "0.6032808", "text": "def self_and_descendants\n return Scope.all if root_scope?\n\n Scope.where('path like ?', \"#{path}%\")\n end", "title": "" }, { "docid": "2ea5911b6b85b7276bb15f4c4b508f48", "score": "0.60249126", "text": "def with_descendants\n subquery_scope = unscoped\n .joins(\"INNER JOIN all_nodes USING(#{connection.quote_column_name primary_key})\")\n .select(primary_key)\n\n subquery_sql = <<-SQL\n #{cte_sql}\n #{subquery_scope.to_sql}\n SQL\n\n unscoped.where <<-SQL\n #{connection.quote_column_name primary_key} IN (#{subquery_sql})\n SQL\n end", "title": "" }, { "docid": "05072671f058af9b2261140609b5f645", "score": "0.60089153", "text": "def base_and_descendants(with_depth: false)\n unless hierarchy_supported?\n return with_depth ? descendants_base.select(\"1 as #{DEPTH_COLUMN}\", objects_table[Arel.star]) : descendants_base\n end\n\n read_only(base_and_descendants_cte(with_depth: with_depth).apply_to(model.all))\n end", "title": "" }, { "docid": "53c7d9b62c4a302f5e06a9661eec3480", "score": "0.5997178", "text": "def self_and_ancestors\n nested_set.all(:lft.lte => lft, :rgt.gte => rgt)\n end", "title": "" }, { "docid": "c874f2246c0681f77e5e8d58dda4584e", "score": "0.59948945", "text": "def scope(object)\n if object.is_a? Array\n keys = object.collect(&self.primary_key.to_sym)\n keys = nil if keys.empty?\n klass = object.first.class\n else\n keys = object[self.primary_key]\n klass = object.class\n end\n if keys\n scope = base_scope(object).where(self.foreign_key => keys)\n scope = scope.where(polymorphic_type => Perry::Base.base_class_name(klass)) if polymorphic?\n scope\n end\n end", "title": "" }, { "docid": "361896d0175f50170d4ac96471ec4c9d", "score": "0.59898216", "text": "def siblings_and_self\n base_class.where(:parent_id => self.parent_id)\n end", "title": "" }, { "docid": "9cb3c5c980882e528f32aae0362c567c", "score": "0.59878325", "text": "def acts_as_nested_set(options={})\n options = { :left => :left, :right => :right }.merge!(options)\n options[:scope] = \"#{options[:scope]}_id\" if options[:scope]\n\n include NestedSet\n\n self.nested_set_options = options\n\n class_eval <<-RUBY, __FILE__, __LINE__+1\n def #{options[:left]}=(left)\n raise EvenBetterNestedSet::IllegalAssignmentError, \"#{options[:left]} is an internal attribute used by EvenBetterNestedSet, do not assign it directly as is may corrupt the data in your database\"\n end\n\n def #{options[:right]}=(right)\n raise EvenBetterNestedSet::IllegalAssignmentError, \"#{options[:right]} is an internal attribute used by EvenBetterNestedSet, do not assign it directly as is may corrupt the data in your database\"\n end\n RUBY\n\n named_scope :roots, :conditions => { :parent_id => nil }\n has_many :children, :class_name => self.name, :foreign_key => :parent_id\n belongs_to :parent, :class_name => self.name, :foreign_key => :parent_id\n\n named_scope :descendants, lambda { |node|\n left, right = find_boundaries(node.id)\n { :conditions => [\"#{nested_set_column(:left)} > ? and #{nested_set_column(:right)} < ?\", left, right],\n :order => \"#{nested_set_column(:left)} asc\" }\n }\n\n before_create :append_node\n before_update :move_node\n before_destroy :reload\n after_destroy :remove_node\n validate_on_update :illegal_nesting\n validate :validate_parent_is_within_scope\n\n delegate :nested_set_column, :to => \"self.class\"\n end", "title": "" }, { "docid": "f01487d1b42bdbf764d107bce9d8166b", "score": "0.5981756", "text": "def self_and_ancestors\n scope.where(Sequel.lit(\"#{table_name}.#{ltree_column} @> ?\", ltree_path))\n end", "title": "" }, { "docid": "c6b9b9b0cf55331af221bf99743a9310", "score": "0.59773445", "text": "def query(base_scope, params={}) # :nodoc:\n @queryables.inject(base_scope) do |scope, queryer|\n queryer.query(scope, params)\n end.scoped({})\n end", "title": "" }, { "docid": "b5703f2d2d7816a51a175a7bee81cac1", "score": "0.59762895", "text": "def base_and_ancestors\n cte = recursive_cte\n cte_alias = cte.table.alias(model.table_name)\n\n model\n .unscoped\n .where.not('clusters.id' => nil)\n .with\n .recursive(cte.to_arel)\n .from(cte_alias)\n .order(depth_order_clause)\n end", "title": "" }, { "docid": "8f031eb97907da04054d1f70738c12dd", "score": "0.5961838", "text": "def base_and_ancestors\n cte = recursive_cte\n cte_alias = cte.table.alias(model.table_name)\n\n model\n .unscoped\n .where('clusters.id IS NOT NULL')\n .with\n .recursive(cte.to_arel)\n .from(cte_alias)\n .order(DEPTH_COLUMN => :asc)\n end", "title": "" }, { "docid": "8a17199861e453ca13ab8f5b7449c2f2", "score": "0.5954724", "text": "def model_scope\n if parent.present?\n parent_scope\n else\n super\n end\n end", "title": "" }, { "docid": "bd3fa658f1961ef8791584777e753545", "score": "0.5929332", "text": "def with_finder_class_scope(options={})\n #select = \"#{finder_table_name}.*\"\n #order = \"created_at ASC\"\n #group = \"#{finder_table_name}.#{primary_key}\"\n #conditions = self.sanitize_sql([\"#{finder_table_name}.id = ?\", 666])\n self.finder_class.send(:with_scope, :find => self.finder_options(options)) do\n yield\n end\n end", "title": "" }, { "docid": "7c7e279659e91345fe246788c516413d", "score": "0.5915505", "text": "def tree_scope\n raise ActiveRecordError, \"tree_scope must be defined dynamically\"\n end", "title": "" }, { "docid": "9ab69f20644ab691be89f06d346eb66f", "score": "0.59074557", "text": "def full_set\n get_class.all(scope_hash)\n end", "title": "" }, { "docid": "4ea2b364d41b8f33f9678f11f8bee91a", "score": "0.5895802", "text": "def self_and_ancestors\n nested_set_scope.where(\n left_field_name => {\"$lte\" => left},\n right_field_name => {\"$gte\" => right}\n )\n end", "title": "" }, { "docid": "f90218cfe3ebb53b10bd0582afe34e7b", "score": "0.58895016", "text": "def self_and_descendants_from_active_record\n [self]\n end", "title": "" }, { "docid": "b47db9f8e60ffe562d7c6be52e3399db", "score": "0.58874154", "text": "def self_and_descendants_from_active_record\n return [self]\n end", "title": "" }, { "docid": "19a1f813b4fd2a709fb142a34976520c", "score": "0.5879396", "text": "def search_scope\n if scope[:find_options].is_a?(ActiveRecord::Relation)\n scope[:find_options]\n else\n conditions = scope[:find_options] && scope[:find_options][:conditions] || {}\n klass.send(:where, conditions)\n end\n end", "title": "" }, { "docid": "79e8d1a5ac8394c7c110eb2449c352dc", "score": "0.5869905", "text": "def siblings_with_tablename\n nested_set_scope.where(parent_id: parent_id).where(\"#{self.class.table_name}.id <> ?\", id)\n end", "title": "" }, { "docid": "beae02950204020f000b046248724a39", "score": "0.58626336", "text": "def self_and_descendents\n get_class.all(scope_hash.merge(:rgt.lte => rgt, :lft.gte => lft, :order => [:lft.asc]))\n end", "title": "" }, { "docid": "cf3b8c0044f7d0d1480e75ba5dcc6f37", "score": "0.58603454", "text": "def roots\n self.class.base_class.scoped(:conditions => {path_column=>''})\n end", "title": "" }, { "docid": "c1e560f7e67880590beee4cf988f137b", "score": "0.58369946", "text": "def apply_custom_scope\n raise \"override in subclass\"\n end", "title": "" }, { "docid": "ac484b0d2a7c1ef85f6dbf1173d2668f", "score": "0.58049095", "text": "def last_chain_scope(scope, reflection, owner)\n return super unless reflection.connected_through_array?\n\n keys = reflection.join_keys\n value = transform_value(owner[keys.foreign_key])\n constraint = build_id_constraint(reflection, keys, value, true)\n\n scope.where!(constraint)\n end", "title": "" }, { "docid": "b8d906f5f993f0f60809bd64e1c79606", "score": "0.5781108", "text": "def query_scope; end", "title": "" }, { "docid": "2ca5fca8bb52506929ff555a2467e0ff", "score": "0.57766104", "text": "def ancestors(force_reload=false)\n @ancestors = nil if force_reload\n @ancestors ||= base_class.find(\n :all,:conditions => [\"#{nested_set_column(:left)} < ? AND #{nested_set_column(:right)} > ?\", left, right],\n :order => \"#{nested_set_column(:left)} DESC\"\n )\n end", "title": "" }, { "docid": "8204e30f389ff3720a741f0aac0babae", "score": "0.5764435", "text": "def self_and_descendents_from_active_record\n self_and_descendants_from_active_record\n end", "title": "" }, { "docid": "0c43ae0628740fabf808625bb83044fb", "score": "0.5752363", "text": "def get_class #:nodoc:\n klass = self\n klass = klass.superclass while klass.superclass.respond_to?(:is_nested_set?) && klass.superclass.is_nested_set?\n klass\n end", "title": "" }, { "docid": "899cff64c841291443dafe01525c83bd", "score": "0.57487637", "text": "def inherited_scope\n if resource && resource.type == TYPENAME_CLASS && !resource.resource_type.parent.nil?\n qualified_scope(resource.resource_type.parent)\n else\n nil\n end\n end", "title": "" }, { "docid": "48589acb65065e4d4dbc21fe05f8af85", "score": "0.5740821", "text": "def ancestors_including_deleted\n self.class.unscoped { base_class.all(conditions: ancestor_conditions) }\n end", "title": "" }, { "docid": "7e6b86409bf49148a1e6a60a3c8946c0", "score": "0.5729066", "text": "def descendants_including_deleted\n self.class.unscoped { base_class.all(conditions: descendant_conditions) }\n end", "title": "" }, { "docid": "d83a348669fc734430cd1cfc3bea2c94", "score": "0.57127404", "text": "def objects\n query = self.root.uniq\n self.joins.each do |join|\n query = query.joins{ join.split('.').inject((join.present? ? self : nil), :__send__).outer }\n query = query.includes{ join.split('.').inject((join.present? ? self : nil), :__send__).outer }\n end\n query = query.reorder{ my{sort} } if sortable\n query = query.where{ my{search(params[:sSearch])} } if searchable\n query = query.paginate(page: page, per_page: per_page)\n end", "title": "" }, { "docid": "48491b217089ac4bb5873f1f765034da", "score": "0.5706905", "text": "def join_scope(table, foreign_table, foreign_klass)\n return super unless connected_through_array?\n\n predicate_builder = predicate_builder(table)\n scope_chain_items = join_scopes(table, predicate_builder)\n klass_scope = klass_join_scope(table, predicate_builder)\n\n klass_scope.where!(build_id_constraint_between(table, foreign_table))\n klass_scope.where!(type => foreign_klass.polymorphic_name) if type\n klass_scope.where!(klass.send(:type_condition, table)) \\\n if klass.finder_needs_type_condition?\n\n scope_chain_items.inject(klass_scope, &:merge!)\n end", "title": "" }, { "docid": "830c5f494de16883eb14f798e4f19a01", "score": "0.56819266", "text": "def scope_hash_for_direct_children\n {:conditions => \"#{scope_condition} AND #{parent_column} = #{self.id}\", :order => \"#{left_col_name} ASC\"}\n end", "title": "" }, { "docid": "4f0e0e024693df3867ef292170d38d2d", "score": "0.56742275", "text": "def has_many_queried(key, scope = nil, **opts)\n # key will be the name of the property\n # the remote class is either key or as.\n opts[:scope_only] ||= false\n klassName = (opts[:as] || key).to_parse_class singularize: true\n foreign_field = (opts[:field] || parse_class.columnize).to_sym\n\n define_method(key) do |*args, &block|\n return [] if @id.nil?\n query = Parse::Query.new(klassName, limit: :max)\n\n query.where(foreign_field => self) unless opts[:scope_only] == true\n\n if scope.is_a?(Proc)\n # magic, override the singleton method_missing with accessing object level methods\n # that don't collide with Parse::Query instance. Still accessible under :i\n instance = self\n query.define_singleton_method(:method_missing) { |m, *args, &block| instance.send(m, *args, &block) }\n query.define_singleton_method(:i) { instance }\n # if the scope takes no arguments, assume arguments are additional conditions\n if scope.arity.zero?\n query.instance_exec(&scope)\n query.conditions(*args) if args.present?\n else\n query.instance_exec(*args, &scope)\n end\n instance = nil # help clean up ruby gc\n elsif args.present?\n query.conditions(*args)\n end\n\n query.define_singleton_method(:method_missing) do |m, *args, &chained_block|\n klass = Parse::Model.find_class klassName\n\n if klass.present? && klass.respond_to?(m)\n klass_scope = klass.send(m, *args) # blocks only passed to final result set\n return klass_scope unless klass_scope.is_a?(Parse::Query)\n # merge constraints\n add_constraints(klass_scope.constraints)\n # if a block was passed, execute the query, otherwise return the query\n return chained_block.present? ? results(&chained_block) : self\n end\n results.send(m, *args, &chained_block)\n end\n\n Parse::Query.apply_auto_introspection!(query)\n\n return query if block.nil?\n query.results(&block)\n end\n end", "title": "" }, { "docid": "7639a3a4007cd9df4bfaa850826439d2", "score": "0.56697303", "text": "def siblings_and_self\n base_class.where(parent_id: self.parent_id, site_id: self.site_id)\n end", "title": "" }, { "docid": "c8f93028bed8169366d96a562bf8fb0a", "score": "0.5669246", "text": "def full_set\n self.class.find(:all, :conditions => \"#{scope_condition} AND #{root_column} = #{self[root_column]} AND (#{left_col_name} BETWEEN #{self[left_col_name]} and #{self[right_col_name]})\" )\n end", "title": "" }, { "docid": "ca5eb98e5d3f3302b47288bebeaa53cb", "score": "0.5655308", "text": "def self_and_ancestors\n nested_set_scope.\n where(arel_table[left_column_name].lteq(left)).\n where(arel_table[right_column_name].gteq(right))\n end", "title": "" }, { "docid": "3a8e9d5bb1e3a3ce5941b4d24306e981", "score": "0.56420445", "text": "def ancestors\n get_class.all(scope_hash.merge(:lft.lt => lft, :rgt.gt => rgt, :order => [:lft.asc]))\n end", "title": "" }, { "docid": "90faabc147def392e6773dad2614f058", "score": "0.5616125", "text": "def ancestors\r\n base_class.unscoped { super }\r\n end", "title": "" }, { "docid": "ac8b3c1a3511fb93a8db6504b7906f7f", "score": "0.56037873", "text": "def self_and_siblings\n nested_set_scope.children_of parent_id\n end", "title": "" }, { "docid": "473ea9dee975e2fd030c45189bd9acf1", "score": "0.55869144", "text": "def self_and_siblings\n get_class.all(scope_and_parent_hash.merge(:order => [:lft.asc]))\n end", "title": "" }, { "docid": "935b30a8c5dbe62f3e3a51f714aae538", "score": "0.5585327", "text": "def has_many_queried(key, scope = nil, **opts)\n # key will be the name of the property\n # the remote class is either key or as.\n opts[:scope_only] ||= false\n klassName = (opts[:as] || key).to_parse_class singularize: true\n foreign_field = (opts[:field] || parse_class.columnize ).to_sym\n\n define_method(key) do |*args, &block|\n return [] if @id.nil?\n query = Parse::Query.new(klassName, limit: :max)\n\n query.where(foreign_field => self) unless opts[:scope_only] == true\n\n if scope.is_a?(Proc)\n # magic, override the singleton method_missing with accessing object level methods\n # that don't collide with Parse::Query instance. Still accessible under :i\n instance = self\n query.define_singleton_method(:method_missing) { |m, *args, &block| instance.send(m, *args, &block) }\n query.define_singleton_method(:i) { instance }\n # if the scope takes no arguments, assume arguments are additional conditions\n if scope.arity.zero?\n query.instance_exec(&scope)\n query.conditions(*args) if args.present?\n else\n query.instance_exec(*args,&scope)\n end\n instance = nil # help clean up ruby gc\n elsif args.present?\n query.conditions(*args)\n end\n\n query.define_singleton_method(:method_missing) do |m, *args, &block|\n klass = Parse::Model.find_class klassName\n if klass.present? && klass.respond_to?(m)\n klass_scope = klass.send(m, *args, &block)\n return klass_scope.is_a?(Parse::Query) ?\n self.add_constraints( klass_scope.constraints ) :\n klass_scope\n end\n self.results.send(m, *args, &block)\n end\n\n return query if block.nil?\n query.results(&block)\n end\n\n end", "title": "" }, { "docid": "e05943cf3c1b9daccfff437c63314a85", "score": "0.55792785", "text": "def self_and_ancestors\n self_and_ancestors_ids = self[acts_as_materialized_path_options[:path_column]].split(\".\");\n self.class.find(:all, :conditions => [ \" id in (#{self_and_ancestors_ids.join(', ')})\" ] );\n end", "title": "" }, { "docid": "41f7548c5c87e670c065b1e6d5f82d8a", "score": "0.55667853", "text": "def children(options ={})\n # default options\n options[:scope] ||= \":self\"\n options[:order] ||= \"seq\"\n self.class.with_scope(:find => {:conditions => \"#{self.run_id} = parent_run_id\"}) do\n self.class.find(:all, options)\n end \n end", "title": "" }, { "docid": "39a7552b2fb31887ece4eb54cda505aa", "score": "0.55615085", "text": "def ancestors\n base_class.unscoped { super }\n end", "title": "" }, { "docid": "8bfa7426aa24ddfe4b45cf405471fba6", "score": "0.55433893", "text": "def find_models\n scope model_class.scoped\n end", "title": "" }, { "docid": "393f57e75ef66db8f3771ab04bf295b2", "score": "0.5534773", "text": "def self_and_ancestors\n @ancestors_self ||= base_set_class._ancestors(self)\n end", "title": "" }, { "docid": "eaee7b17c142b62b937d2b674801334c", "score": "0.5533926", "text": "def scope(object)\n if object.is_a? Array\n keys = object.collect(&self.foreign_key.to_sym)\n keys = nil if keys.empty?\n else\n keys = object[self.foreign_key]\n end\n if keys\n scope = base_scope(object)\n scope.where(self.primary_key(object) => keys)\n end\n end", "title": "" }, { "docid": "bcd28cbd1600fabac87a5a1f2235de27", "score": "0.55330133", "text": "def scope where\n @scope = where\n self\n end", "title": "" }, { "docid": "c0bf4b80f50ee42c646568d7d35a8763", "score": "0.5528675", "text": "def with_taxonomy_scope(loc = Location.current, org = Organization.current, inner_method = :subtree_ids)\n self.which_ancestry_method = inner_method\n self.which_location = loc\n self.which_organization = org\n scope = block_given? ? yield : where('1=1')\n scope = scope.where(:id => taxable_ids) if taxable_ids\n scope.readonly(false)\n end", "title": "" }, { "docid": "36c79e9368c2ee53f5c32cd85912481f", "score": "0.55061656", "text": "def parent_scope\n parent.send(model_class.name.underscore.pluralize)\n end", "title": "" }, { "docid": "36c79e9368c2ee53f5c32cd85912481f", "score": "0.55061656", "text": "def parent_scope\n parent.send(model_class.name.underscore.pluralize)\n end", "title": "" }, { "docid": "90b3b9e94ac2e0f72163a5db778faa60", "score": "0.5503534", "text": "def build_full_tree\n self.class.in_tree_load = true\n begin\n # get all the children with levels counted and ordered in one SQL statement - this is what nested sets are all about \n # then do a depth first traversal of all the entire list to build the tree in memory\n child_list = self.class.find_by_sql(\"SELECT t1.*,(select count(*) from #{self.class.table_name} t2 where t2.#{left_col_name}<t1.#{left_col_name} and t2.#{right_col_name} > t1.#{right_col_name}) as depth from #{self.class.table_name} t1 where t1.#{left_col_name} >#{left_col_val} and t1.#{right_col_name} <#{right_col_val} order by #{left_col_name} desc\")\n # child_list.each{|r| r.in_tree = true}\n #for some strange reason depth comes back as a string in Postgresql hence the .to_i \n build_tree_by_recursion(self,child_list.last.depth.to_i,child_list) unless child_list.size == 0\n ensure\n self.class.in_tree_load = false\n end\n return self \nend", "title": "" }, { "docid": "94ed53095d1b3a19dc13519a47b55b49", "score": "0.5491685", "text": "def find_parents\n\t\tBinder.where(:_id.in => self.parent_ids_without_roots)\n\tend", "title": "" }, { "docid": "54279212e240d5a0326330cf8b336b3d", "score": "0.5491338", "text": "def scope\n @scope ||= @association.scope\n end", "title": "" }, { "docid": "b46b946646a68e4b65d4a7b61a491d41", "score": "0.5484215", "text": "def set_search_scope\n end", "title": "" }, { "docid": "2850ee7470a5cbb53a55219ca22fd3f3", "score": "0.54838467", "text": "def search(scope)\n @scope = scope\n @klass = scope.klass\n @conditions.each { |method, value| @scope = search_for(method, value) }\n @scope\n rescue ActiveRecord::RecordNotFound\n @klass.where('1 < 0')\n end", "title": "" }, { "docid": "1ec0d6cfca131d3f76ca557672b9cec7", "score": "0.54797614", "text": "def conditions_for_all_children\n pk = \"#{self.class.table_name} WHERE id = #{self.id}\"\n inner_r = \"(SELECT #{root_column} FROM #{pk})\"\n inner_d = \"(SELECT #{depth_column} FROM #{pk})\"\n inner_l = \"(SELECT #{left_col_name} FROM #{pk})\"\n inner_r = \"(SELECT #{right_col_name} FROM #{pk})\"\n inner_rt = \"(SELECT #{root_column} FROM #{pk})\"\n \n \"#{scope_condition} AND #{inner_rt} AND \" +\n \"#{depth_column} > #{inner_d} AND \" +\n \"#{left_col_name} > #{inner_l} AND #{right_col_name} < #{inner_r}\"\n end", "title": "" }, { "docid": "b4d15f29e23bb378da316a167d7da4c1", "score": "0.5477511", "text": "def ancestors\n base_class.where(:_id.in => parent_ids).order(:depth => :asc)\n end", "title": "" } ]
3a1ccecd277eab053582bce8ed130924
Sets the value of the `external_status` attribute.
[ { "docid": "67762a2acb5b062d49a06f4faeff86a2", "score": "0.8976698", "text": "def external_status=(value)\n @external_status = value\n end", "title": "" } ]
[ { "docid": "5c86cbd7315357fe6aecf09e29f64563", "score": "0.6904942", "text": "def set_status(status)\n @status = status\n end", "title": "" }, { "docid": "28f6ec75354f02637065251ac5593d43", "score": "0.6902702", "text": "def set_status(status)\n @status = status\n end", "title": "" }, { "docid": "fac2d67b4d878716c0e2b53f51675938", "score": "0.68943894", "text": "def external_status\n @external_status\n end", "title": "" }, { "docid": "fac2d67b4d878716c0e2b53f51675938", "score": "0.68934786", "text": "def external_status\n @external_status\n end", "title": "" }, { "docid": "56c710b57177ae88232ab90c71c423a2", "score": "0.6889479", "text": "def set_status status\n @status = status\n end", "title": "" }, { "docid": "f54b3c98e6fee14977575fc27defecba", "score": "0.68169004", "text": "def set_status status\n @status = status\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67637384", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67637384", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67637384", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67637384", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67633164", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.6763306", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.67625934", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.6700039", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "bec20d77e8b776b03dae2e185fa8fb75", "score": "0.66999394", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "2f35d052d5c5e574b7344fe64c11974b", "score": "0.66122854", "text": "def set_device_status(status)\n @device_status = status\n end", "title": "" }, { "docid": "862e811137d2dc3f76b5274601ca2d40", "score": "0.659941", "text": "def external=(value)\n @external = value\n end", "title": "" }, { "docid": "862e811137d2dc3f76b5274601ca2d40", "score": "0.65993273", "text": "def external=(value)\n @external = value\n end", "title": "" }, { "docid": "9e3cd55fd1cdbd9ec8e6ea9947a8aaf8", "score": "0.6577866", "text": "def change_status(status)\n @status = status\n end", "title": "" }, { "docid": "f9d50bf80602b300ca025b6208805e42", "score": "0.65710956", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"importing\", \"ready\", \"failed\", \"deleted\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "2f1b32c556d7da723b93bb4682836189", "score": "0.6554158", "text": "def status=(status)\n set_status status\n end", "title": "" }, { "docid": "044fb855b1874c584c27a33bdab693c1", "score": "0.6539215", "text": "def status=(status)\n @status = status.to_i\n end", "title": "" }, { "docid": "4c1d75cf3a90ac575ed5e6154464b4f9", "score": "0.6525567", "text": "def status=(status)\n @status = status\n end", "title": "" }, { "docid": "266f05efde4be9f6df853ad5665bbce6", "score": "0.6495159", "text": "def status= (value)\n write_attribute(:status, value.to_s)\n end", "title": "" }, { "docid": "4547c9ece54db9ad7f18d79c14930db9", "score": "0.6487344", "text": "def status=(status)\n validator = EnumAttributeValidator.new('Integer', [22000, 22100, 22110, 22150, 22175, 22180, 22195, 22190, 22200, 22300, 22400, 22410, 22420, 22500, 22575, 22600, 22610, 22650, 22670, 22700, 22800, 22680])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "4e7da3a379d73b33323acedaae28e8b5", "score": "0.64703155", "text": "def status=(new_status)\n begin\n self.status_code = new_status\n rescue ArgumentError\n self.status_code = :undefined\n end\n end", "title": "" }, { "docid": "a2307411c1a11602a19755057404283f", "score": "0.64600676", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"preparing\", \"ready\", \"errored\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "26b9c99cbf052595e260f5cda1bdf9aa", "score": "0.644494", "text": "def status=(a_status)\n a_status = FailedTemporary if a_status.kind_of?(FalseClass)\n a_status = Successful if a_status.kind_of?(TrueClass)\n\n # NO: @status = a_status\n # Instead, this is how you 'override' an AR attribute:\n write_attribute(:status, a_status)\n end", "title": "" }, { "docid": "2c97bcbe2fa2f1db7633138b01a7077c", "score": "0.64403504", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"E\", \"EC\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "c563803f468dac2474c7bec0eb241e0d", "score": "0.64168626", "text": "def setstatus(status)\n if STATES.include? status\n @status=status\n else\n raise \"Unkown status: #{status}\"\n end\n end", "title": "" }, { "docid": "131ba5a9fdebf5266841951f063065fe", "score": "0.64039934", "text": "def set_Status(value)\n set_input(\"Status\", value)\n end", "title": "" }, { "docid": "131ba5a9fdebf5266841951f063065fe", "score": "0.64039934", "text": "def set_Status(value)\n set_input(\"Status\", value)\n end", "title": "" }, { "docid": "cc87f46a25d1bd9507a94829fdeb130b", "score": "0.6392827", "text": "def external_user_state=(value)\n @external_user_state = value\n end", "title": "" }, { "docid": "462b49f35fdd9091dc39da72898bfe96", "score": "0.6391332", "text": "def status=(status)\n validator = EnumAttributeValidator.new('Object', ['IN_FLIGHT', 'CANCELLED', 'SCHEDULED', 'LANDED', 'ON_GROUND', 'UNKNOWN'])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "8cf298e27e527ed507f1aaa2654b24da", "score": "0.63895977", "text": "def status=(new_status)\n update_values([:status] => new_status)\n end", "title": "" }, { "docid": "b0d3348fbb4ba3a051f0f85c0941c221", "score": "0.63786936", "text": "def status=(status)\n status = status.downcase\n @fields['status'] = status if REFERENCE_STATUS_TYPES.include?(status)\n end", "title": "" }, { "docid": "b0d3348fbb4ba3a051f0f85c0941c221", "score": "0.63786936", "text": "def status=(status)\n status = status.downcase\n @fields['status'] = status if REFERENCE_STATUS_TYPES.include?(status)\n end", "title": "" }, { "docid": "57f2c2b0e1a8c85af99932b8c538a6f7", "score": "0.63540155", "text": "def status=(status)\n validator = EnumAttributeValidator.new('Integer', ['0', '10', '15', '20', '100', '-1'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "title": "" }, { "docid": "fc8befd65140961b881a89fb142bda1c", "score": "0.6349837", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"N/A\", \"NML\", \"BLK\", \"BSY\", \"Unknown\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "title": "" }, { "docid": "72c1f9820907309c4dddb3656d2022ab", "score": "0.63450867", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', ['active', 'canceled', 'disabled'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "title": "" }, { "docid": "00e6c4a3f0a154842cbfc3f569702b0b", "score": "0.63442683", "text": "def status=(value)\n @state[:status] = value\n end", "title": "" }, { "docid": "fb5ea64036db0961bb2a6e1e791cebdc", "score": "0.63381916", "text": "def status=(status)\n validator = EnumAttributeValidator.new('String', ['new', 'canceled', 'handedSales', 'handedDealer', 'handedCustomer', 'activated', 'blocked', 'onAgreement', 'agreementRejected', 'agreementSuccess', 'inReport', 'unknown'])\n unless validator.valid?(status)\n fail ArgumentError, %Q'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "title": "" }, { "docid": "293948a487c249aaf0b33065cf0df2a9", "score": "0.6331977", "text": "def status=(status)\n if status.nil?\n fail ArgumentError, 'invalid value for \"status\", status cannot be nil.'\n end\n @status = status\n end", "title": "" }, { "docid": "293948a487c249aaf0b33065cf0df2a9", "score": "0.6331977", "text": "def status=(status)\n if status.nil?\n fail ArgumentError, 'invalid value for \"status\", status cannot be nil.'\n end\n @status = status\n end", "title": "" }, { "docid": "4dd3c4437d6a7a610dfa3623ec21c0e2", "score": "0.6330529", "text": "def set_Status(value)\n set_input(\"Status\", value)\n end", "title": "" }, { "docid": "4dd3c4437d6a7a610dfa3623ec21c0e2", "score": "0.6330529", "text": "def set_Status(value)\n set_input(\"Status\", value)\n end", "title": "" }, { "docid": "4dd3c4437d6a7a610dfa3623ec21c0e2", "score": "0.6330529", "text": "def set_Status(value)\n set_input(\"Status\", value)\n end", "title": "" } ]
ccbe66ef2621bc0e542cb308df3db41d
print1 and print2 put a space when a list is initialized without a value. this is probably related to the "nil" value
[ { "docid": "bf3c537f68a66eacdee8583e47d9eb33", "score": "0.536311", "text": "def print1\r\n\t\tputs \"{\"\r\n\t\tcurrent = @head\r\n\t\twhile current != nil\r\n\t\t\tputs current.data\r\n\t\t\tcurrent = current.next\r\n\t\tend\r\n\t\tputs \"}\"\r\n\tend", "title": "" } ]
[ { "docid": "e4041ab1e3fb8a2eea544cae4e09b27a", "score": "0.6467294", "text": "def print_list\n\t\tnode = @start\n\t\twhile (node.nil? == false)\n\t\t\tputs(node.value)\n\t\t\tnode=node.right\n\t\tend\n\tend", "title": "" }, { "docid": "2eb3e3add96d2392dd72da1ea6458f79", "score": "0.6303809", "text": "def print_list\n\t\tcurrent = @head\n\t\tindex = 0\n\t\twhile index < @size\n\t\t\tprint \"#{current.value} -> \"\n\t\t\tcurrent = current.next\n\t\t\tindex += 1\n\t\t\tif current == nil\n\t\t\t\tputs \"nil\"\n\t\t\t\tindex += 1\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "f3f8657d83d68d86dead978652f56518", "score": "0.6264119", "text": "def printEmpty\n puts @line1\n puts @line2\n puts @line3[0]\n puts @line4[0]\n puts @line5[0]\n puts @line6[0]\n puts @line7\n puts @line8\n end", "title": "" }, { "docid": "9be3f7b763fa96a1840b991a8f6160f9", "score": "0.6190676", "text": "def print_values(list_node)\r\n\t if list_node\r\n\t print \"#{list_node.value} --> \"\r\n\t print_values(list_node.next_node)\r\n\t else\r\n\t print \"nil\\n\"\r\n\t return\r\n\t end\r\n end", "title": "" }, { "docid": "277d504adc12aacb3ef21ec2994d2bdd", "score": "0.6127221", "text": "def print_list; end", "title": "" }, { "docid": "909970e9f92df96470f3f6a011500237", "score": "0.6125423", "text": "def print_values(list_node)\n if list_node\n print \"#{list_node.value} --> \"\n print_values(list_node.next_node)\n else\n print \"nil\\n\"\n return\n end\n end", "title": "" }, { "docid": "e71aa5e69a3e15a1a237e095c6e115d4", "score": "0.61197233", "text": "def display_blanks_as; end", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.60114235", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.60114235", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.60114235", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "f3b31aa33b58ccd6b20055d6c4078744", "score": "0.60029066", "text": "def display_blanks_as=(v); end", "title": "" }, { "docid": "47086bb3fc3a122c6bd36c3c690b98a0", "score": "0.5985685", "text": "def print_values(list_node)\n print \"#{list_node.value} --> \"\n if list_node.next_node.nil?\n print \"nil\\n\"\n return\n else\n print_values(list_node.next_node)\n end\nend", "title": "" }, { "docid": "47086bb3fc3a122c6bd36c3c690b98a0", "score": "0.5985685", "text": "def print_values(list_node)\n print \"#{list_node.value} --> \"\n if list_node.next_node.nil?\n print \"nil\\n\"\n return\n else\n print_values(list_node.next_node)\n end\nend", "title": "" }, { "docid": "913742db10ee6355df53755d36588d3f", "score": "0.5970205", "text": "def print(*args)\n args.each do|x|\n if x.nil?\n __printstr__ \"nil\"\n else\n __printstr__ x.to_s\n end\n end\n end", "title": "" }, { "docid": "733cb608baae34f4417eab0195c7442d", "score": "0.59497833", "text": "def printList( pair )\n printObject( pair.car )\n cdr = pair.cdr\n case cdr\n when NilClass\n when Pair\n print \" \"\n printList( cdr )\n else\n print \" . \"\n printObject( cdr )\n end\nend", "title": "" }, { "docid": "150f8605691a6cd7fd23d151233f3cbd", "score": "0.5932447", "text": "def printList(text)\n print text\n print \" \"\nend", "title": "" }, { "docid": "8175a90d154dbd58a135ae0d352727b2", "score": "0.59276456", "text": "def print_values(list_node)\n if list_node\n print \"#{list_node.value} --> \"\n print_values(list_node.next_node)\n else\n print \"nil\\n\"\n return\n end\nend", "title": "" }, { "docid": "8175a90d154dbd58a135ae0d352727b2", "score": "0.59276456", "text": "def print_values(list_node)\n if list_node\n print \"#{list_node.value} --> \"\n print_values(list_node.next_node)\n else\n print \"nil\\n\"\n return\n end\nend", "title": "" }, { "docid": "8175a90d154dbd58a135ae0d352727b2", "score": "0.59276456", "text": "def print_values(list_node)\n if list_node\n print \"#{list_node.value} --> \"\n print_values(list_node.next_node)\n else\n print \"nil\\n\"\n return\n end\nend", "title": "" }, { "docid": "a1e75382ad35c7b6a9113529fa667e03", "score": "0.58854294", "text": "def print_list\n orig_curr = self.current # Since buffer.full_scan will change the buffer.current\n if self.length == 0\n puts \"empty\"\n else\n self.full_scan { |node| print node.data }\n\t\t\tputs \"\"\n end\n self.current = orig_curr\n end", "title": "" }, { "docid": "d8c5308ca363b32c0a1474c51eb96a9e", "score": "0.5871794", "text": "def print_values(list_node)\n if list_node\n print \"#{list_node.payload} --> \"\n print_values(list_node.next_node)\n else\n print \"nil\\n\"\n return\n end\nend", "title": "" }, { "docid": "96bcaf699546ddec07db1989f00739b2", "score": "0.5811542", "text": "def printIfNotNil (var)\n var.nil? ? \" - \" : var\nend", "title": "" }, { "docid": "52ede2dfc491bdea497019b18514200f", "score": "0.58074546", "text": "def print_empty_line; end", "title": "" }, { "docid": "38a8b4c07b2eea603679565f9bb78855", "score": "0.5774614", "text": "def print_if_not_nil(value)\n if value == nil\n print ' '\n else\n print value\n end\nend", "title": "" }, { "docid": "8178ca56b21ca2ab4daf9ca6511feaf9", "score": "0.57454425", "text": "def print_blanks_array\n @blanks_array.join(' ')\n end", "title": "" }, { "docid": "aebfbe719a10861d0e758fabac5c9449", "score": "0.5741682", "text": "def display_list(list)\n\t sanitize(list.empty? ? 'None' : list.map(&:display).join(', '))\n\tend", "title": "" }, { "docid": "aebfbe719a10861d0e758fabac5c9449", "score": "0.5741682", "text": "def display_list(list)\n\t sanitize(list.empty? ? 'None' : list.map(&:display).join(', '))\n\tend", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.57080173", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.57080173", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "a59bef062cb943cd8b034493f288cf6b", "score": "0.5695312", "text": "def print_list(arg1= array)\n\tputs arg1\nend", "title": "" }, { "docid": "499e812586809ca7e9923c6d51cf2c4b", "score": "0.56951314", "text": "def dump(list)\n list * ' '\n end", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.56897885", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.56897885", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "2d505f295432813a952f4052554816a4", "score": "0.56841207", "text": "def displayNodes\n if @size == 0\n return \"head: --> nil\"\n end\n\n fullList = \"nil <== head: ( #{@head.value.to_s} )\"\n current_node = @head.next_node\n while current_node != nil\n fullList += \" <==> ( #{current_node.value.to_s} )\"\n current_node = current_node.next_node\n end\n fullList += \" ==> nil\"\n puts fullList\n end", "title": "" }, { "docid": "7ed8adeb3776438474cf3441b657064a", "score": "0.5675454", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "ce3c95f42438d2a31ad4038c27841844", "score": "0.5655982", "text": "def print_elements(arr)\narr.each {|it| print it, \" \" unless it.nil?}\nprint \"\\n\"\nend", "title": "" }, { "docid": "82049ddd91fc96f9ebbb8290829757d5", "score": "0.5650578", "text": "def print_list\n current = @head\n until current.nil?\n print current.data.to_s + \" => \"\n current = current.next\n end\n end", "title": "" }, { "docid": "e7e5bef8511bdb2f2c3183eb9b8f632e", "score": "0.56465423", "text": "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end\n end", "title": "" }, { "docid": "67bdaadfac93fa551ebf516b25432b87", "score": "0.56437886", "text": "def display()\n if(@head == nil)\n print (\"Empty Linked List\")\n else\n curr = @head\n while (curr.next_node != nil)\n print (\"#{curr.val} -> \")\n curr = curr.next_node\n end\n print (\"#{curr.val} -> nil\")\n end\n end", "title": "" }, { "docid": "225d1aa5d51931604790017f53fff82f", "score": "0.56307757", "text": "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end \n end", "title": "" }, { "docid": "b74365ba664a8d484633123c357f6b6f", "score": "0.5622237", "text": "def blank\n puts ' '\n end", "title": "" }, { "docid": "b74365ba664a8d484633123c357f6b6f", "score": "0.5622237", "text": "def blank\n puts ' '\n end", "title": "" }, { "docid": "0b82387279ce4c033e495fb98b4be353", "score": "0.5614172", "text": "def print_empty_line\n print_in_same_line(\" \")\n end", "title": "" }, { "docid": "0b82387279ce4c033e495fb98b4be353", "score": "0.5614172", "text": "def print_empty_line\n print_in_same_line(\" \")\n end", "title": "" }, { "docid": "b3888529da57599bcd107a09cc029c3d", "score": "0.5606153", "text": "def display_midi_notes\n\t\t\t@midi_notes[0].each{|i| \n\t\t\t\tif i == nil \n\t\t\t\t\tprint \"nil\"\n\t\t\t\telse\n\t\t\t\t\tprint \"#{i} \"\n\t\t\t\tend}\n\t\t\tputs\n\t\t\t@midi_notes[1].each{|i| \n\t\t\t\tif i == nil \n\t\t\t\t\tprint \"nil\"\n\t\t\t\telse\n\t\t\t\t\tprint \"#{i} \"\n\t\t\t\tend}\n\t\t\tputs\n\t\t\t@midi_notes[2].each{|i| \n\t\t\t\tif i == nil \n\t\t\t\t\tprint \"nil\"\n\t\t\t\telse\n\t\t\t\t\tprint \"#{i} \"\n\t\t\t\tend}\n\t\t\tputs # to add a newline\n\t\tend", "title": "" }, { "docid": "80bf4d851b087e542279a15e679bf2fb", "score": "0.5583604", "text": "def print_lists(lists)\n puts \"%-20s%-12s%-12s%-12s%-12s%-12s\" % %w[\n name\n length\n f_page\n f_offset\n l_page\n l_offset\n ]\n\n lists.each do |name, list|\n puts \"%-20s%-12i%-12i%-12i%-12i%-12i\" % [\n name,\n list.base[:length],\n (list.base[:first] && list.base[:first][:page]) || 0,\n (list.base[:first] && list.base[:first][:offset]) || 0,\n (list.base[:last] && list.base[:last][:page]) || 0,\n (list.base[:last] && list.base[:last][:offset]) || 0,\n ]\n end\nend", "title": "" }, { "docid": "44b9744008f6dde8681a37cea71e7a77", "score": "0.55670375", "text": "def display_list(list)\n sanitize(list.empty? ? 'None' : list.map(&:display).join(', '))\n end", "title": "" }, { "docid": "1d5aca65a908584b98baeef04c6f669d", "score": "0.5563929", "text": "def add_blank\n if @variables.empty?\n @output.push(0.to_bin(@length[:blank]))\n elsif @variables.size == 1\n @output.insert(-2,0.to_bin(@length[:blank]))\n else\n @output.insert([email protected],0.to_bin(@length[:blank]))\n end\n end", "title": "" }, { "docid": "b754358f6a2285c36e0039d635b2b2bf", "score": "0.556141", "text": "def print_elements(arr)\n arr.each {|it| print it, \" \" unless it.nil?}\n puts \"\\n\"\n end", "title": "" }, { "docid": "196f15002ba1ff06b82c3c00417eb813", "score": "0.55597806", "text": "def print\r\n\ttemp = @first\r\n\twhile !(temp.nil?)\r\n\t\tprintf \" #{temp.value}\"\r\n\t\ttemp = temp.next\r\n\tend\r\n end", "title": "" }, { "docid": "05a7f5180e45655f5aeadfab7a300d29", "score": "0.55376226", "text": "def print\n\ttemp = @first\n\twhile !(temp.nil?)\n\t\tprintf \" #{temp.value}\"\n\t\ttemp = temp.next\n\tend\n end", "title": "" }, { "docid": "fbc061d6e3f91661552e3daa65f30933", "score": "0.55326074", "text": "def print_list(header, list)\n return if list.empty?\n puts header + \"\\n\\n\" # Extra newlines\n list.each { |x| puts \" #{x}\" }\n puts \"\\n\" # Extra newline\n end", "title": "" }, { "docid": "03383307f70715877fc164acd7faedf6", "score": "0.55169594", "text": "def print_elements(arr)\n arr.each {|it| print it, \" \" unless it.nil?}\n print \"\\n\"\n end", "title": "" }, { "docid": "be929e7fac7f7a1cb93d7da05744638b", "score": "0.5466761", "text": "def print_values(list_node)\n #this is a method writtent to inform of what to print to the terminal\n if list_node\n print \"#{list_node.value} --> \"\n # This is telling us the specific \"format\" of the equation to print to the terminal\n print_values(list_node.next_node)\n # This is telling us the specific \"equation\" to print to the termainal\n else\n print \"nil\\n\"\n return\n # This is the if and else statement to use to print the actual node list to the terminal and decide the formating of what will be printed to the termainal\"\n end\nend", "title": "" }, { "docid": "61a7db0d30e586ca824d1a9088fc47a1", "score": "0.54659474", "text": "def compact_blank; end", "title": "" }, { "docid": "61a7db0d30e586ca824d1a9088fc47a1", "score": "0.54659474", "text": "def compact_blank; end", "title": "" }, { "docid": "a239410e449c2201166328cf3d8e27a8", "score": "0.5465069", "text": "def print_arr(arr)\n nil\nend", "title": "" }, { "docid": "8c191e9e2017a2671eaf6e5b94d7f1a1", "score": "0.5457065", "text": "def recursive_print(list)\n p list.value\n recursive_print(list.next) unless list.next == nil\nend", "title": "" }, { "docid": "c3df48c02470dfebfa81a683edde073e", "score": "0.54505056", "text": "def empty\n empty_lists\n end", "title": "" }, { "docid": "ceb1628b3b9d560c09af277b4e91d85e", "score": "0.54493916", "text": "def display\n @blanks.each { |letter| print \"#{letter} \" } \n end", "title": "" }, { "docid": "ceb1628b3b9d560c09af277b4e91d85e", "score": "0.54493916", "text": "def display\n @blanks.each { |letter| print \"#{letter} \" } \n end", "title": "" }, { "docid": "3a0adf4ed017864853b10c8558273bd9", "score": "0.54471225", "text": "def printList (alist )\r\n if alist.kind_of?(Array)\r\n # it hsould orint out all the vlues in the array \r\n alist.each_with_index do |alist , indeex |\r\n puts (\"#{indeex}. #{alist.type }\")\r\n end\r\n\r\n else \r\n puts(\"I guess this is also empty\")\r\n end \r\n\r\n\r\n\r\n end", "title": "" }, { "docid": "4748b8a05c9694328c9d601ae34a9469", "score": "0.543915", "text": "def print\n output = \"\"\n if @head == @tail # Linked List has one node\n output << @head.value + \"\\n\"\n elsif @head != nil # Linked List has more than one node\n current = @head\n while current != nil && current.next != nil\n output << current.value + \"\\n\"\n current = current.next\n end\n output << current.value + \"\\n\"\n end\n puts output\n end", "title": "" }, { "docid": "12b011e11e01a8008faee526ac250d38", "score": "0.543449", "text": "def print_list\n puts @name\n puts \"-\" * name.length\n @items.each { |item|\n puts \"[_] #{item}\"\n }\n end", "title": "" }, { "docid": "23d82ebf960e3a6a4f13f43d9ea3749c", "score": "0.542673", "text": "def to_print(value)\r\n\t@value = value\r\n\tif @value !=nil\r\n\t\tprint @value + \"\\n\"\r\n\telse\r\n\t\tprint \"<null>\\n\"\r\n\tend\r\nend", "title": "" }, { "docid": "c435b9e5ba968428cb538ed8766d7294", "score": "0.5425467", "text": "def print_info(name, value)\n value = \"0\" if value.nil? or value.to_s.strip.empty?\n puts \"#{name}=#{value}\"\nend", "title": "" }, { "docid": "7f29893ddb571582303e820a47f25323", "score": "0.5417755", "text": "def initial_display\n puts \" 1 | 2 | 3 \"\n puts \"-----------\"\n puts \" 4 | 5 | 6 \"\n puts \"-----------\"\n puts \" 7 | 8 | 9 \"\n end", "title": "" }, { "docid": "8f4faa4690febccf585069816c2abbbd", "score": "0.5380336", "text": "def print_list\n list = \"1. Name: #{@name}\\n2. Weight: #{@weight}\\n3. Size: #{@size}\\n4. Orbit: #{@orbit}\\n\"\n return list\n end", "title": "" }, { "docid": "b5b11dba59e6d3f5fc64f41063304239", "score": "0.53757995", "text": "def print_blank_line\n puts\nend", "title": "" }, { "docid": "b5b11dba59e6d3f5fc64f41063304239", "score": "0.53757995", "text": "def print_blank_line\n puts\nend", "title": "" }, { "docid": "caf0b27f0fabcc1e0527a80d033b0dd4", "score": "0.53705454", "text": "def display\n count = 1\n node = @head\n self.length.times do |index|\n print \"(Node: #{index} | value: #{node.value}) -> \"\n print \"\\n\" if count % 4 == 0 && count != 0\n print 'nil' if node.next_node == nil\n node = node.next_node\n count += 1\n end\n nil\n end", "title": "" }, { "docid": "0fb472e42df34f186e83b62eb89f2e85", "score": "0.53632766", "text": "def empty\n empty_lists\n end", "title": "" }, { "docid": "1ecb0615b81746b4df5c803db385873a", "score": "0.5360936", "text": "def print(list)\n p list\nend", "title": "" }, { "docid": "f1697972c09fe46371f8b5ba7a756b8c", "score": "0.5359176", "text": "def print_info(name, value)\n value = \"0\" if value.nil? or value.to_s.strip.empty?\n puts \"#{name}=#{value}\"\nend", "title": "" }, { "docid": "40cc92b320542ce09626a0f4b3a3884e", "score": "0.53578395", "text": "def print_list\n print_title\n print_items\n puts\n end", "title": "" }, { "docid": "085cd4f65d44e5c7566293fe49ac5fda", "score": "0.534696", "text": "def inspect\n case\n when tail.nil?\n \"(#{head.inspect})\"\n else\n \"(#{head.inspect} . #{tail.inspect})\"\n end\n end", "title": "" }, { "docid": "397bcdae5b0a3f0c6652e991401877b2", "score": "0.53460705", "text": "def print_arr(arr)\n # TODO 1\n nil\nend", "title": "" }, { "docid": "eee14184748eab860ce28ea91caa3b2a", "score": "0.5336684", "text": "def print_list(list)\n\tputs list\nend", "title": "" }, { "docid": "5513dc8ce97cf3360ac57652f9cf3afa", "score": "0.5329718", "text": "def print(msg = T.unsafe(nil)); end", "title": "" }, { "docid": "0feb853462274543f4138986ffaa75b8", "score": "0.53276134", "text": "def _print\n return printPair(@commandMap[\"listName\"], @listMap[@commandMap[\"listName\"]])\n end", "title": "" }, { "docid": "ce67099f6ce9073fa08019b7e84648ca", "score": "0.5323675", "text": "def print\n node = @head\n if !node\n puts \"The list is empty\"\n return\n end\n puts node.value #print the head of the list\n\n while node && node.next #iterate through each node and print its value\n node = node.next\n puts node.value\n end\n end", "title": "" }, { "docid": "e9e0c9f4d9d34490f54b561992501d7a", "score": "0.53184366", "text": "def test_print_accounts_empty\n samples = {}\n output = @v.print_accounts(samples)\n\t assert_nil output\n end", "title": "" }, { "docid": "fbd8687dfc5993859f8c900fce0e0526", "score": "0.5314779", "text": "def print_messages\n empty_messages\n end", "title": "" }, { "docid": "1cb7aa21d915d129ac980018582825d7", "score": "0.5314589", "text": "def test_bad_display_output_objects\n driver_simulation = DriverSimulation::new\n x = []\n y = 1\n z = 1\n w = 1\n l1 = \"asdf\"\n l2 = 32\n l3 = 34\n l4 = \"jjj\"\n assert_equal (\"---\"), driver_simulation.display_output(x, y, z, w, l1, l2, l3, l4)\n end", "title": "" }, { "docid": "70318c3508e26c58fdbeff9a00300ae7", "score": "0.530755", "text": "def print_none() # still gotta put the parens\n\tputs \"I got nothin'.\"\nend", "title": "" }, { "docid": "467d9ce92dd88c7a9cdc65f1b6d04b3b", "score": "0.5303479", "text": "def print_list\n puts\n puts \"=\" * @title.length\n puts @title\n puts \"=\" * @title.length\n @items.each do |item|\n item.print_item(@items.index(item),item)\n end\n puts\n end", "title": "" }, { "docid": "2b1dfebcad5ef38319398005aa376978", "score": "0.52949196", "text": "def print_none()\n\tputs \"\\t>> print_none\"\n\tputs \"I got nothin'.\"\n\tputs \"\\t<< print_none\"\nend", "title": "" }, { "docid": "794c8642cbb418520c9609d289b42afb", "score": "0.52941567", "text": "def print_parameters\n return super if jails.size == 0\n \"Active jails: #{jails.join(', ')}\"\n end", "title": "" }, { "docid": "2d0033414d85b2252abc1e3ac6d22bd2", "score": "0.52912605", "text": "def empty_list\n puts \"Nothing to see here :/\".center(66) if @villains.empty?\nend", "title": "" }, { "docid": "cb87762d3c2248bb40445a6e1c3d2ba0", "score": "0.52762663", "text": "def blank\n print \"\\r\"\n if @last_print_msg\n print ' ' * @last_print_msg.uncolorize.size\n end\n print \"\\r\"\n end", "title": "" }, { "docid": "e57a2925179f3912db28f7878f407836", "score": "0.5275876", "text": "def print_list\n # return nil if list.nil?\n counter = 0\n current_node = @head\n\n loop do\n puts \"Node at index #{counter}: #{current_node.word}\"\n break if current_node.next.nil?\n current_node = current_node.next\n counter += 1\n end\n @size = counter\n puts \"Size is #{counter}\"\n end", "title": "" }, { "docid": "bf54cbb051b2141dd206bbd99dad7716", "score": "0.52748924", "text": "def print_list(list)\n puts \"Your grocery list:\"\n if list.empty?\n puts \"Your list is empty.\"\n else\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\n end\nend", "title": "" }, { "docid": "c3e6f0f620f6b00947b6f0e66aab5d44", "score": "0.526853", "text": "def display\n return \"List is empty!\" if !@head #list is nil\n current = self.head\n list = []\n while current\n list.push(current.val)\n current = current.next\n end\n puts list.join(\"->\")\n end", "title": "" }, { "docid": "dbb095b2ac02d501ff58a66772146206", "score": "0.5266508", "text": "def print_list\n n = self\n puts n.data\n while n.next != nil\n n = n.next\n puts n.data\n end\n end", "title": "" }, { "docid": "759ac118165e258a8f890d14878e8ba2", "score": "0.5264251", "text": "def compact_blank!; end", "title": "" }, { "docid": "2929178b1bf25aa88e46e13738b034a6", "score": "0.525941", "text": "def display_2\n puts \"I have \" + @front.num.to_s\n if (@front.next != nil)\n display_2_1(@front.next)\n end\n end", "title": "" }, { "docid": "622c2292537770fff5410cdbab686939", "score": "0.5257344", "text": "def read_blankNodePropertyList\n token = @lexer.first\n if token === '['\n prod(:blankNodePropertyList, %{]}) do\n @lexer.shift\n progress(\"blankNodePropertyList\", depth: options[:depth], token: token)\n node = bnode\n debug(\"blankNodePropertyList: subject\", depth: options[:depth]) {node.to_sxp}\n read_predicateObjectList(node)\n error(\"blankNodePropertyList\", \"Expected closing ']'\") unless @lexer.first === ']'\n @lexer.shift\n node\n end\n end\n end", "title": "" }, { "docid": "60e0f1e7a21b97bcd42ef856f8aff1ba", "score": "0.5256591", "text": "def print_blank_line\n\t\t\tuser_output.prompting(false)\n\t\t\tuser_output.print_line\n\t\tend", "title": "" }, { "docid": "efc06a144afbcccb9c0c24cabb4bc581", "score": "0.52519935", "text": "def print_header\n # If list has no names, method returns nothing\n if @students.length > 0\n puts \"\\nThe students of our Villain's Academy as defined by you, me and Dupree\"\n puts \"-------------\"\n else\n puts \"No students in this years cohort, sorry and goodbye\"\n end\nend", "title": "" }, { "docid": "c124a3dcbcf26c643566ef684ed1a1ad", "score": "0.52490306", "text": "def solution_02(list)\n nil\nend", "title": "" } ]
5405f00177a551b3a9c4139d58d59e2e
instantiate the bot and the plugin fresh
[ { "docid": "5fc380b9113582b24c23e2bf298147dc", "score": "0.0", "text": "def setup\n bot = CampfireBot::Bot.instance\n bot.stub!(:config).and_return({'nickname' => 'Bot'})\n @beer = SpecBeer.new()\n CampfireBot::Plugin.registered_plugins['Beer'] = @beer\n @message = SpecMessage.new(:person => 'Josh')\n @beer.balances = {}\n @beer.stub!(:init).and_return(@beer.balances)\n @beer.stub!(:write)\n puts @beer.balances\n @message = SpecMessage.new(:person => 'Josh')\nend", "title": "" } ]
[ { "docid": "652d2a7f1990a35bebcf506eed07acbf", "score": "0.72537446", "text": "def initialize(instance_bot=nil)\n super instance_bot\n \n # Since Core registers the commands of plugins that it loads, and it loads\n # itself, it must also register itself. Other plugins don't need this.\n register_commands\n end", "title": "" }, { "docid": "169ebe4d942061602c547a6f646d5ce1", "score": "0.6902721", "text": "def init(init)\n super\n if @@bot[:messages].nil?\n logger(\"INFO: INIT plugin #{self.class.name}.\")\n @priv_notify = Hash.new(0)\n @@bot[:messages] = self\n end\n return @@bot\n end", "title": "" }, { "docid": "5afe0a89ea554d6956982583337ecd5e", "score": "0.6868448", "text": "def initialize(framework, opts)\n super\n\n # If this plugin is being loaded in the context of a console application\n # that uses the framework's console user interface driver, register\n # console dispatcher commands.\n console_dispatcher = add_console_dispatcher(ConsoleCommandDispatcher)\n @herder = ::BotHerder.new({\"driver\" => \"ec2\", \"vmid\" => \"master\"}) \n\n ## Share the vms\n console_dispatcher.herder = @herder\n\n print_status(\"Creating the new EC2 herder..\")\n\n #print_status(\"Updating the herder with current instances\")\n #@bots = @herder.update()\n\n end", "title": "" }, { "docid": "9b4807c952bca3557abdd417363ecc02", "score": "0.6769604", "text": "def initialize\n register_script \"Bot administration script.\"\n\n register_command \"quit\", :cmd_quit, 0, 10, nil, \"Kill the bot.\"\n register_command \"reconnect\",:cmd_reconnect,1, 10, nil, \"Reconnect the specified connection.\"\n\n register_command \"rehash\", :cmd_rehash, 0, 8, nil, \"Reload the configuration file.\"\n register_command \"nick\", :cmd_nick, 1, 7, nil, \"Change the bot's nick for this connection.\"\n\n register_command \"lib\", :cmd_lib, 0, 9, nil, \"Reload core files with stopping the bot. Warning: may produce undefined behavior.\"\n register_command \"reload\", :cmd_reload, 1, 9, nil, \"Reload one or more scripts.\"\n register_command \"unload\", :cmd_unload, 1, 9, nil, \"Unload one or more scripts.\"\n register_command \"load\", :cmd_load, 1, 9, nil, \"Load the specified script.\"\nend", "title": "" }, { "docid": "61e679975360e3002120d971d37f05ec", "score": "0.67114246", "text": "def initialize(bot)\n @bot = bot\n end", "title": "" }, { "docid": "122c6e18a8c89336d31d52f4830a2063", "score": "0.6580922", "text": "def initialize(bot)\n super # But before let cinch init the plugin :D\n\n @servers = YAML.load_file(ROOT_DIR + '/conf/ServerSharing.yaml')\n @settings = YAML.load_file(ROOT_DIR + '/conf/ServerSharing.settings.yaml')\n end", "title": "" }, { "docid": "5c051710490a6a95e9f1b7426a6cae59", "score": "0.649623", "text": "def new_test_bot(opts={})\n cinch_bot = Cinch::Bot.new do\n configure do |c|\n c.nick = \"steggybot_testbot\"\n c.server = nil\n c.channels = []\n c.plugins.plugins = opts[:plugins] if opts[:plugins]\n c.reconnect = false\n end\n end\n\n cinch_bot\nend", "title": "" }, { "docid": "8762d56956d9170f4f402b1bfe214f9b", "score": "0.6401874", "text": "def plugin_create_instance!\n true\n end", "title": "" }, { "docid": "6c40f44e9174830517b72e6cb6e75081", "score": "0.63740283", "text": "def plugin_init; end", "title": "" }, { "docid": "7f739033f18a49579293278a942d6d6c", "score": "0.6368719", "text": "def initialize(config)\n @config = config\n\n @config[:is_public] ||= false\n @config[:chat_prefix] ||= /\\A!(.+)\\Z/m\n @config[:avatar] ||= 'data/TykeBot.png'\n\n if @config[:name].nil? || @config[:name].length == 0\n @config[:name] = @config[:jabber_id].sub(/@.+$/, '')\n end\n\n Jabber.debug = @config[:jabber_debug] || false\n logger.level = @config[:debug] ? Logger::DEBUG : Logger::INFO\n\n # Default to asking about unknown commands.\n @config[:misunderstood_message] = @config[:misunderstood_message].nil? ? true : @config[:misunderstood_message]\n\n @plugins=[]\n @commands = []\n @inits=[]\n @pubsub = PubSub.new\n @timer=CronTimer.new\n\n on(:command) {|message| dispatch_command(message)}\n end", "title": "" }, { "docid": "ff1f9e95ddfed1ca3eb98a2ad2529fd2", "score": "0.63584644", "text": "def plugin_setup!; end", "title": "" }, { "docid": "ff1f9e95ddfed1ca3eb98a2ad2529fd2", "score": "0.63584644", "text": "def plugin_setup!; end", "title": "" }, { "docid": "ff1f9e95ddfed1ca3eb98a2ad2529fd2", "score": "0.63584644", "text": "def plugin_setup!; end", "title": "" }, { "docid": "e4a33af0337313c4b1e306ba19a2b599", "score": "0.6262479", "text": "def chatbot_init\n project_root = File.dirname(File.absolute_path(__FILE__))\n require \"#{project_root}/app/models/application_record.rb\"\n puts \"Loading Models\"\n Dir.glob(project_root + \"/app/models/*.rb\").each do |f|\n puts \"\\t#{f}\"\n require f\n end\n connection_details = YAML.load(ERB.new(File.read('config/database.yml')).result)\n ActiveRecord::Base.establish_connection(connection_details)\n\n # Let's define somewhere to put all of our various commands\n @bot_commands = {}\n # And a nice place for the various threads we are going to run...\n @threads = {}\n # Next up: Loading all the modules in cmds\n puts \"Loading Modules\"\n Dir[\"#{project_root}/app/cmds/*.rb\"].each do |file|\n puts \"\\t#{file}\"\n load file\n @bot_commands.merge!(commands)\n end\n\n # Creating Threads for our bots to run in\n puts \"Initializing Bots\"\n Dir[\"#{project_root}/app/bots/*.rb\"].each do |file|\n puts \"\\t#{file}\"\n load file\n end\n @threads.each do |_thread_name, thread|\n thread.join\n end\n puts \"Exiting!\"\nend", "title": "" }, { "docid": "94f6fb5d6a0f733dc43e4eae925c1675", "score": "0.62388605", "text": "def initialize\n unless File.exists?( 'cfg.json' )\n File.open( 'cfg.json', 'w+' ) {|f| f.write( JSON.pretty_generate({ \n 'token' => '', \n 'id' => '',\n 'prefix' => '!', \n 'owner' => 0,\n 'wikies' => {},\n 'groups' => { 'access_token' => '' },\n 'ignored' => [],\n 'blacklisted' => []\n }))}\n puts \"Создан новый конфиг, заполните его.\"\n end\n\n @config = JSON.parse( File.read( 'cfg.json' ) )\n @bot = Discordrb::Commands::CommandBot.new( \n token: @config[ 'token' ],\n client_id: @config[ 'id' ],\n prefix: @config[ 'prefix' ],\n help_command: false,\n ignore_bots: true,\n #log_mode: :debug,\n intents: [\n :servers,\n :server_members,\n :server_bans,\n :server_emojis,\n :server_webhooks,\n :server_messages,\n :server_message_reactions,\n :direct_messages\n ],\n no_permission_message: \"Недостаточно прав, чтобы выполнить действие.\"\n )\n @channels = {}\n @thr = {}\n @cfg_mutex = Mutex.new\n @error_log = Mutex.new\n @started = false\n end", "title": "" }, { "docid": "ad45cfa22a6dd2507298a1236d28425b", "score": "0.61808014", "text": "def create\n call_plugins(:create)\n end", "title": "" }, { "docid": "b0b2710b582c0cd6128c3d60ac4869a8", "score": "0.6130299", "text": "def new( * )\n\t\t\tself.install_plugins unless self.plugins_installed?\n\t\t\tsuper\n\t\tend", "title": "" }, { "docid": "8b5ce6d3a330e959b67de9ec3451ae49", "score": "0.61022174", "text": "def initialize\n @bot = TelegramBot.new(token: MARA_BOT_KEY)\n end", "title": "" }, { "docid": "90d76ff57a3d8cd50985226b255395a6", "score": "0.6084358", "text": "def new_plugin(plugin_class, io)\r\n plugin = plugin_class.allocate\r\n plugin.io = io\r\n plugin.send(:initialize)\r\n plugin\r\n end", "title": "" }, { "docid": "f363f674369d23964ab17881321cb846", "score": "0.6011335", "text": "def setup_instance_variables(bot)\n @bot = bot\n @logger = @bot.logger\n @options = @bot.options\n @config = @bot.config\n end", "title": "" }, { "docid": "8eb427e87fb6758b813233c5a5fb83e4", "score": "0.59730333", "text": "def my_init\n # see rubymatica.rb for class def \n @mdo = Msg_dohicky.new(get_remote_addr, Script_path)\n end", "title": "" }, { "docid": "a0860cf90631db88639234dd68a803c6", "score": "0.59431136", "text": "def initialize(output, bot)\n @bot = bot\n super(output)\n end", "title": "" }, { "docid": "44b1df3a96b9b7d57970191faea2db5e", "score": "0.59154683", "text": "def initialize\n @commands = {}\n @hooks = []\n @brief_help = \"#{name.capitalize} plugin.\" unless @brief_help\n register_commands\n load\n end", "title": "" }, { "docid": "51598e6d0ad05f21c49c6a124b3ff62b", "score": "0.5910604", "text": "def initialize config\n @config = config.to_ostruct_recursive\n @connected = false\n @handlers = {\n :CONNECTED => [],\n :DISCONNECTED => [],\n :INVITE => [],\n :JOIN => [],\n :LOAD => [],\n :NICK => [],\n :PART => [],\n :PING => [],\n :PRIVMSG => [],\n :QUIT => [],\n :UNLOAD => []\n }\n @help = Hash.new\n @logger = Logger.new STDOUT\n @start_time = Time.new\n\n loader = load_plugins\n loader.errback { handle :LOAD }\n loader.callback { handle :LOAD }\n end", "title": "" }, { "docid": "d69c949ab96d2b7491504240a0120a73", "score": "0.5895232", "text": "def initialize\n\t\t\tputs \"Loading Entertainment Plugin ...\"\n\t\tend", "title": "" }, { "docid": "6491929d5a49e3dd746fde18a9913c91", "score": "0.58928335", "text": "def load_plugins\n self.plugins.all do |plugin|\n # Create new thread for each plugin found in config.\n self.threads << Thread.new do\n logger.info(\"Loading plugin: #{plugin}\")\n begin\n file_name = File.join(File.dirname(__FILE__), \"plugins\", \"#{plugin}.rb\")\n logger.debug(\"Requiring plugin file located at: #{file_name}\")\n \n # Require plugin base.\n require file_name\n \n # Acquire class name\n klass = \"Octopus::#{plugin.classify}\".constantize\n # Instantiate new class\n plugin = klass.new(self)\n # Run the plugin\n plugin.run!\n rescue LoadError\n raise Octopus::NoPluginError, \"Plugin not found\"\n rescue StandardError => e\n logger.info(\"Error while loading plugin: #{plugin}\")\n logger.debug(e) \n end\n end\n end\n end", "title": "" }, { "docid": "492ba161b04039d27b06997d26ce6692", "score": "0.5885497", "text": "def start\n\n # prepare config\n config = {}\n begin\n config = YAML::load_file(CONFIG_FILE)\n rescue Exception => e\n load 'lib/cogbot/setup.rb'\n config['main'] = Cogbot::Setup.init\n end\n\n # prepare daemon\n Daemons.daemonize(\n :app_name => 'cogbot',\n :dir_mode => :normal,\n :log_dir => LOG_DIR,\n :log_output => true,\n :dir => CONFIG_DIR\n )\n\n # checkout plugins\n plugins = []\n config['main']['plugins'].each do |p|\n if File.exists?(File.join(ROOT_DIR, 'plugins', \"#{p}.rb\"))\n require File.join(ROOT_DIR, 'plugins', p)\n plugins.push Cinch::Plugins.const_get(p.camelize)\n end\n end\n\n # create bot\n bot = Cinch::Bot.new do\n configure do |c|\n c.server = config['main']['server']\n c.ssl.use = ( config['main']['ssl'] == 'true' )\n c.nick = config['main']['nick']\n c.user = config['main']['nick']\n c.realname = config['main']['nick']\n c.channels = config['main']['channels']\n c.sasl.username = config['main']['sasl_user']\n c.sasl.password = config['main']['sasl_pass']\n c.options = { 'cogconf' => config }\n c.plugins.prefix = config['main']['prefix']\n c.plugins.plugins = plugins\n end\n on :message, 'hi' do |m|\n m.reply \"Hello, #{m.user.nick}\"\n end\n end\n bot.loggers.debug(plugins.inspect)\n\n Signal.trap('TERM') { EM.stop }\n\n EM.run do\n EM.defer { bot.start }\n if config['server']\n EM.add_timer(3) do\n EM.start_server(\n config['server']['ip'],\n config['server']['port'],\n Server,\n bot\n )\n end\n end\n end\n\n bot.quit\n end", "title": "" }, { "docid": "8ee99230fba9fe0f4f5a3b363665765f", "score": "0.5883879", "text": "def plugin_load; end", "title": "" }, { "docid": "f32e72f5460f822c27b31f19f2214d57", "score": "0.58747905", "text": "def load_plugins; end", "title": "" }, { "docid": "f32e72f5460f822c27b31f19f2214d57", "score": "0.58747905", "text": "def load_plugins; end", "title": "" }, { "docid": "e068f4a51ec8b6d87b4732a2a6a803fc", "score": "0.58699167", "text": "def initialize(bot)\n super\n @client = ::GroupMe::Client.new token: bot.config['groupme']['token']\n end", "title": "" }, { "docid": "19eeeb8a3b13f131f79e29f32d91b20d", "score": "0.58699083", "text": "def new\n file = File.join(File.dirname(__FILE__), \"config.json\")\n options = nil\n bot = nil\n\n if File.exists? file\n options = {}\n JSON.load(File.open(file)).map { |k, v| options[k.to_sym] = v }\n bot = self.old_new(options)\n else\n puts \"\\\"#{file}\\\" is required but does not exist.\" and exit\n end\n\n bot.load_features\n\n bot\n end", "title": "" }, { "docid": "2bb4a06db7af28c1b013279a35672c0e", "score": "0.5866221", "text": "def run!\n puts \"Jabbot #{Jabbot::VERSION} imposing as #{config.login} on #{config.channel}@#{config.server}\"\n\n onclose_block = proc {\n close\n puts \"\\nAnd it's a wrap. See ya soon!\"\n exit\n }\n\n Kernel.trap(:INT, onclose_block)\n Kernel.trap(:QUIT, onclose_block) rescue nil\n\n debug! if config.debug\n\n # Connect the bot and keep it running.\n EventMachine.run do\n connect\n\n stop_timer = EventMachine.add_periodic_timer(1) do\n if !connected?\n EventMachine.stop_event_loop\n end\n end\n end\n end", "title": "" }, { "docid": "9fc45a6f7e654bdd06e2c08667951e7c", "score": "0.5860772", "text": "def run_plugin\n @run_plugin\n end", "title": "" }, { "docid": "8f35d898865c3fa018db2eabb19b8f1f", "score": "0.5850719", "text": "def bot_instance\n @bot_instance ||= BotInstance.find_by(bot_id: bot.id)\n end", "title": "" }, { "docid": "20806ba8e53d047bf19e729a4a4b6b7c", "score": "0.5836374", "text": "def create_plugin\n @plugin = Plugin.new(params[:plugin])\n if @plugin.name.blank?\n @plugin.name = Plugin.parse_name(@plugin.uri)\n end\n if /^heroku_/.match(@plugin.name)\n @plugin.name.sub!(/^heroku_/, '')\n end\n\n ActiveRecord::Base.transaction do\n @plugin.save!\n @plugin_ownership = @plugin.plugin_ownerships.build(:user => current_user)\n @plugin_ownership.save!\n @plugin.send_later(:fetch_latest_version)\n end\n end", "title": "" }, { "docid": "e7e8461ff351686c0c2fe11439a04bb6", "score": "0.58346874", "text": "def initialize_plugins\n PluginRegistry.plugins.each do |id, plugin_class|\n @plugins << plugin_class.new(id, config)\n end\n end", "title": "" }, { "docid": "af19b5cf5a6586e84610223b86b1adf3", "score": "0.5823945", "text": "def run!\n GoHiring::Bot::SetupChecker.run\n GoHiring::Bot::PrintHello.run(@client)\n GoHiring::Bot::MessageProcessor.run(@client)\n GoHiring::Bot::Start.run(@client)\n end", "title": "" }, { "docid": "fb4375e81912f6121eff49e1be95c21f", "score": "0.582341", "text": "def initialize(caller, msg)\n super()\n self.update(msg)\n @caller = caller # bot object\n @bot = caller # alias for bot object\n end", "title": "" }, { "docid": "bcbc3c9dfc673b8e6d5906d69f74a787", "score": "0.581567", "text": "def initialize(bot = nil)\n @bots = {}\n @bots[0] = nil\n @my_bot = bot || Bot.new(self)\n @enemy_bot = Bot.new(self)\n @parser = Parser.new(self)\n @round = 0\n @playing_field = PlayingField.new(6, 7)\n end", "title": "" }, { "docid": "9ed3372b59785df370ab0a16e04855f7", "score": "0.57877755", "text": "def set_bot_instance\n @bot_instance = BotInstance.find(params[:id])\n end", "title": "" }, { "docid": "e952cf6d70f40fe73a54b0cfcb3b2207", "score": "0.5786648", "text": "def plugin_init\n @@count = 0\n end", "title": "" }, { "docid": "ff2dae0fce3fce0a7730f008f5c098fc", "score": "0.57863533", "text": "def initialize(bot, config)\n super(bot, config, false) # not threaded\n @reminders = PersistentHash.new(@config[:storage_path], true)\n @reminders.save(true)\n end", "title": "" }, { "docid": "5d46b02860f0f1694ff2bfc029ec7659", "score": "0.57854724", "text": "def bot\n end", "title": "" }, { "docid": "f50fa1fa537a045f7164ae7327ad7434", "score": "0.5783263", "text": "def use_factory_bot\n require 'factory_bot_rails'\n\n class << MAIN_OBJECT\n include FactoryBot::Syntax::Methods\n prepend(\n Module.new do\n def reload!\n result = super\n puts 'FactoryBot reloading...'\n FactoryBot.reload\n result\n end\n end\n )\n end\n end", "title": "" }, { "docid": "c4c0e883875d869b9b8841bc56cf330a", "score": "0.57744926", "text": "def spawn host\r\n @gui = Encumber::GUI.new host\r\nend", "title": "" }, { "docid": "52d1fdc06532e54923502afca89327a2", "score": "0.5773779", "text": "def initialize(bot, type, name = nil)\n\t\t\t@conf, @name, @type = nil, name, type\n\t\t\tbot.register(self)\n\t\t\tvalues = { :Type => type }\n\t\t\tvalues[:Name] = name if not name.nil?\n\t\t\tbot.send(\"GETCONF #{values.to_usar}\")\n\t\tend", "title": "" }, { "docid": "a6fc6c6a890665745f670d8221826b57", "score": "0.5767097", "text": "def initialize(config = {})\n @cli = config[:invoked_from_cli]\n @plugin_path = \"\"\n @config = config\n @failed_plugins = []\n @logger = config[:logger] || Ohai::Log.with_child\n @logger.metadata = { system: \"ohai\", version: Ohai::VERSION }\n reset_system\n end", "title": "" }, { "docid": "421fc951cd91be26e7303bd5ef0ce20e", "score": "0.57555854", "text": "def bot\n return @@bot unless @@bot.nil?\n\n begin\n @@bot = Jabbot::Bot.new nil\n rescue Exception\n @@bot = Jabbot::Bot.new(Jabbot::Config.default)\n end\n\n @@bot\n end", "title": "" }, { "docid": "c740c19b62f1cb201a771f6ee0ec2818", "score": "0.5746997", "text": "def initialize\n\t\t#Basic Info:\n\t\tmodule_name='BingSearch' #This is the Name of our Plugin Module\n\t\t#Next we establish some basic info which will be presented to the user\n\t\t#Hash Should include \"Name\", \"Version\", \"Description\", & \"Author\" entries\n\t\tmodule_info={\n\t\t\t'Name' => 'Bing Search Module',\n\t\t\t'Version' => 'v0.01b',\n\t\t\t'Description' => \"This is a Simple Bind Search Assistant. You provide it with the search term or query and it will run it through Bing! Search Engine and return all of the found links. Nothing more, nothing less....\",\n\t\t\t'Author' => 'Hood3dRob1n'\n\t\t}\n\n\t\t#Currently no checks on required vs option so set defaults whcih you plugin can handle and re-act to till new design....\n\t\tmodule_required={ 'SearchTerm' => \".php?id=1\" } #Hash full of \"Required\" Options\n\t\tmodule_optional={ 'CountryCode' => \"COM\", 'ProxyIp' => 'nil', 'ProxyPort' => 'nil', 'Username' => 'nil', 'Password' => 'nil' } #Hash of \"Optional\" Options\n\n\t\t@non_set_private_options={ 'Auth' => 0, 'Cookie' => 'nil' } #These dont show up in menu as we dont use them here, but the underlying HTTP Module does so we need to have them so we can set them to nil to initialize our Http::EasyCurb Module & class effectively\n\n\t\t#If this is our first load, then make sure we register our plugin with the CORE::CoreShell Class so we can share nicely\n\t\tif $module_name.nil?\n\t\t\tpluginRegistrar(module_name,module_info,module_required,module_optional)\n\t\telse\n\t\t\t#Start things up we are being re-loaded by the run/exploit commadn\n\t\t\tsearch\n\t\tend\n\tend", "title": "" }, { "docid": "91f322173ca83f6908d620f07a966e84", "score": "0.5732765", "text": "def setup\n bot = CampfireBot::Bot.instance\n bot.stub!(:config).and_return({'nickname' => 'Bot', 'jira_url' => 'foo'})\n @jira = SpecJira.new()\n CampfireBot::Plugin.registered_plugins['Jira'] = @jira\n @jira.cached_ids = {}\n @jira.last_checked = 15.minutes.ago\n @message = nil\n end", "title": "" }, { "docid": "e1ef7253999b4d1ed5f661309459a8aa", "score": "0.57225895", "text": "def bot\n return @bot unless @bot.nil?\n\n @bot_command = nil\n \n #\n # parse any command-line options and use them to initialize the bot\n #\n params = {}\n\n #:nocov:\n opts = OptionParser.new\n\n opts.banner = \"Usage: #{File.basename($0)} [options]\"\n\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n\n opts.on('-c', '--config [ARG]', \"Specify a config file to use\") { |c| ENV[\"chatterbot_config\"] = c }\n opts.on('-t', '--test', \"Run the bot without actually sending any tweets\") { params[:debug_mode] = true }\n opts.on('-v', '--verbose', \"verbose output to stdout\") { params[:verbose] = true }\n opts.on('--dry-run', \"Run the bot in test mode, and also don't update the database\") { params[:debug_mode] = true ; params[:no_update] = true }\n\n opts.on('-r', '--reset', \"Reset your bot to ignore old tweets\") {\n @bot_command = :reset_since_id_counters\n }\n\n opts.on('--profile [ARG]', \"get/set your bot's profile text\") { |p| \n @bot_command = :profile_text\n @bot_command_args = [ p ]\n }\n\n opts.on('--website [ARG]', \"get/set your bot's profile URL\") { |u| \n @bot_command = :profile_website\n @bot_command_args = [ u ]\n }\n \n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n opts.parse!(ARGV)\n #:nocov:\n\n @bot = Chatterbot::Bot.new(params)\n if @bot_command != nil\n @bot.skip_run = true\n result = @bot.send(@bot_command, *@bot_command_args)\n puts result\n end\n\n @bot\n end", "title": "" }, { "docid": "cc7e19e8797cb8cf3b949286939461bb", "score": "0.56832933", "text": "def initialize(plugin, id)\n\t\t@id = id\n\t\t@plugin = plugin\n\tend", "title": "" }, { "docid": "c513fae62f21ac7d629e0326bed6968f", "score": "0.56762165", "text": "def initialize\n\n #load server-side faye client\n @faye_client = Faye::Client.new(FAYE_SERVER_URL)\n\n # Objects noted with the 'the_' prefix are used to be passed without risking\n # execution context name collisions\n\n # Put itself to be referenced by the internal irc bot #THE\n #the_faye_sender = self\n\n # Load IRC config part from APP_CONFIG #THE\n load_irc_config\n the_irc_config = @config\n\n #Load device_channels #THE\n the_device_channels = get_device_channels(true)\n\n # Initialize the message processor instance # THE\n the_message_processor = initialize_message_processor\n the_irc_gateway = self\n\n\n # Create the ZBOT, instance of GBot...lol\n @zbot = GBot.new do\n\n configure do |c|\n c.server = the_irc_config[:client][:ip] #'127.0.0.1'#\n c.nick = \"#{the_irc_config[:client][:nick_prefix]}#{the_irc_config[:client][:nick]}\"\n c.channels = the_irc_config[:client][:default_channels].map {|channel| (channel.start_with? \"#\") ? channel : \"##{channel}\"} + the_device_channels\n\n # Server conf queue\n\n c.server_queue_size = 2 # default is 10\n c.messages_per_second = 0.8 # default is 0.5\n\n end\n\n #if the_irc_config[:client][:logger].eql? 'null'\n #\n #end\n\n #self.logger = Cinch::Logger::NullLogger.new($stderr)\n\n #Listen and do...\n on :message do |m|\n # self === Callback.new\n\n # Retrieve important params\n rcvd_message = m.message # \"the message\" the actual message\n rcvd_channel = m.channel.name # \"#lobby\" the channel it was sent on\n rcvd_user = m.user.nick # \"charles\" who sent it\n\n # Process it and get the required data to send\n\n # ELIMINATE\n #the_message_processor=DeviceCommandProcessor.new(the_irc_gateway)\n\n # Prevent processing of other telelab zbot messages\n unless rcvd_user.starts_with? \"#{APP_CONFIG[:irc][:client][:nick_prefix]}#{APP_CONFIG[:irc][:client][:nick]}\"\n the_message_processor.process_irc_message rcvd_channel, rcvd_user, rcvd_message\n end\n\n end\n end\n\n # Finally...start da bot\n start\n end", "title": "" }, { "docid": "c576775ecb6df24cfbd5f1892bda328d", "score": "0.56719553", "text": "def initialize_bots\n @threads.times.map do\n queue = Queue.new\n Bot.new(@responses, queue)\n end\n end", "title": "" }, { "docid": "3f745c85ac4303b46d98a8b25385f406", "score": "0.56515706", "text": "def initialize()\n create_pliveo_app()\n end", "title": "" }, { "docid": "ac9e0f2b8509290858657fc958686b12", "score": "0.5638615", "text": "def bot\n @bot ||= MatchMakingBot.new('.')\n end", "title": "" }, { "docid": "25b6ef98e4f0f4a89a8473f8ea83df59", "score": "0.56208783", "text": "def initialize(session, msg_timeout = 2, max_delay = 6)\n @session = session\n @msg_timeout = msg_timeout\n @max_delay = max_delay\n @purged = false\n @aid = \"#{@@next_id}\"\n @@next_id += 1\n\n @response_text = {}\n @responded = {}\n @finished = []\n\n # The initial bot list for when the aggregator is started\n @bot_list = @session.bot_list\n if @session.kind_of?(HiBot::MUCSessionHandler)\n @bot_list.map! { |jid| jid.split(\"/\").pop }\n end\n print \"Bot list: #{@bot_list.sort.join(\", \")}\\n\"\n\n @delay_thread = Thread.new {\n sleep( @max_delay )\n\tself.purge\n }\n reset_wait()\n # reset_auto_destruct()\n end", "title": "" }, { "docid": "47696d592aef7d4b4d7b22fea94dfd60", "score": "0.5617564", "text": "def init_wiki\n wiki_login unless BUTT.user_bot?\n\n BUTT\n end", "title": "" }, { "docid": "272d36c408bedd09a0d8db70d570a660", "score": "0.5617115", "text": "def ohai_plugin_load_complete; end", "title": "" }, { "docid": "d7500be103902883f599eb9f8296c2e4", "score": "0.56126463", "text": "def initialize\n register_script \"Relay chat between two or more channels on one or more networks.\"\n\n register_event :PRIVMSG, :on_privmsg\n register_event :JOIN, :on_join\n register_event :PART, :on_part\n register_event :KICK, :on_kick\n register_event :QUIT, :on_quit\n\n register_command \"relay\", :cmd_relay, 5, 7, nil, \"Manage channel relays. Parameters: ON|OFF source-network source-channel target-network target-channel\"\n register_command \"relays\", :cmd_relays, 0, 7, nil, \"List active channel relays.\"\n\n @relays = get_data \"relays\", Array.new\nend", "title": "" }, { "docid": "ecc7f001beb5108ef3942cc82c88ab37", "score": "0.559642", "text": "def create_bot(nick, login = nil, hostname = nil) \n return add_bot(Bot.new(:network => self, :nick => nick, :login => login, :hostname => hostname))\n end", "title": "" }, { "docid": "3740ef55313162fdba34d1e92b8b8f0c", "score": "0.55946666", "text": "def setup\n Wukong.boot_plugins(settings, root)\n end", "title": "" }, { "docid": "ec9257579391f10431e8f210c3e0dc92", "score": "0.5591994", "text": "def initialize ()\n @@myName = nil\n @@service = nil\n @@IPaddr = nil\n @@systemNode = nil\n @@expID = nil\n @@sessionID = nil\n @@pubsubNodePrefix = nil\n @@instantiated = true\n @queue = Queue.new\n Thread.new {\n while event = @queue.pop\n execute_command(event)\n end\n }\n start(NodeAgent.instance.config('comm')['xmpp_server'])\n end", "title": "" }, { "docid": "7d9b1b42a41e5256450c17b5a23bb52b", "score": "0.5591989", "text": "def plugin_instance\n @plugin_instance ||= \n Contenter::Plugin.factory(plugin).new(:content_type => self)\n end", "title": "" }, { "docid": "ab342a17e1ac318133e72ffbc3065551", "score": "0.55732965", "text": "def start(aibot)\n if configuration[:networks]\n # Loop through our networks, creating an <i>IRCBot</i> from the configuration for each.\n configuration[:networks].each do |network_name, network_config|\n bot = Cinch::Bot.new do\n # Our bot configuration.\n configure do |bot_config|\n bot_config.realname = network_config[:name]\n bot_config.nick = network_config[:nick]\n bot_config.user = network_config[:user]\n bot_config.server = network_config[:server]\n bot_config.port = network_config[:port] || 6667\n bot_config.ssl.use = network_config[:ssl]\n bot_config.channels = network_config[:channels]\n\n bot_config.plugins.prefix = /#{network_config[:plugin_prefix] || '^::'}/\n bot_config.plugins.plugins = []\n\n network_config[:plugins].each do |plugin_name, plugin_config|\n require_path = plugin_config[:require_path]\n class_path = plugin_config[:class_path]\n\n unless class_path.nil?\n require require_path unless require_path.nil?\n\n plugin_constant = Kernel.const_get(class_path)\n bot_config.plugins.plugins << plugin_constant\n\n configuration = plugin_config[:configuration]\n bot_config.plugins.options[plugin_constant] = configuration unless configuration.nil?\n end\n\n end if network_config[:plugins]\n end\n\n # Learn and respond to messages.\n # TODO: This is temporary. Will use plugins in the near future.\n on :message do |msg|\n bot = msg.bot\n message = msg.message\n\n if message.include?(bot.nick)\n message = message.gsub(bot.nick, '').squeeze(' ')\n response = aibot.respond(message).split\n\n if response.first.eql?(\"\\x01action\")\n response.delete(response.first)\n msg.safe_action_reply(response.join(' ')) if network_config[:silenced].nil?\n else\n msg.safe_reply(response.join(' ')) if network_config[:silenced].nil?\n end\n\n else\n aibot.learn(message)\n end\n end\n\n # Auto join after being kicked.\n on :kick do |msg|\n bot = msg.bot\n bot.join(msg.channel.name)\n end\n end\n @bots << bot\n end\n\n # Start our bots.\n @bots.each do |bot|\n @threads << Thread.new do\n bot.start\n end\n end\n\n # Wait (indefinitely) for the threads to join.\n @threads.each { |thread| thread.join }\n else\n raise \"Could not find a 'networks' entry in the IRC configuration!\"\n end\n end", "title": "" }, { "docid": "87ce3b2e5140212945daa3876ab43e4b", "score": "0.5566619", "text": "def install\n # Load the plugin\n self.load\n # Also, if there is an \"install.rb\" script present, run that to setup anything the plugin needs (database tables etc)\n require File.join(self.path, \"install.rb\") if File.exists?(File.join(self.path, \"install.rb\"))\n rescue Exception => err\n # Catch the error, delete the plugin, and raise an error again\n self.destroy!\n raise \"Error installing plugin: #{err.message}!\"\n end", "title": "" }, { "docid": "2e765f45d2dd4ce6c926905985dc4ac5", "score": "0.555919", "text": "def initialize\n Puppet.settings.use(:main, :ssl, :agent)\n\n self.class.instance = self\n @running = false\n @splayed = false\n end", "title": "" }, { "docid": "3372e0a45c8b4269cda02255bcd2b115", "score": "0.5557409", "text": "def plugin_manager\n @plugin_manager ||=\n begin\n @@plugin_manager ||=\n Plugin::Manager.factory.new(:main => self)\n x = @@plugin_manager # .dup\n x.main = self\n x\n end\n end", "title": "" }, { "docid": "1eb39a76eae04d619d85a0e838bfb01a", "score": "0.5553727", "text": "def plugins\n\n end", "title": "" }, { "docid": "429429bc9175dd7d34b8333979acea2e", "score": "0.55513847", "text": "def initialize(driver, missions, host)\n @driver = driver\n @missions = missions.dup\n @done = false\n @host = host\n setup_waker\n end", "title": "" }, { "docid": "7fe6a044801d17a942efc378f9a1fd72", "score": "0.5544674", "text": "def initialize(plugin_class_name, services = {})\n @delegate_plugin = Creator.new(plugin_class_name).create(services)\n end", "title": "" }, { "docid": "dde16361c40d315d411226852980d5c1", "score": "0.5540738", "text": "def setup\n yield(@bots)\n end", "title": "" }, { "docid": "1f98c6138ff18d492532c6a4b51be601", "score": "0.5536997", "text": "def initialize\n register_script \"Bot to user response time checker.\"\n\n register_command \"ping\", :cmd_ping, 0, 0, nil, \"Measure the time it takes for the bot to receive a reply to a CTCP PING from your client.\"\n\n register_event :NOTICE, :on_notice\n\n @pending = Hash.new\nend", "title": "" }, { "docid": "3a6efcc1cf1b383723d9f2c5356d904b", "score": "0.55362433", "text": "def create_test_bot(config = {\"server\" => {\"nick\" => \"Hellbender\"}})\n bot = Hellbender::Bot.new(config)\n bot.log.level = Logger::FATAL\n class << bot\n def process_msg(*args)\n # wait for all the subscribers to finish running\n super.each(&:join)\n end\n end\n return bot\nend", "title": "" }, { "docid": "72027a1978b22777d2a2dfd4ee347589", "score": "0.5529386", "text": "def init_plugins\n @inits.each do |plugin,callback|\n begin\n logger.debug(\"initializing plugin #{plugin.name}\")\n callback.call(plugin)\n rescue\n logger.error(\"failed initialing plugin: %s\",plugin.name,$!)\n end\n end\n @inits.clear # only do once!\n end", "title": "" }, { "docid": "70c746f16b82416a18f03cf07a6cb959", "score": "0.55242175", "text": "def initialize\n @agent = GhostInTheMachine.new('Mechanize', Mock::PoltergeistDriver.new)\n end", "title": "" }, { "docid": "b058bf394b596c6d117c029b215353f5", "score": "0.55118245", "text": "def plugin_loaded\n end", "title": "" }, { "docid": "d755bb670af6ae55dbc42d41b4f62a2e", "score": "0.5506438", "text": "def load_plugins\n print \"Enabled plugins:\\n\"\n @config['plugins'].each do |name,state|\n next if state == '0'\n print \"#{name}... \"\n\n # instantiate plugin class\n begin\n clazz = Object.const_get(\"Foxplorer#{name.capitalize}\")\n plugin = clazz.new(@hooks)\n print \"ok\\n\"\n rescue Exception => error\n print \"error: #{error}\\n\"\n abort\n end\n end\n end", "title": "" }, { "docid": "cb9e7bba9829b638816f8dec97a651a0", "score": "0.54963416", "text": "def cmd_load(irc, plugin)\n if !$user.caps(irc, 'admin', 'owner').any?\n irc.reply \"You're not a bot administrator, so don't even start!\"\n elsif !plugin or plugin.empty?\n irc.reply \"USAGE: load <plugin name>. This command will not reload an already loaded plugin. Use 'reload' for that.\"\n elsif $plugins[pn = plugin.downcase]\n irc.reply \"That plugin is already loaded! (To reload it, use the 'reload' command).\"\n else\n begin\n if !load_plugin(pn)\n irc.reply \"Error loading plugin: File not found in plugin path.\"\n elsif (klass = self.class.const_get(pn.capitalize))\n ins = klass.instance\n $plugins[ins.name] = ins\n irc.reply 'Plugin loaded successfully!'\n else\n $log.puts \"Error loading plugin '#{pn.capitalize}':\"\n $log.puts \"Couldn't locate plugin class.\"\n irc.reply \"Error loading plugin: Couldn't locate the plugin class.\"\n end\n rescue Exception => e\n $log.puts \"Error loading plugin '#{pn.capitalize}':\"\n $log.puts e.message\n $log.puts e.backtrace.join(\"\\n\")\n irc.reply \"Error loading plugin: #{e.message}\"\n end\n end\n end", "title": "" }, { "docid": "ced60953b52f76e11853cb16a79ebc78", "score": "0.548048", "text": "def new *args, &block\n puts \"--------- Initializing through PluginInit for #{self}\"\n o = super\n puts \"super: #{o}\"\n puts \"self: #{self}\"\n puts Pluginable.redefinable\n puts Pluginable.redefinable[self].first.class\n puts \"---------\"\n puts o.instance_eval(\"class << self; self; end\").ancestors.inspect\n Pluginable.redefinable[self].reverse.each do |plugin_module|\n o.extend(plugin_module.const_get(self.name.split(\"::\").last)) \n end unless Pluginable.redefinable[self].empty?\n puts o.instance_eval(\"class << self; self; end\").ancestors.inspect\n o\n end", "title": "" }, { "docid": "2f3afc49f59884dcfb53e6898aa85ed1", "score": "0.54796726", "text": "def add_bot b\n @bot = b\n end", "title": "" }, { "docid": "22f731e14470c3d9727bf62ddaa49f88", "score": "0.5475776", "text": "def run\n @options.parse!\n\n # Install/update plugins\n (PLUGINS & installed_plugins).each { |plugin| update_plugin(plugin) }\n (PLUGINS - installed_plugins).each { |plugin| install_plugin(plugin) }\n\n # Install/update mediawiki-vagrant plugin\n gem_path = build_gem\n\n begin\n install_plugin(gem_path)\n ensure\n Dir['mediawiki-vagrant-*.gem'].each { |gem| File.unlink(gem) }\n end\n\n # Configure required settings\n configure_settings unless @silent\n\n notify \"\\nYou're all set! Simply run `vagrant up` to boot your new environment.\"\n notify \"\\n(Or try `vagrant config --list` to see what else you can tweak.)\"\n end", "title": "" }, { "docid": "859bcc6ba102a26add96cd015c394b19", "score": "0.5475322", "text": "def init!\n subcommand_option_handling :normal\n load_config\n apply_config\n load_plugins\n commands_from 'conjur/command'\n end", "title": "" }, { "docid": "81ab00ba76418fb89fd3b234c9cfae5c", "score": "0.54653984", "text": "def init_order_bot\n reply \"Hi there, I'm #{connection.config.nick}! I am initializing for the first time, this may take a while...\"\n\n # Can't seem to store these as class variables - so we'll place them in our internal hash\n store['orders_hash'] = {}\n store['notes_hash'] = {}\n store['users'] = {}\n store['ordered'] = false\n store['link'] = nil\n\n # Mutex to control access to the hash containing users/orders info\n store['nag_thread'] = nil\n\n # Flag it as initialized\n store['initialized'] = true\n end", "title": "" }, { "docid": "1accee79db3bd5a0af9453aa357dadb3", "score": "0.54564947", "text": "def initialize\n @username = ''\n @password = ''\n @channel = ''\n @plugins = []\n @message_queue = Queue.new\n @command_prefix = '!'\n\n yield self\n\n @channel = Channel.new(@channel)\n end", "title": "" }, { "docid": "54e5f113b4b42d13c91a3893dc9b0682", "score": "0.5449615", "text": "def start\n Plugin.load!\n Email.check\n end", "title": "" }, { "docid": "7646d1a90412d7a252f452855772356b", "score": "0.54436326", "text": "def init_plugins\n methods.grep(/^init_plugin_/).each{|method_name| send(method_name) }\n end", "title": "" }, { "docid": "ce6e224c0cd05616800a18f5de0c981a", "score": "0.54416275", "text": "def initialize()\n @name2node = Hash.new\n if NodeHandler.JUST_PRINT\n puts \">> Opening communication channels\"\n else\n @handlerCommands = Hash.new\n serverCmd = OConfig['commServer'] || raise(\"OConfig: Missing 'commServer' path\" )\n serverCmd = serverCmd.gsub(/%ID%/, Experiment.ID)\n @server = ExecApp.new(:commServer, self, serverCmd)\n sleep 2 # give the app time to start or fail\n end\n @@instantiated = true\n end", "title": "" }, { "docid": "7bcb9192948013ecc0f84ec21d707880", "score": "0.5441521", "text": "def initialize(ui_klass='IO', run_method=:puts, init_info=1)\n self.ui = Object.const_get(ui_klass).new(init_info) # base method (super call this)\n self.timer = SleepTimer.new(ui, run_method)\n initialize_plugins \n end", "title": "" }, { "docid": "2840e40f95da87be6ebf9efe094049e5", "score": "0.5441391", "text": "def initialize(core, plugin_configuration)\n @core = core\n @plugin_configuration = plugin_configuration\n # configure base slot\n @base_slot = @core.bus[\"/plugins/#{@plugin_configuration.name}\"]\n @base_slot.propagate_notifications = false\n @base_slot.manager = self\n # create properties manager\n if @plugin_configuration.properties_path\n @properties = Properties.new(@plugin_configuration.name, \"1.0\", @base_slot[\"properties\"], @plugin_configuration.base_path+\"/\"+@plugin_configuration.properties_path) \n end\n #local log\n @base_slot[\"log/info\"].queue\n @base_slot[\"log/error\"].queue\n @base_slot[\"log/debug\"].queue\n @base_slot[\"log\"].subscribe self\n @base_slot[\"state\"].data = UNLOADED\n end", "title": "" }, { "docid": "d4cf66f1dcb4bff5c8627464cfdb495c", "score": "0.54371005", "text": "def post_init\n puts \"Connected\"\n execute \"USER #@nick botz botz :Botz\"\n execute \"NICK #@nick\"\n execute \"JOIN #@channel\"\n end", "title": "" }, { "docid": "8ed17b5860ced61c4a43801aff988d09", "score": "0.54361826", "text": "def plugin\n server.plugin(plugin_id)\n end", "title": "" }, { "docid": "473b7fc0a74e65ed5af284890719000d", "score": "0.5430599", "text": "def load\n # Setup the Gem path to the plugin\n Gem.use_paths(Gem.dir, ((Gem.path - [Gem.dir]) + [self.path]))\n # Load the plugin init script\n require File.join(self.path, \"init.rb\")\n # Add the plugin to the array of loaded plugins\n @@loaded << self.name\n end", "title": "" }, { "docid": "b69a102db91bdd6ecc6af8003f9e6ada", "score": "0.54284316", "text": "def instance\n unless @plugin_instance\n @plugin_instance = FreeBASE::Plugin.new(@configuration.core, self)\n end\n @plugin_instance\n end", "title": "" }, { "docid": "b0ed3213f1aab239bc43175aefa11c30", "score": "0.54278463", "text": "def initialize_client\n @client = RobinhoodClient.interactively_create_client\n end", "title": "" }, { "docid": "0de3c3cd2d52cbda69eaa630ef5de6e6", "score": "0.5426324", "text": "def load\n # Plugin dependencies let you load a plugin before this one,\n # so we don't want to load that sucker twice, now do we?\n unless loaded?\n # Setup the Gem path to the plugin\n Gem.use_paths(Gem.dir, ((Gem.path - [Gem.dir]) + [self.path]))\n # Load the plugin init script\n require File.join(self.path, \"init.rb\")\n # Add the plugin to the array of loaded plugins\n @@loaded << self.name\n end\n end", "title": "" }, { "docid": "67c7a3e23e36527eb8aeeb116bd1b61f", "score": "0.5417208", "text": "def initialize(app, opts)\n log(6, \"instantiated plugin #{self.class.to_s}\", opts.to_s)\n @app = app\n end", "title": "" }, { "docid": "0658a6afb60890d9206fde5908615fe8", "score": "0.54145944", "text": "def initialize(namespace, plugin_type, provider, options)\n @actor = Nucleon.handle(self)\n\n config = Util::Data.clean(Config.ensure(options), false)\n name = Util::Data.ensure_value(config.delete(:plugin_name), config.delete(:name, provider))\n\n @quiet = config.delete(:quiet, false)\n\n set_meta(config.delete(:meta, Config.new))\n\n # No logging statements above this line!!\n super(config.import({ :logger => \"#{namespace}->#{plugin_type}->#{plugin_provider}\" }), {}, true, false, false)\n myself.plugin_name = name\n\n logger.debug(\"Normalizing #{namespace} #{plugin_type} plugin #{plugin_name}\")\n normalize(false)\n\n @initialized = true\n end", "title": "" }, { "docid": "cdca8fa7df7a9aa9df80d7fda297ba71", "score": "0.5412546", "text": "def generate!\r\n initialize_repository\r\n install_plugins\r\n track_all_files\r\n push_to_server\r\n end", "title": "" }, { "docid": "2ea6c97b115170725b08d7e8b1ccc9d8", "score": "0.5410944", "text": "def initialize_plugin(options)\n klass = plugin_class\n fail \"Could not load class: #{_constant_name.inspect}\" unless klass\n\n klass.new(options)\n rescue ArgumentError => e\n fail \"Failed to call #{klass}.new(options): #{e}\"\n end", "title": "" } ]
42f7e7c265dbdb9b64d367aa75733326
Render a dropdown button as filter select
[ { "docid": "6a45e263c30812a700e63aebf2ec13e7", "score": "0.67708045", "text": "def values_dropdown query_params, field\n filter_opts = query_params.filters[field] || {}\n value = query_params.filter_value(field)\n values = filter_opts[:values] || []\n\n label = [field_name(field), field_value_human(field, value)].compact.join(\" : \")\n bootstrap_dropdown_button(label) do\n concat(content_tag :li, link_to(t(\"act_as_admin.actions.all\"), query_params.filter(field).url)) unless value.blank?\n values.each do |v|\n html_opts = {:class=>\"active\"} if value.eql?(v.to_s)\n url = query_params.filter(field,v).url\n label = field_value_human(field, v)\n concat content_tag(:li, link_to(label, url, html_opts))\n end\n end\n end", "title": "" } ]
[ { "docid": "241f8a50c11c9463a17098ef285dbc8a", "score": "0.71545124", "text": "def filter_button(label='Apply Filter', options={}, html_options={})\n options.reverse_merge! :prefix => 'filter'\n html_options.reverse_merge! :disabled => true, :type => 'button',\n :value => label, :id => \"#{options[:prefix]}_button\"\n\n p = params.dup\n p.delete_if {|key, value| [options[:prefix], 'action', 'controller'].include? key}\n p = p.to_query\n p += '&' unless p == ''\n\n html_options[:onclick] = \"#{html_options[:onclick]};location.href='?#{p}' + $$('select.#{escape_javascript options[:prefix]}_select').inject([], function(m, e) {m.push(e.getAttribute('name') + '=' + encodeURIComponent($F(e))); return m}).join('&')\"\n\n tag 'input', html_options\n end", "title": "" }, { "docid": "241f8a50c11c9463a17098ef285dbc8a", "score": "0.71545124", "text": "def filter_button(label='Apply Filter', options={}, html_options={})\n options.reverse_merge! :prefix => 'filter'\n html_options.reverse_merge! :disabled => true, :type => 'button',\n :value => label, :id => \"#{options[:prefix]}_button\"\n\n p = params.dup\n p.delete_if {|key, value| [options[:prefix], 'action', 'controller'].include? key}\n p = p.to_query\n p += '&' unless p == ''\n\n html_options[:onclick] = \"#{html_options[:onclick]};location.href='?#{p}' + $$('select.#{escape_javascript options[:prefix]}_select').inject([], function(m, e) {m.push(e.getAttribute('name') + '=' + encodeURIComponent($F(e))); return m}).join('&')\"\n\n tag 'input', html_options\n end", "title": "" }, { "docid": "c65da6721a524d5f2e77c41cf6d6870b", "score": "0.66767424", "text": "def select_filter_drop_downs search_filter , value\n case search_filter\n when 'filter_type'\n select_from_drop_down 's:swfield', value\n when 'filter_category'\n select_from_drop_down 'rc:swfield', value\n when 'filter_sub_category'\n select_from_drop_down 'c1:swfield', value\n when 'bathroom minimum'\n select_from_drop_down 'bathrooms__gte:swfield', value\n when 'item sorting'\n select_from_drop_down 'id_sort_by', value\n end\n end", "title": "" }, { "docid": "5242413764d5397b692967d27c8c2fae", "score": "0.6521623", "text": "def filter_buttons(base_path, filters = {})\n buttons = filters.map do |filter, values|\n btn_color = @filters.has_key?(filter) ? 'primary' : 'secondary'\n btn = content_tag(:button, filter.to_s.humanize,\n class: \"tiny radius button dropdown #{btn_color}\", 'data-dropdown' => filter)\n\n list_items = values.map do |varr|\n val, str = *varr\n str ||= varr\n if @filters[filter] == val.to_s\n query_params = @filters.reject { |f, k| f == filter.to_s }\n link = link_to(str.to_s.humanize + ' - Clear', query_params, class: 'canceled')\n else\n query_params = @filters.merge(filter => val)\n link = link_to(str.to_s.humanize, send(base_path, query_params))\n end\n content_tag(:li, link)\n end.join.html_safe\n\n ul = content_tag(:ul, list_items, class: 'f-dropdown right-arrow', id: filter,\n data: {dropdown_content: ''})\n content_tag(:li, btn + ul, class: 'filter left')\n end.join.html_safe\n\n content_tag(:ul, buttons)\n end", "title": "" }, { "docid": "1d4625c4aa1d8d2bf8933797e1c15b11", "score": "0.65050024", "text": "def dropdown_button(text, icon_key = nil, options = {}, &block)\n content_tag(:div, class: 'btn-group') do\n content_tag(:div, :type => 'button', :class => \"btn dropdown-toggle #{options[:type] || 'btn-default'}\".strip,\n 'data-toggle' => 'dropdown', 'aria-expanded' => 'false', 'data-tooltip' => options[:tooltip]) do\n ((icon_key ? icon_tag(icon_key, options.delete(:icon_options) || {}) : '') +\n text + ' <span class=\"caret\"></span>'.html_safe)\n end +\n content_tag(:ul,\n merge_options({ class: 'dropdown-menu text-left', role: 'menu' }, options.delete(:menu_options)), &block)\n end\n end", "title": "" }, { "docid": "d477aa16b431d913bb43f699319a2da1", "score": "0.6444617", "text": "def filter_option(form_builder, field, option)\n selected = matches_filter_option(field, option[1])\n options = {}\n options[:label] = option[0]\n options[:required] = false\n options[:input_html] = { :id => \"filter_#{field}_#{option[1]}\", :type => :checkbox, :value => option[1], :multiple => true }\n options[:input_html][:checked] = selected\n options[:label_html] = { :for => \"filter_#{field}_#{option[1]}\" }\n options[:wrapper_html] = { :class => \"filter-controls-hidden\" }\n\n klass = [\"filter-options\"]\n klass << \"selected\" if selected\n\n add_filter_klass = [\"filter-add\"]\n if selected\n add_filter_klass << \"icon-remove\"\n else\n add_filter_klass << \"icon-plus\"\n end\n\n content = link_to(\"\", \"#\", :class => add_filter_klass.join(' '))\n content << form_builder.input(field, options)\n\n content_tag :li, content, :class => klass.join(' ')\n end", "title": "" }, { "docid": "17be7c8a628dcfcfe1b011e11bf89dcb", "score": "0.64320683", "text": "def render_search_dropdown(search_fields)\n content_tag(:ul, class: 'dropdown-menu', id: 'js_search_type') do\n search_fields.each do |key, value|\n # FIXME: It sould not be necessary to camelcase anything here, since the fieldname is all_fields and date_issued - but somewhere the keys gets translated/labeled\n key = key.gsub(/\\s+/, \"\").camelize(:lower) # FIXME: This is part of the uneven translation thing we need to look into\n concat(content_tag(:li, content_tag(:a, t('kb.search.limit.' + key), {href: '#'}), {id: value}))\n end\n end\n end", "title": "" }, { "docid": "1416e57637fbb04d60cd56de1f741128", "score": "0.6359789", "text": "def search_bar_select\n blacklight_config.search_fields.collect do |key, field_def|\n [field_def.dropdown_label || field_def.label, field_def.key] if should_render_field?(field_def)\n end.compact\n end", "title": "" }, { "docid": "021872bb9a07f1f8a4fd94b9bc9e56e1", "score": "0.6356937", "text": "def build_select(type, select_options_as_html); end", "title": "" }, { "docid": "68ade63aa98da37dd414f434edcb7619", "score": "0.6267909", "text": "def dropdown_button(label = nil, options = {}, &block)\n\t\t\t\toptions = options.nil? ? {} : options\n\t\t\t\tstyle = options[:style] ? options[:style] : \"default\"\n\t\t\t\tsize = options[:size] ? options[:size] : nil\n\t\t\t\tcolor = options[:color] ? options[:color] : nil\n\t\t\t\thorizontal = options[:horizontal] ? options[:horizontal].to_sym : :left\n\t\t\t\tvertical = options[:vertical] ? options[:vertical].to_sym : :down\n\t\t\t\tklass = options[:class] ? options[:class] : \"\"\n\t\t\t\tid = options[:id] ? options[:id].to_s.to_id : nil\n\t\t\t\tactive = (options[:active] == true)\n\t\t\t\tlabel = RugBuilder::IconBuilder.new(@template).render(\"caret-down\") if label.blank?\n\n\t\t\t\tresult = \"\"\n\t\t\t\tresult += \"<div class=\\\"drop#{vertical.to_s}\\\">\" if options[:wrap] != false\n\t\t\t\tresult += \"<button \n\t\t\t\t\ttype=\\\"button\\\" \n\t\t\t\t\tclass=\\\"btn btn-#{style.to_s} #{size ? \"btn-\" + size.to_s : \"\"} #{color ? \"color-\" + color.to_s : \"\"} #{active ? \"active\" : \"\"} dropdown-toggle #{klass.to_s}\\\" \n\t\t\t\t\tdata-toggle=\\\"dropdown\\\" \n\t\t\t\t\taria-haspopup=\\\"true\\\" \n\t\t\t\t\taria-expanded=\\\"false\\\"\n\t\t\t\t\t#{id ? \"id=\\\"\" + id + \"\\\"\" : \"\"}\n\t\t\t\t>\"\n\t\t\t\tresult += label\n\t\t\t\tresult += \"</button>\"\n\t\t\t\tresult += \"<ul class=\\\"dropdown-menu #{horizontal == :right ? \"dropdown-menu-right\" : \"\"}\\\">\" \n\t\t\t\tresult += @template.capture(RugBuilder::MenuBuilder.new(@template), &block).to_s\n\t\t\t\tresult += \"</ul>\"\n\t\t\t\tresult += \"</div>\" if options[:wrap] != false\n\n\t\t\t\treturn result.html_safe\n\t\t\tend", "title": "" }, { "docid": "722f9cc447f03271df0ec93cf04d5f69", "score": "0.6234474", "text": "def filter_markup\n content_tag(:input, nil, type: :text, class: 'pure-admin-multiselect-filter-input',\n autocomplete: :off, placeholder: 'Filter', style: 'display: none;')\n end", "title": "" }, { "docid": "d6af83c966888567a9b39582620d8d05", "score": "0.61819017", "text": "def button_dropdown(title, list, toggle_button = true)\n dropdown(title, list, toggle_button, {class: [\"btn-group\"]}, {class: [\"btn\", \"btn-default\", \"dropdown-toggle\"]})\n end", "title": "" }, { "docid": "44be7b7e47ef1f9f61d41697415ff4c2", "score": "0.61646205", "text": "def button_dropdown(title, list, toggle_button = true)\n dropdown(title, list, toggle_button, {class: [\"btn-group\"]}, {class: [\"btn\", \"btn-default\", \"dropdown-toggle\"]})\n end", "title": "" }, { "docid": "bc349e2588581a798e2af451816c4a61", "score": "0.61231446", "text": "def scope_buttons query_params, field\n filter_opts = query_params.filters[field] || {}\n value = query_params.filter_value(field)\n values = filter_opts[:values] || []\n\n bootstrap_btn_group(values) do |v|\n filter_value = v unless value.eql?(v.to_s)\n\n url = query_params.filter(field, filter_value).url\n html_opts = active_btn_option(filter_value.nil?)\n concat link_to(field_value_human(field, v), url, html_opts)\n end\n end", "title": "" }, { "docid": "eded9b85f1b6112b90657780fab5ce03", "score": "0.6120127", "text": "def search_bar_select\n blacklight_config.search_fields.map do |_key, field_def|\n if should_render_field?(field_def)\n [\n field_def.dropdown_label ||\n field_def.label, field_def.key, { 'data-placeholder' => placeholder_text(field_def) }\n ]\n end\n end.compact\n end", "title": "" }, { "docid": "effad6ca06bb5a0845941921bff1616d", "score": "0.60582614", "text": "def leet_filter_button(s)\n button_tag(s, onclick: \"leetFilter.filterAllBut(this);\")\n end", "title": "" }, { "docid": "0c515dc02235834fcde6c1fc56d8acc1", "score": "0.6055323", "text": "def dropdown inner, args={}\n\t\t\ta = []\n\t\t\tprompt = (args && args[:prompt]) ? args[:prompt] + \" \" : \"\"\n\t\t\ta << '<a type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">'+prompt+'<span class=\"caret\">'\\\n\t\t\t '</span><span class=\"sr-only\">Toggle Dropdown</span></a>'\n\n\t\t\ta << inner\n\n\t\t\ta.flatten\n\t\tend", "title": "" }, { "docid": "ddd53fcc81e11f96cdcd0a4a0780ca1b", "score": "0.60484976", "text": "def hops_cc_dropdown\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\"div[class='cc']>select, select[id~='CCTypesDropDown']\"), __method__, self)\n end", "title": "" }, { "docid": "f0cf610863c712ffde539d3f521fa8a3", "score": "0.60025007", "text": "def dropdown(title, list, toggle_button = true, html_options = {:class => \"dropdown\"}, toggle_html_options = {class: \"dropdown-toggle\"}, menu_html_options={class: \"dropdown-menu\"})\n data_toggle_option = {data: {toggle: \"dropdown\"}}\n toggle_html_options.merge!(data_toggle_option)\n button_html_options = {class: [\"btn\", \"btn-default\"]}\n button_html_options.merge!(data_toggle_option) if toggle_button\n content_tag(:div, html_options) {\n content_tag(:button, title, button_html_options) +\n # Need to explicitly add margin-top for firefox. WTF?\n content_tag(:button, toggle_html_options) { content_tag(:span, nil, class: \"caret\") } +\n content_tag(:ul, menu_html_options.merge(role: \"menu\")) {\n list.collect { |member|\n content_tag(:li){ member }\n }.join.html_safe\n }\n }\n end", "title": "" }, { "docid": "b53be979840364b5cb6934d549304d85", "score": "0.59619087", "text": "def gsm_filter_submit_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.id(create_ats_regex_string(\"btnFilter\")), __method__, self)\n end", "title": "" }, { "docid": "d33e033787ace1f0a65c155d683a080f", "score": "0.58753526", "text": "def show_filter_button\n return @show_filter_button\n end", "title": "" }, { "docid": "bf86fb15d456c408b238fe38261691e8", "score": "0.58749557", "text": "def show_filter_button=(value)\n @show_filter_button = value\n end", "title": "" }, { "docid": "475ebe67cbc060e157f089cddae61f22", "score": "0.5855081", "text": "def dropdown(title, list, toggle_button = true, html_options = {class: \"dropdown\"}, toggle_html_options = {class: \"dropdown-toggle\"}, menu_html_options = {class: \"dropdown-menu\"})\n data_toggle_option = {data: {toggle: \"dropdown\"}}\n toggle_html_options.deep_merge!(data_toggle_option)\n button_html_options = {class: [\"btn\", \"btn-default\"]}\n button_html_options.deep_merge!(data_toggle_option) if toggle_button\n content_tag(:div, html_options) do\n content_tag(:button, title, button_html_options) +\n # Need to explicitly add margin-top for firefox. WTF?\n content_tag(:button, toggle_html_options) { content_tag(:span, nil, class: \"caret\") } +\n content_tag(:ul, menu_html_options.merge(role: \"menu\")) do\n list.map do |member|\n content_tag(:li){ member }\n end.join.html_safe\n end\n end\n end", "title": "" }, { "docid": "138b83fde5344da0722e0c58a6e3114e", "score": "0.58452314", "text": "def to_dropdown(options = {})\r\n acts_as_dropdown(options) unless options.empty?\r\n find(:all, :conditions => self.conditions_string, :order => self.order_string).to_dropdown(self.dropdown_text_attr.to_sym, self.dropdown_value_attr.to_sym)\r\n end", "title": "" }, { "docid": "aa7f64f45d3a94347257fb6df2593ce0", "score": "0.582728", "text": "def puc_puc_type_code_search_combo_changed\n\tpuc_type_code = get_selected_combo_value(params)\n\tsession[:puc_search_form][:puc_type_code_combo_selection] = puc_type_code\n\t@puc_codes = Puc.find_by_sql(\"Select distinct puc_code from pucs where puc_type_code = '#{puc_type_code}'\").map{|g|[g.puc_code]}\n\t@puc_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('puc','puc_code',@puc_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "a03248e25c204cc3b8121dc50b1aa722", "score": "0.58159053", "text": "def ui_dropdown_select_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render\n end", "title": "" }, { "docid": "43e6eb26c0f9d39fa00a088bec92a3ec", "score": "0.57619387", "text": "def data_grid_filter(data_grid, column)\n hidden_submit_input = '<input type=\"submit\" value=\"\" style=\"width:0px; height: 0px; border: none; padding: 0px; font-size: 0px\">'.html_safe\n output = ''\n col_index = data_grid.columns.index(column)\n case column.filter\n when :boolean\n filter_select_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_select_name => nil))\n output = select_tag(filter_select_name,\n options_for_select([[I18n.t('data_grid.all_options'), ''], [I18n.t('data_grid.option_true'), '1'], [I18n.t('data_grid.option_false'), '0']], column.filter_value),\n :onchange => \"window.location.href='#{base_url}#{(base_url.include?('?')) ? '&' : '?' }#{filter_select_name}=' + this.value\")\n when :auto\n filter_select_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_select_name => nil))\n output = select_tag(filter_select_name,\n options_for_select([[I18n.t('data_grid.all_options'), '']] + column.filter_data.map{|fd| [column.auto_filter_hash.nil? ? fd : column.auto_filter_hash[fd.to_s.to_sym], fd]}, column.filter_value),\n :onchange => \"window.location.href='#{base_url}#{(base_url.include?('?')) ? '&' : '?' }#{filter_select_name}=' + this.value\")\n \n when :text\n filter_input_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_input_name => nil))\n output = form_tag(base_url, :method => 'GET') do\n text_field_tag(filter_input_name, column.filter_value) + \n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name]) + \n hidden_submit_input\n end\n when :number\n filter_input_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_input_name => nil))\n output = form_tag(base_url, :method => 'GET') do\n text_field_tag(filter_input_name, column.filter_value, :class => 'data_grid_filter_input') + \n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name]) + \n hidden_submit_input\n end\n when :range\n filter_input_name_from = \"filter_#{data_grid.name}_#{col_index}_from\"\n filter_input_name_to = \"filter_#{data_grid.name}_#{col_index}_to\"\n base_url = url_for(data_grid.params.merge(filter_input_name_from => nil, filter_input_name_to => nil))\n output = form_tag(base_url, :method => 'GET') do\n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name_from, filter_input_name_to]) + \n text_field_tag(filter_input_name_from, column.filter_value.to_s.split(DataGrid.range_separator)[0], :class => 'data_grid_filter_input') + \n ' - ' + \n text_field_tag(filter_input_name_to, column.filter_value.to_s.split(DataGrid.range_separator)[1], :class => 'data_grid_filter_input') +\n hidden_submit_input\n end\n \n when :date \n date_format = I18n.t(:\"date.formats.default\", {:locale => I18n.locale })\n filter_input_name_from = \"filter_#{data_grid.name}_#{col_index}_from\"\n filter_input_name_to = \"filter_#{data_grid.name}_#{col_index}_to\"\n form_id = \"filter_#{data_grid.name}_#{col_index}_form\"\n \n base_url = url_for(data_grid.params.merge(filter_input_name_from => nil, filter_input_name_to => nil))\n output = \"<form method='get' action='#{base_url}' id='#{form_id}'>\"\n output << data_grid_dump_as_hidden_fields(data_grid, [filter_input_name_from, filter_input_name_to])\n \n date_picker, datepicker_placeholder_id, trigger_id, dom_id, date_span_id = select_date_datetime_common(\n {:id => \"filter_#{data_grid.name}_#{col_index}_from\", :name => filter_input_name_from}, data_grid.params[filter_input_name_from], form_id)\n\n output << \"#{I18n.t('data_grid.filter_date_from')}: <span id=\\\"#{datepicker_placeholder_id}\\\">#{date_picker}</span>\"\n output << %(<script type=\"text/javascript\">\\n)\n output << %( Calendar.setup\\({\\n)\n output << %( button : \"#{trigger_id}\",\\n )\n output << %( ifFormat : \"#{date_format}\",\\n )\n output << %( inputField : \"#{dom_id}\",\\n )\n output << %( include_blank : true,\\n )\n output << %( singleClick : true,\\n)\n output << %( onClose : function(cal){handleCalendarClose(cal, \"#{dom_id}\", \"#{form_id}\");}\\n)\n output << %( }\\);\\n)\n output << %(</script><br />\\n)\n \n date_picker, datepicker_placeholder_id, trigger_id, dom_id, date_span_id = select_date_datetime_common(\n {:id => \"filter_#{data_grid.name}_#{col_index}_to\", :name => filter_input_name_to}, data_grid.params[filter_input_name_to], form_id)\n\n output << \"#{I18n.t('data_grid.filter_date_to')}: <span id=\\\"#{datepicker_placeholder_id}\\\">#{date_picker}</span>\"\n output << %(<script type=\"text/javascript\">\\n)\n output << %( Calendar.setup\\({\\n)\n output << %( button : \"#{trigger_id}\",\\n )\n output << %( ifFormat : \"#{date_format}\",\\n )\n output << %( inputField : \"#{dom_id}\",\\n )\n output << %( include_blank : true,\\n )\n output << %( singleClick : true,\\n)\n output << %( onClose : function(cal){handleCalendarClose(cal, \"#{dom_id}\", \"#{form_id}\");}\\n)\n output << %( }\\);\\n)\n output << %(</script>\\n)\n \n output << hidden_submit_input\n output << '</form>'\n \n else\n output = '&nbsp;'\n end\n\n raw output\n end", "title": "" }, { "docid": "d0196130172af640be38905e1a83353e", "score": "0.5716341", "text": "def action_dropdown actions, opts={}\n return unless actions.size > 0\n data = opts.delete(:data_item)\n actions = actions.to_a\n first = actions.slice(0)\n reset = actions.slice(1..actions.size-1)\n main_btn = action_link *[first[0], first[1].merge(opts), data].compact\n return main_btn unless reset.size > 0\n\n content_tag(:div, :class=>\"btn-group\") do\n concat main_btn\n concat content_tag(:button, content_tag(:span, \"\", :class=>\"caret\"), :class=>\"btn dropdown-toggle\", :\"data-toggle\"=>\"dropdown\")\n concat(content_tag(:ul, :class=>\"dropdown-menu\"){\n reset.each{|item| concat content_tag(:li, action_link(item[0], item[1].except(:class), data))}\n })\n end\n end", "title": "" }, { "docid": "1100eeba6101e9ebfe7271a444e46dbd", "score": "0.5709943", "text": "def render_dropdown\n '<li class=\"'+self.phone_class+'\">'+self.page_builder.context.link_to(iconed_label, '#', onclick: self.javascript) + '</li>'\n end", "title": "" }, { "docid": "bd6010e30dee2938188ce6631d415d3f", "score": "0.56877077", "text": "def make_select\n text = \"<select name='event'>\"\n @@events.each do |key, val|\n text+= \"<option value='#{key}'>#{val}</option>\"\n end\n text += \"</select>\"\n text\n end", "title": "" }, { "docid": "c8a79c012c12a19a8a20687cbc8e3d7c", "score": "0.5686873", "text": "def show_sort_options\n sortDropdown = \"\"\n eds_info.fetch('AvailableSearchCriteria', {}).fetch('AvailableSorts', []).each do |sort_option|\n sortDropdown << \"<li><a href='#{eds_action_url sort_option[\"AddAction\"].to_s}'>#{sort_option[\"Label\"].to_s}</a></li>\"\n end\n sortDropdown.html_safe\n end", "title": "" }, { "docid": "e42f892c6484ef251c0050023e3371e7", "score": "0.568527", "text": "def select_html(type, options, prefix = nil, include_blank = false, discard_type = false, disabled = false)\n select_html = %(<select name=\"#{prefix || 'date'})\n select_html << \"[#{type}]\" unless discard_type\n select_html << %(\")\n select_html << %( disabled=\"disabled\") if disabled\n select_html << %(>\\n)\n select_html << %(<option value=\"\"></option>\\n) if include_blank\n select_html << options.to_s\n select_html << \"</select>\\n\"\n select_html.html_safe\n end", "title": "" }, { "docid": "a6a22b98063009b062da2bcff8ab1e47", "score": "0.56605226", "text": "def abrir_filtro\n wait_until_btn_selecione_visible\n btn_selecione.click\n end", "title": "" }, { "docid": "5ca7e187262308293752fb1c70d99adf", "score": "0.5629109", "text": "def agile_board_select_field(f, attr_name, label, model, required = false)\n content_tag :div, class: 'autocomplete-combobox' do\n concat(required ? required_form_label(f, attr_name, label) : f.label(attr_name, label))\n if block_given?\n concat yield\n else\n concat f.select \"#{attr_name}_id\",\n model.send(\"#{attr_name}_options\"),\n {include_blank: !required}, {class: \"chzn-select#{'-deselect' unless required} cbb-medium search\"}\n end\n end\n end", "title": "" }, { "docid": "71a6371c5680cb8e3fc680336109e3bf", "score": "0.5619579", "text": "def treatment_treatment_type_code_search_combo_changed\n\ttreatment_type_code = get_selected_combo_value(params)\n\tsession[:treatment_search_form][:treatment_type_code_combo_selection] = treatment_type_code\n\t@treatment_codes = Treatment.find_by_sql(\"Select distinct treatment_code from treatments where treatment_type_code = '#{treatment_type_code}'\").map{|g|[g.treatment_code]}\n\t@treatment_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('treatment','treatment_code',@treatment_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "0451db178b2084ce4f219eaaa5c8ae9e", "score": "0.55903965", "text": "def type_select object, method, label_text, options\n content_tag :div, :class => :\"type-select\" do\n attr_id = \"#{object.class.to_s.downcase}[#{method}]\".to_sym\n output = String.new\n output << content_tag(:label, label_text, :for => attr_id) unless label_text.blank?\n output << select_tag(attr_id, options)\n end\n end", "title": "" }, { "docid": "b35e391c12e542d2182bc47ac7b760b2", "score": "0.55828863", "text": "def select_drop_down(combo, value)\n append_to_script \"select_drop_down \\\"#{combo}\\\" , \\\"#{value}\\\"\"\n end", "title": "" }, { "docid": "5013f80bd2a20f5310cb687514459c8a", "score": "0.55632675", "text": "def search_button\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/search-options/\"), __method__)\n end", "title": "" }, { "docid": "9aa54403806d3be8d4c0b552af55a1ea", "score": "0.55626625", "text": "def js_filter_field options = {}\n default_options = {\n :class => \"thin_border js_filter_field\",\n :onkeyup => \"alchemyListFilter('#contact_list li')\",\n :id => \"search_field\"\n }\n options = default_options.merge(options)\n options[:onkeyup] << \";$('search_field').value.length >= 1 ? $$('.js_filter_field_clear')[0].show() : $$('.js_filter_field_clear')[0].hide();\"\n filter_field = \"<div class=\\\"js_filter_field_box\\\">\"\n filter_field << text_field_tag(\"filter\", \"\", options)\n filter_field << link_to_function(\n \"\",\n \"$('#{options[:id]}').value = '';#{options[:onkeyup]}\",\n :class => \"js_filter_field_clear\",\n :style => \"display:none\",\n :title => _(\"click_to_show_all\")\n )\n filter_field << (\"<br /><label for=\\\"search_field\\\">\" + _(\"search\") + \"</label>\")\n filter_field << \"</div>\"\n filter_field\n end", "title": "" }, { "docid": "4df8d0d13156e36a147f479b2095f7a1", "score": "0.5561788", "text": "def pack_material_product_pack_material_type_code_search_combo_changed\n\tpack_material_type_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_search_form][:pack_material_type_code_combo_selection] = pack_material_type_code\n\t@pack_material_product_codes = PackMaterialProduct.find_by_sql(\"Select distinct pack_material_product_code from pack_material_products where pack_material_type_code = '#{pack_material_type_code}'\").map{|g|[g.pack_material_product_code]}\n\t@pack_material_product_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','pack_material_product_code',@pack_material_product_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "4767b7cebd26690cdc820116ec512cde", "score": "0.5557912", "text": "def format_select\n t = super\n children = [t.children.select{|o| o.attr[:selected]}.map(&:children).join(', ')] if t.children\n tag(:span, {}, children)\n end", "title": "" }, { "docid": "f922e90c2b5cbd9030268050e2c2f615", "score": "0.5550256", "text": "def tag_filter_control(tag, options = {})\n class_names = [dom_id(tag), \"tag\"]\n class_names << \"subscribed\" if tag.user_id != current_user.id\n class_names << \"has_subscriptions\" if !tag.tag_subscriptions.empty?\n class_names << \"public\" if tag.public? # && tag.user_id == current_user.id\n class_names << \"archived\" if !tag.tag_subscriptions.empty? && tag.user == User.find_by_login(\"archive\")\n class_names << \"archive_account\" if current_user.login == \"archive\"\n\n content_tag(:li, \n content_tag(:div, \"\", :class => \"context_menu_button\", :'tag-id' => tag.id) +\n content_tag(:span, \n content_tag(:span, \n tag_name_uniqued(tag, options),\n :class => \"name\", \n :id => dom_id(tag, \"name\"), \n :\"data-sort\" => tag.sort_name),\n :class => \"filter\"),\n :id => dom_id(tag), \n :class => class_names.join(\" \"),\n :name => tag.name,\n :pos_count => tag.positive_count,\n :neg_count => tag.negative_count,\n :item_count => tag.feed_items_count,\n :title => tag_tooltip(tag))\n \n end", "title": "" }, { "docid": "66b7b56e5c353911772801803a5f5c8c", "score": "0.5545996", "text": "def render(field_id, value = nil, product = nil)\r\n\t\t\tselected_value = !value.nil? ? value : self.default_value || nil\r\n\t\t\tr = \"<select name=\\\"#{field_id}\\\">\"\r\n\t\t\tavailable_values(product).each do |v|\r\n\t\t\t\tr += \"<option value=\\\"#{v.id}\\\"\"\r\n\t\t\t\tif v.id.to_s == selected_value.to_s then\r\n\t\t\t\t\tr += \" selected=\\\"selected\\\"\"\r\n\t\t\t\tend\r\n\t\t\t\tr += \">#{v.value}</option>\"\r\n\t\t\tend\r\n\t\t\tr += \"</select>\"\r\n\t\tend", "title": "" }, { "docid": "e3e2f373bb48c9b1d585770f403e1fcb", "score": "0.55107284", "text": "def for_dropdown\n ActiveRecord::Base.connection.select_all(\n select('brands.name, brands.id').group('1, 2').order('1').to_sql\n ).map { |r| [r['name'], r['id']] }\n end", "title": "" }, { "docid": "5dd6a34454951a43008454a0aaecc211", "score": "0.55081356", "text": "def contact_method_contact_method_type_code_search_combo_changed\n\tcontact_method_type_code = get_selected_combo_value(params)\n\tsession[:contact_method_search_form][:contact_method_type_code_combo_selection] = contact_method_type_code\n\t@contact_method_codes = ContactMethod.find_by_sql(\"Select distinct contact_method_code from contact_methods where contact_method_type_code = '#{contact_method_type_code}'\").map{|g|[g.contact_method_code]}\n\t@contact_method_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('contact_method','contact_method_code',@contact_method_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "9490b9ff582707aea63c02610fc94e72", "score": "0.5504911", "text": "def right_button_dropdown(title, list, toggle_button = true)\n dropdown(title, list, toggle_button, {class: [\"btn-group\", \"pull-right\"]}, {class: [\"btn\", \"btn-default\", \"dropdown-toggle\"]}, {class: [\"pull-right\", \"dropdown-menu\"]})\n end", "title": "" }, { "docid": "5352cbee7c39b8eb3a048f9c226eb151", "score": "0.55046374", "text": "def build_select(type, select_options_as_html)\n select_options = {\n id: input_id_from_type(type),\n name: input_name_from_type(type)\n }.merge!(@html_options)\n select_options[:disabled] = \"disabled\" if @options[:disabled]\n select_options[:class] = css_class_attribute(type, select_options[:class], @options[:with_css_classes]) if @options[:with_css_classes]\n\n select_html = +\"\\n\"\n select_html << content_tag(\"option\", \"\", value: \"\", label: \" \") + \"\\n\" if @options[:include_blank]\n select_html << prompt_option_tag(type, @options[:prompt]) + \"\\n\" if @options[:prompt]\n select_html << select_options_as_html\n\n (content_tag(\"select\", select_html.html_safe, select_options) + \"\\n\").html_safe\n end", "title": "" }, { "docid": "2acae2bd2424acb7746857ec69f486c7", "score": "0.5500552", "text": "def mcp_button_group(opts = {}, &block)\n content = capture(&block) \n content_tag(:div, class: \"btn-group\") do\n ( \"<button id='#{opts[:name]}' class='btn #{opts[:class]}' data-toggle='#{opts[:toggle]}'>#{opts[:name]}</button>\" +\n \"<button class='btn dropdown-toggle #{opts[:class]}' data-toggle='dropdown'><span class='caret'></span></button>\" +\n content_tag(:ul, content, class: \"dropdown-menu\")\n ).html_safe\n end\n end", "title": "" }, { "docid": "6c17d30fc17ca0867a35fbdbaf0ad5aa", "score": "0.548539", "text": "def nacho_select_tag(name, choices = nil, options = {}, html_options = {})\n nacho_options = build_options(name, choices, options, html_options)\n select_element = select_tag(name, options_for_select(nacho_options[:choices]), nacho_options[:options], nacho_options[:html_options])\n select_element += nacho_options[:button] if nacho_options[:html_options][:multiple]\n\n select_element\n end", "title": "" }, { "docid": "c7c1d56b9fcab2db74ef0e896f5ed9f2", "score": "0.54821724", "text": "def trade_environment_setup_id_search_combo_changed\n\tid = get_selected_combo_value(params)\n\tsession[:trade_environment_setup_search_form][:id_combo_selection] = id\n\t@production_schedule_ids = TradeEnvironmentSetup.find_by_sql(\"Select distinct production_schedule_id from trade_environment_setups where id = '#{id}'\").map{|g|[g.production_schedule_id]}\n\t@production_schedule_ids.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('trade_environment_setup','production_schedule_id',@production_schedule_ids)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "10a0afdcb086f2b8523e2524bdc5ed23", "score": "0.54771703", "text": "def right_button_dropdown(title, list, toggle_button = true)\n dropdown(title, list, toggle_button, {class: [\"btn-group\", \"pull-right\"]}, {class: [\"btn\", \"btn-default\", \"dropdown-toggle\"]}, {class: [\"pull-right\", \"dropdown-menu\"]})\n end", "title": "" }, { "docid": "d8eaf0ea0b1b20b263509938a6780da5", "score": "0.54436696", "text": "def collection_select(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "title": "" }, { "docid": "f3f0e227038114f8e0f2e27af166a280", "score": "0.5421959", "text": "def to_html\n bootstrap_wrapping do\n hidden_field_for_all << # Might need to remove this guy.\n collection.map { |choice|\n choice_html(choice)\n }.join(\"\\n\").html_safe\n end\n end", "title": "" }, { "docid": "542c3e7eb10357d93730d05759602685", "score": "0.54198635", "text": "def table_filter_item(attribute, options = {}, &block)\n if block_given?\n field = capture(&block)\n else\n type = options.delete(:as) || :string\n\n # If we're given an options array, we assume it to be a select filter.\n # This allows for more concise code in the form\n # table_filter_item :status, options: %w(Yes No)\n # or\n # filter.on :status, options %W(Yes No)\n type = :select if options[:options].present?\n\n # We define the :active_status type to shortcut a common filter type.\n if type == :active_status\n type = :select\n options[:options] ||= %w(All Active Inactive)\n options[:default] ||= 'Active'\n end\n\n input_html = options.delete(:input_html) || {}\n input_html[:class] = merge_html_classes('filter-control', input_html[:class])\n\n # Defaulting to a simple text field, we choose which field to output here.\n # @note if at some point we wish to add a new field type, here is the place to add it\n case type\n when :select\n options[:options] ||= []\n field = select_tag(attribute,\n options_for_select(options[:options], params[attribute.to_sym] || options[:default]),\n input_html)\n when :date\n input_html[:class] = merge_html_classes('pure-admin-date', input_html[:class])\n field = text_field_tag(attribute, params[attribute.to_sym], input_html)\n icon = content_tag(:span, nil, class: 'input-addon fa fa-fw fa-calendar')\n field = content_tag(:div, icon + field, class: 'addon-wrapper')\n else # :string\n field = text_field_tag(attribute, params[attribute.to_sym], input_html)\n end\n end\n\n label = ''.html_safe\n if options[:label] != false\n label_html = options.delete(:label_html) || {}\n label_text = options.delete(:label) || attribute.to_s.titleize\n label = label_tag(attribute, label_text, label_html)\n end\n\n content_tag(:div, label + field, class: 'filter-group')\n end", "title": "" }, { "docid": "bd11cff93dbc080cb2d49068a05c05d6", "score": "0.5392969", "text": "def render\n return ro_standard if @readonly\n\n set_initial_value('html','selected')\n # separate options and html part\n options_part = {}\n @yaml['html'].symbolize_keys!\n %i(selected include_blank).each { |sym| options_part[sym] = @yaml['html'].delete(sym) if @yaml['html'][sym] }\n @yaml['html'][:multiple] = true if @yaml['multiple']\n\n record = record_text_for(@yaml['name'])\n if @yaml['html'][:multiple]\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n @js << \"$('##{record}_#{@yaml['name']}').selectMultiple();\"\n else\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n # add code for view more data\n @html << add_view_code() if @yaml['view']\n end\n self\nend", "title": "" }, { "docid": "963663b721f9875471665eb0a4134121", "score": "0.539202", "text": "def incluir_filtro\n incluir_filtro_btn.click\n end", "title": "" }, { "docid": "c39553d11f6326c9f170af3f8a5ab63c", "score": "0.5387185", "text": "def dropdown_input(friendly_name, name, dropdown_elements, has_empty_element, default_element=-1)\n @options_string = has_empty_element ? \"<option></option>\" : \"\"\n for i in 0..(dropdown_elements.length-1)\n @options_string += \"<option value='#{dropdown_elements[i]}'\" + (i == default_element ? \"selected=\\\"selected\\\"\" : \"\") + \">\" + dropdown_elements[i].to_s + \"</option>\"\n end\n \"<div class=\\\"input-group\\\">\n <span class=\\\"input-group-addon\\\" id=\\\"basic-addon-#{name}\\\">#{friendly_name}</span>\n <select class=\\\"form-control\\\" name=\\\"#{name}\\\">\" + @options_string + \"</select>\n </div>\"\n end", "title": "" }, { "docid": "92cbe8fa8090c6abbf8377497ca4e0d6", "score": "0.5382044", "text": "def render\n return ro_standard if @readonly\n set_initial_value('html','selected')\n#\n @yaml['html'].symbolize_keys!\n record = record_text_for(@yaml['name'])\n if @yaml['multiple'] \n @html << @parent.select(record, @yaml['name'], get_choices, @yaml['html'], {multiple: true})\n @js << \"$('##{record}_#{@yaml['name']}').selectMultiple();\"\n else\n @html << @parent.select(record, @yaml['name'], get_choices, @yaml['html'])\n end\n self\nend", "title": "" }, { "docid": "0a351a16102a8816d6e015577843339d", "score": "0.53743315", "text": "def render_crud_form_field(column, item, locals)\n locals = locals.merge({:item => item, :column => column})\n\n if param(column,:grouped_select)\n return content_tag(\n \"select\",\n tag(\"option\", :value => \"\") + grouped_options_for_select(param(column,:grouped_select), @item.send(column[:name])),\n :id => \"#{@singular.underscore}_#{column[:name]}\",\n :name => \"#{@singular.underscore}[#{column[:name]}]\"\n )\n elsif param(column,:select)\n locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n else\n type = param(column, :type, (item.attributes.include?(column[:name].to_s) ? item.column_for_attribute(column[:name]).type : \"other\")).to_s\n type = 'other_record' if param(column, :type, '') == '' && item.respond_to?(column[:name].to_s+\"_id\") && (attribute_class(column).respond_to?(:find) || column.include?(:find_class))\n locals = locals.merge({:type => type})\n\n if class_exists?('Lico::AutoCrud::Types::' + type.classify)\n return get_class('Lico::AutoCrud::Types::' + type.classify).to_input(item, column[:name], locals[:f], locals[:params])\n end\n \n return case type.to_sym\n when :boolean then locals[:f].check_box(column[:name], :class => 'in_boolean')\n when :country_select then locals[:f].localized_country_select(\n column[:name].to_s,\n [:NL, :BE, :LU, :FR, :DE],\n { :include_blank => '' },\n param(column, :params, { }).merge({ :class => 'in_country_select' })\n )\n when :currency then number_to_currency(0, :format => \"%u\") + \"&nbsp;\".html_safe + locals[:f].text_field(column[:name], :class => 'in_currency', :style => 'text-align: right', :value => number_to_currency(@item.send(column[:name]).to_f, :separator => \".\", :delimiter => \"\", :format => \"%n\"))\n when :custom then send(\"input_for_#{@singular.underscore}_#{column[:name].to_s}\", locals[:f], item)\n when :date then locals[:f].date_select(column[:name], param(column, :options, {}),{ :class => 'in_date' })\n when :time then locals[:f].time_select(column[:name], param(column, :options, {}),{ :class => 'in_time' })\n when :datetime then locals[:f].datetime_select(column[:name], :minute_step => 15, :class => 'in_datetime')\n when :file then locals[:f].file_field(column[:name], :class => 'in_file')\n when :hidden then locals[:f].hidden_field(column[:name], param(column, :params, { }).merge({:class => 'in_hidden'}))\n when :no_input then @item.send(column[:name])\n when :other_record then\n find_class = column.include?(:find_class) ? column[:find_class] : attribute_class(column)\n find_conditions = column[:conditions]\n find_items = find_class.find(:all, :select => param(column, :select, nil), :joins => param(column, :joins, []), :include => param(column, :include, []), :conditions => find_conditions).collect do |element| \n [ element.to_s, element.id ]\n end\n locals[:f].select(\"#{column[:name].to_s}_id\", find_items, { :include_blank => true }.merge(param(column, :options, {})))\n when :paperclip then\n item.send(column[:name].to_s).nil? ? \n # no image\n locals[:f].file_field(column[:name], :class => 'in_paperclip') :\n\n # with image\n image_tag(item.send(column[:name].to_s, param(column, :size))) +\n content_tag(\n \"div\", \n t('paperclip.upload_new') + \" \" + locals[:f].file_field(column[:name], :class => 'in_paperclip') +\n content_tag(\n \"div\",\n locals[:f].check_box(\"#{column[:name]}_delete\") +\n locals[:f].label(\"#{column[:name]}_delete\", t('paperclip.select_unlink'))\n )\n )\n when :password then locals[:f].password_field(column[:name], :class => 'in_password')\n when :select then locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n when :textarea then locals[:f].text_area(column[:name], {:class => 'in_textarea'}.merge(param(column, :params, { })))\n else\n locals[:f].text_field(column[:name], param(column, :params, { }).merge({:class => 'in_' + type}))\n end\n end\n end", "title": "" }, { "docid": "4447a78828f1f410bba0ba247fb15ccd", "score": "0.53638923", "text": "def document_creation_dropdown\n tag.ul(\n class: \"masthead-menu list-unstyled js-hidden js-navbar-toggle__menu hide-before-js-module-init\",\n id: \"new-document-menu\",\n role: \"menu\",\n \"aria-labelledby\" => \"new-document-label\",\n ) do\n edition_types = [\n Consultation,\n Publication,\n NewsArticle,\n Speech,\n DetailedGuide,\n DocumentCollection,\n FatalityNotice,\n CaseStudy,\n StatisticalDataSet,\n CallForEvidence,\n ]\n edition_types\n .select { |edition_type| can?(:create, edition_type) }\n .map { |edition_type|\n tag.li(class: \"masthead-menu-item\") do\n link_to(\n edition_type.model_name.human,\n polymorphic_path([:new, :admin, edition_type.name.underscore.to_sym]),\n title: \"Create #{edition_type.model_name.human.titleize}\",\n role: \"menuitem\",\n )\n end\n }\n .join\n .html_safe\n end\n end", "title": "" }, { "docid": "c4f29518b7f3c45a03f6bc04d2d4fd64", "score": "0.53626025", "text": "def select(resource_name, field_name, options_list, selected_value)\n html = ''\n options_list.each do |nv_pair|\n option_value = nv_pair.keys.first\n option_name = nv_pair.values.first\n html << \"<option value=\\\"#{option_value}\\\"\"\n html << \" selected=\\\"selected\\\"\" if option_value == selected_value\n html << '>'\n html << option_name\n html << \"</option>\"\n end\n \"<select id=\\\"#{resource_name}_#{field_name}\\\" name=\\\"#{resource_name}_#{field_name}\\\" class=\\\"required\\\">#{html}</select>\"\n end", "title": "" }, { "docid": "45974e19131110e236262f15671e6efb", "score": "0.53596", "text": "def product_product_subtype_code_search_combo_changed\n\tproduct_subtype_code = get_selected_combo_value(params)\n\tsession[:product_search_form][:product_subtype_code_combo_selection] = product_subtype_code\n\t@tag1s = Product.find_by_sql(\"Select distinct tag1 from products where product_subtype_code = '#{product_subtype_code}' and product_type_code = 'PACK_MATERIAL' and is_composite = 'true'\").map{|g|[g.tag1]}\n\[email protected](\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('product','tag1',@tag1s)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_product_tag1'/>\n\t\t<%= observe_field('product_tag1',:update => 'tag2_cell',:url => {:action => session[:product_search_form][:tag1_observer][:remote_method]},:loading => \"show_element('img_product_tag1');\",:complete => session[:product_search_form][:tag1_observer][:on_completed_js])%>\n\t\t}\n\nend", "title": "" }, { "docid": "254a5debc706fff54813b639bec00bfc", "score": "0.5356411", "text": "def options_for_select\n choices.map do |choice|\n data = {}\n data[\"choice-category\"] = choice.category_id if choice.category_id\n\n content_tag(\n :option,\n choice.short_name,\n :value => choice.id,\n :selected => selected_choice?(item, choice),\n :data => data\n )\n end.join.html_safe\n end", "title": "" }, { "docid": "0ac2a2c1ff79d610cc10619422dbf805", "score": "0.53493255", "text": "def shift_type_shift_type_code_search_combo_changed\n\tshift_type_code = get_selected_combo_value(params)\n\tsession[:shift_type_search_form][:shift_type_code_combo_selection] = shift_type_code\n\t@start_times = ShiftType.find_by_sql(\"Select distinct start_time from shift_types where shift_type_code = '#{shift_type_code}'\").map{|g|[g.start_time]}\n\t@start_times.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('shift_type','start_time',@start_times)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "f12b580637c8b1a2ae1cb62eceb16320", "score": "0.534492", "text": "def navbar_dropdown param, buttons, args={}\n\t\t\tp = que_qs(param).first || UI_DEFAULTS[param]\n\t\t\tactive, list = buttons.partition{|b| b == p}\n\n\t\t\tb = []\n\n\t\t\tb << '<ul class=\"dropdown-menu\" style=\"min-width: 0px; left: 0px\">'\n\t\t\tbuttons.each {|l|\n\t\t\t\tc = l == p ? \"class='active'\" : \"\"\n\t\t\t\tb << \"<li #{c}><a href='#{chg_qs(param,l)}'>#{l}</a></li>\"\n\t\t\t}\n\n\t\t\tb << '</ul>'\n\t\t\ta = active.first\n\n\t\t\tprompt_value = args[:prompt_value] || a\n\n\t\t\tlabel = (args[:label]) ? \"#{param.to_s}: #{prompt_value} \" : prompt_value\n\t\t\tdropdown(b, {prompt: label}).flatten\n\n\t\tend", "title": "" }, { "docid": "2baa7dead621acfef940067e6ab45740", "score": "0.5323535", "text": "def per_page_select_html\n \n options = [10,20,50,100,250].collect{|x| [\n \"#{x} per page\", \n url_for(params.merge(:per_page => x))\n ]}\n \n current_selected = url_for(params.merge(:per_page => per_page))\n \n select_tag \"per_page\", options_for_select(options, current_selected)\n \n end", "title": "" }, { "docid": "d736cf77caae00f2536b350bd2d23d2d", "score": "0.5303217", "text": "def in_my_select attrs = nil\n attrs[:class] ||= ''\n attrs[:class] << ' myselect'\n attrs[:class] = attrs[:class].strip\n\n # La taille du menu peut être déterminé par :width\n size = attrs.delete(:size) || 'normal'\n\n # Il faut ajouter un champ hidden qui contiendra vraiment\n # la valeur avec le nom déterminé\n fid = attrs[:id] || attrs[:name]\n fname = attrs[:name] || attrs[:id]\n attrs[:id] = \"myselect_#{fid}\"\n attrs[:name] = \"myselect_#{fname}\"\n \"<div class=\\\"container_myselect #{size}size\\\">\" +\n attrs[:selected].in_hidden(id: fid, name: fname) +\n self.class.opened_tag('div', attrs) + self.to_s + '</div>' +\n '</div>'\n end", "title": "" }, { "docid": "aaaba15598e09026fa4f719c69529b49", "score": "0.5299968", "text": "def get_combobox_options(params)\n column_name = params[:column]\n CONDITIONS.each { |c| column_name.sub!(/_#{c}$/, \"\") }\n super(:column => column_name)\n end", "title": "" }, { "docid": "a99f124e49dd1805e6fcb407d3c13c42", "score": "0.52955043", "text": "def search_with_stages_select_tag(selectname, stagelabel, stage, selected, onchange, searchname, option=nil,billing=nil)\n if stagelabel.eql?('Manage Stage Filter(s)')\n all_option = \"\"\n search_box = \"\"\n else\n all_option = \"<option value='#{option}'>All #{'Open' if selectname =='opp_stage'}</option>\"\n search_box = \"#{text_field_tag \"#{searchname}\", '', :size =>'30', :class => 'search'}<span class='icon_search fr'></span>\"\n end\n date_start = selected[:selected].eql?(0) ? params[:date_start]:''\n date_end = selected[:selected].eql?(0) ? params[:date_end]:''\n if billing==\"billing\"\n box= \"<table class='fl'>\n <tr>\n <td>&nbsp;&nbsp;&nbsp;#{t(:text_start_date)}</td>\n <td><input type='text' id='date_start' name='date_start' class='fl date_picker' size='10' value='#{date_start}' /></td>\n <td>#{t(:text_end_date)}</td>\n <td><input type='text' id='date_end' name='date_end' class='fl date_picker' size='10' value='#{date_end}' /></td>\n <td><input type='submit' name='commit' value='Go' onclick='searchDate();'/></td>\n </tr>\n </table>\"\n end\n return %Q{\n <div class=\"box_gray mt5 mb5\">\n <div class=\"fl pl5\">\n <table cellpadding=\"0\" cellspacing=\"0\">\n <tr>\n <td><strong>#{stagelabel}</strong>&nbsp;&nbsp;</td>\n <td>#{select_tag(selectname, all_option + options_for_select(stage,selected),{:onchange => onchange ,:style=>\"height:22px;\"})}</td>\n </tr>\n </table>\n </div>\n #{box}\n <div class=\"fr fix_mr\">\n <div class=\"search_div\">#{search_box}</div>\n </div>\n <br class=\"clear\" />\n </div>\n }\n end", "title": "" }, { "docid": "332d7db907cbd7614ec14e9fd97da944", "score": "0.5278972", "text": "def ui_select_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options, html_options, &block).render\n end", "title": "" }, { "docid": "4700fca92849658005908dcc1fe71b08", "score": "0.527872", "text": "def index\n @obras = Obra.all\n\n @filterrific = initialize_filterrific(\n Obra,\n params[:filterrific]\n ) or return\n\n @filterrific.select_options = {\n sorted_by: Obra.options_for_sorted_by\n }\n\n @obras = @filterrific.find.page(params[:page]).per(20)\n \n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "4156aa5535b7288fd2da356a9b49d52a", "score": "0.5269807", "text": "def farm_puc_account_puc_type_code_changed\n\tpuc_type_code = get_selected_combo_value(params)\n\tsession[:farm_puc_account_form][:puc_type_code_combo_selection] = puc_type_code\n\t@puc_codes = FarmPucAccount.puc_codes_for_puc_type_code(puc_type_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('farm_puc_account','puc_code',@puc_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "bfbdb3b6f5668a0c10532bc361df597b", "score": "0.52492946", "text": "def get_genre_dropdown()\n collection_select(\"project\", \"genres\", genre_list(), :first, :last, {:prompt => \"Please select\"})\n end", "title": "" }, { "docid": "6831f1e1527df30ebb202f4c24d24141", "score": "0.52482945", "text": "def format_select\n @attr[:disabled] = :disabled\n super\n end", "title": "" }, { "docid": "4e40ffeb38d0093388bac6342b03aac6", "score": "0.5245872", "text": "def active_scaffold_search_boolean(column, options)\n select_options = []\n select_options << [as_('- select -'), nil]\n select_options << [as_('True'), 1]\n select_options << [as_('False'), 0]\n\n select_tag(options[:name], options_for_select(select_options, @record.send(column.name)))\n end", "title": "" }, { "docid": "fc9f3a90644627e59816edd5a24f1fe8", "score": "0.5244201", "text": "def html(options = {})\n @html_options = options.symbolize_keys.reverse_merge(:div => {:id => \"filters\"})\n @html_options[:div] ||= {}\n @html_options[:dom_prefix] ||= @html_options[:div][:id] || \"filters\"\n @html_options[:name_prefix] ||= \"filters\"\n div_options = (@html_options[:div] || {}).reverse_merge(:class => \"winnower\")\n content_tag :div, [html_toggler, html_fieldset, html_errors].join, div_options\n end", "title": "" }, { "docid": "1bbaf8b52225663d2fc2a8f5b6e638f8", "score": "0.5237388", "text": "def forecast_season_search_combo_changed\n season = get_selected_combo_value(params)\n session[:forecast_search_form][:season_combo_selection] = season\n @farm_codes = Forecast.find_by_sql(\"Select distinct farm_code from forecasts where season = '#{season}'\").map { |g| [g.farm_code] }\n @farm_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('forecast','farm_code',@farm_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_forecast_farm_code'/>\n\t\t<%= observe_field('forecast_farm_code',:update => 'forecast_code_cell',:url => {:action => session[:forecast_search_form][:farm_code_observer][:remote_method]},:loading => \"show_element('img_forecast_farm_code');\",:complete => session[:forecast_search_form][:farm_code_observer][:on_completed_js])%>\n\t\t}\n\n end", "title": "" }, { "docid": "6006aae2b194c61fe2b9355a05e75751", "score": "0.52360296", "text": "def selectables(f, value, group)\n\t\trender :partial => \"shared/forms/panel/selection\", :locals => { :f => f, :value => value, :group => group, :select_class => \"selectables\", :selected_value => nil }\n\tend", "title": "" }, { "docid": "f803d99b374e878e65aa2dc9b2bfea97", "score": "0.5234423", "text": "def render_record_select(options = {}) #:nodoc:\n controller.send(:render_record_select, options) do |options|\n render options\n end\n end", "title": "" }, { "docid": "46ed13782dcf028e6d294d8b142818ad", "score": "0.52321947", "text": "def select_custom_fields\n group_custom_fields 'select'\n end", "title": "" }, { "docid": "a1b52081aced1df72bdf8444f4525537", "score": "0.52308685", "text": "def drop_down_field_select(value)\n control = @field.all(:css, 'select[class=\"form-control\"]').first[:id]\n select(value, :from => control)\n end", "title": "" }, { "docid": "294e27df49e977ca018aee7b6e7a4dfc", "score": "0.5229198", "text": "def select_extjs_dropdown_by_hiddenname(value, options={})\n raise \"Must pass a hash containing 'hidden_name'\" if not options.is_a?(Hash) or not options.has_key?(:hidden_name)\n field = find('input[name=\\'' + options[:hidden_name] + '\\'] ~input')\n field.click\n field.send_keys(value[0..3])\n find('.x-combo-list .x-combo-list-item', :text => value).click\n end", "title": "" }, { "docid": "8eb666da78cb512bf0d7a88052a7c7e7", "score": "0.5225509", "text": "def ripe_point_treatment_type_code_changed\n\ttreatment_type_code = get_selected_combo_value(params)\n\tsession[:ripe_point_form][:treatment_type_code_combo_selection] = treatment_type_code\n\t@treatment_codes = RipePoint.treatment_codes_for_treatment_type_code(treatment_type_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('ripe_point','treatment_code',@treatment_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "c8333462b2b399beaf005294b742a28a", "score": "0.52129436", "text": "def status_filter_options\n helpers.options_for_select([[\"Any\", \"ANY\"]], params.dig(:query, :status)) +\n helpers.grouped_options_for_select(\n { \"open/closed\" => [[\"Open\", \"\"], [\"Closed\", \"closed\"]],\n \"status\" => Admin::DigitizationQueueItem::STATUSES.\n find_all {|s| s != \"closed\" }.\n collect {|s| [s.humanize, s]}\n },\n params.dig(:query, :status) || \"\"\n )\n\n # helpers.options_for_select(\n # Admin::DigitizationQueueItem::STATUSES.\n # find_all {|s| s != \"closed\" }.\n # collect {|s| [s.humanize, s]},\n # params.dig(:query, :status)\n # )\n end", "title": "" }, { "docid": "8198d540069682390f00546d4a80375f", "score": "0.5206545", "text": "def show=(item)\n frm.select(:id=>\"timeFilterOption\").select(item)\n end", "title": "" }, { "docid": "2ccc6b329898ad62a0d42b1f81fc9ae0", "score": "0.52059644", "text": "def build\n \"filter=#{filters.join(',')}\"\n end", "title": "" }, { "docid": "936190ed6e7c7b8f0969b60c20b3ca44", "score": "0.51961285", "text": "def provider_select_after_country_change\n collec = params[:country_id] == 'ALL' ? Provider.for_search_select : Provider.from_country_id(params[:country_id].to_i).for_search_select\n render :json => {\n :results =>(collec.map{|e| {:name => e.name, :value => e.id}}) << {:name => '-- ALL --', :value => 'ALL'},\n :selected_id => 'ALL'\n }\n end", "title": "" }, { "docid": "7c9a33deb069762e36e6279fc6ee0d8d", "score": "0.51954126", "text": "def draw_select(locator, options = {})\n offset_x = options.fetch(:offset_x, 0)\n offset_y = options.fetch(:offset_y, 0)\n\n id = random_id\n\n execute_script(%(\n var element = arguments[0];\n var rect = element.getBoundingClientRect();\n var x = rect.left;\n var y = rect.bottom;\n var width = element.offsetWidth;\n function escape(str) {\n \treturn str.replace(\n /[\\\\x26\\\\x0A<>'\"]/g,\n function(r) { return \"&#\" + r.charCodeAt(0) + \";\"; }\n );\n }\n var content = \"\";\n for (var i = 0; i < element.length; i++) {\n \tif (!element.options[i].disabled) {\n content += escape(element.options[i].text) + \"<br />\";\n }\n }\n var dropdown = document.createElement('div');\n dropdown.id = \"#{id}\";\n dropdown.innerHTML = content;\n dropdown.style.backgroundColor = '#fff';\n dropdown.style.border = '1px solid #000';\n dropdown.style.color = '#000';\n dropdown.style.display = 'block';\n dropdown.style.fontSize = '12px';\n dropdown.style.height = '1px';\n dropdown.style.padding = '2px';\n dropdown.style.position = 'absolute';\n dropdown.style.width = width + 'px';\n dropdown.style.zIndex = '99999';\n document.body.appendChild(dropdown);\n dropdown.style.height = (dropdown.scrollHeight + 8) + 'px';\n if (dropdown.scrollWidth > width) {\n \tdropdown.style.width = (dropdown.scrollWidth + 8) + 'px';\n }\n dropdown.style.left = (x + #{offset_x}) + \"px\";\n dropdown.style.top = (y + #{offset_y}) + \"px\";\n return;\n ), find_element(locator))\n\n find_element(\"id=#{id}\")\n end", "title": "" }, { "docid": "b3e49d10f103756914381a1fbc622c3c", "score": "0.5192527", "text": "def dots(options = nil, &block)\n (options ||= {})[:class] = \"dropdown dropdown-dots #{options.delete(:class)}\".strip\n\n content_tag(:div, options) do\n content_tag(:button, class: \"btn btn-dots dropdown-toggle #{options.delete(:button_class)}\", 'aria-expanded': true, 'aria-haspopup': true, 'data-toggle': 'dropdown', type: 'button') do\n end + content_tag(:div, capture(&block), class: 'dropdown-menu')\n end\n end", "title": "" }, { "docid": "a98e70ac50b51cd3c4f8544adaf40303", "score": "0.51874083", "text": "def pur_select_address_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-purselectbtn\")), format_method(__method__))\n end", "title": "" }, { "docid": "8ab71f4d30e45381f3556aa8dc13e941", "score": "0.51841086", "text": "def program_function_program_name_changed\n\tprogram_name = get_selected_combo_value(params)\n\tsession[:program_function_form][:program_name_combo_selection] = program_name\n\t@functional_area_names = ProgramFunction.functional_area_names_for_program_name(program_name)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('program_function','functional_area_name',@functional_area_names)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "9db56dac946eb120caa4ce180e0c7d8d", "score": "0.5183486", "text": "def size_ref_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:size_ref_search_form][:commodity_code_combo_selection] = commodity_code\n\t@size_ref_codes = SizeRef.find_by_sql(\"Select distinct size_ref_code from size_refs where commodity_code = '#{commodity_code}'\").map{|g|[g.size_ref_code]}\n\t@size_ref_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('size_ref','size_ref_code',@size_ref_codes)%>\n\n\t\t}\n\nend", "title": "" }, { "docid": "18372a304b56d101b35bef7824930397", "score": "0.5178739", "text": "def select(*args, &block)\n _gestalt_call_tag(:select, args, &block)\n end", "title": "" }, { "docid": "e16e743eefca9caf01f8e66c221f12a5", "score": "0.51710916", "text": "def date_select_html(val)\n %(<option value=\"#{val}\" selected=\"selected\">#{val}</option>)\n end", "title": "" }, { "docid": "c53cc961a76747abf40cd7af8d112f00", "score": "0.5161142", "text": "def carton_pack_product_type_code_search_combo_changed\n\ttype_code = get_selected_combo_value(params)\n\tsession[:carton_pack_product_search_form][:type_code_combo_selection] = type_code\n\t@basic_pack_codes = CartonPackProduct.find_by_sql(\"Select distinct basic_pack_code from carton_pack_products where type_code = '#{type_code}'\").map{|g|[g.basic_pack_code]}\n\t@basic_pack_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('carton_pack_product','basic_pack_code',@basic_pack_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_carton_pack_product_basic_pack_code'/>\n\t\t<%= observe_field('carton_pack_product_basic_pack_code',:update => 'carton_pack_style_code_cell',:url => {:action => session[:carton_pack_product_search_form][:basic_pack_code_observer][:remote_method]},:loading => \"show_element('img_carton_pack_product_basic_pack_code');\",:complete => session[:carton_pack_product_search_form][:basic_pack_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "title": "" }, { "docid": "10c568a098dabd90078ee87d89ae48b1", "score": "0.516101", "text": "def to_s\n content = content_tag(\n :a,\n @name,\n href: '#',\n class: 'dropdown-toggle',\n data: { toggle: 'dropdown' }, aria: { expanded: false }\n )\n\n content + content_tag(:ul, id: @id, class: 'dropdown-menu ') do\n @content.call(self)\n end\n end", "title": "" }, { "docid": "d863d7d9f16a168c5c0e6b968dc0024f", "score": "0.51554734", "text": "def options_field\n load_resource\n\n col = @grid.get_column(params[:field])\n if col\n render :json => col.get_opts_for_select(@resource)\n else\n render :json => { status: \"ERROR\" }, status: :not_found\n end\n end", "title": "" }, { "docid": "34b28a70d1c494fb0074bf6ccaaf4d6f", "score": "0.5147761", "text": "def filter(options={})\n super\n end", "title": "" }, { "docid": "e9a1fd95fd7fd962b241765fad26500b", "score": "0.5145073", "text": "def data_field_action_select(label, action)\n field_detect(label)\n @field.all(:css, 'button[data-toggle=\"dropdown\"]').first.click #opens the actions menu\n action_list = @field.all(:css, 'ul[class=\"dropdown-menu pull-right\"] > li > a')\n action_item = action_list.detect { |item| item.text == action }\n\n if action_item\n action_item.click\n else\n raise \"Action: #{action} is not available for the field: #{label}.\"\n end\n end", "title": "" }, { "docid": "eaf18d3480874987b9fc6e06decf937b", "score": "0.5134324", "text": "def forecast_variety_commodity_code_combo_changed\n commodity_code = get_selected_combo_value(params)\n session[:forecast_variety_form][:commodity_code_combo_selection] = commodity_code\n @rmt_variety_codes = RmtVariety.find_by_sql(\"Select distinct rmt_variety_code from rmt_varieties where commodity_code = '#{commodity_code}'\").map { |g| [g.rmt_variety_code] }\n @rmt_variety_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t <%= select('forecast_variety','rmt_variety_code',@rmt_variety_codes)%>\n\n\t \t\t }\n\n end", "title": "" } ]
bd0930d8d2bfb591b13d9a0d46534d75
Generates a new API token for the Project. Does not save the Project.
[ { "docid": "b47483a89740e3ae8526581422bd2b02", "score": "0.74803543", "text": "def create_api_token(); self.api_token = SecureRandom.urlsafe_base64(180); end", "title": "" } ]
[ { "docid": "f77e2c209cec003164ae485343376363", "score": "0.74308515", "text": "def generate_api_token\n self.api_token = SecureRandom.uuid\n end", "title": "" }, { "docid": "a6c90a4fc644b6dee29c2a116fcf920d", "score": "0.7226913", "text": "def generate_api_key\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n self.api_key = token\n end", "title": "" }, { "docid": "fd0088a2a3425e1405fc6569a5c10817", "score": "0.71875924", "text": "def create_api_token\n begin\n ApiToken.create(api_consumer: self)\n end\n end", "title": "" }, { "docid": "da9dd72404e0ee58252cfc51e0a88627", "score": "0.70792556", "text": "def generate_new_api_key\n begin\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n end until !User.exists?(api_key: token)\n self.api_key = token\n end", "title": "" }, { "docid": "1e0d9b48bed1056029e1b7cc77ea0c15", "score": "0.70587647", "text": "def create_token\n begin\n self.apikey = ApiKey.generate[1].to_s\n # set expired date for apikey until the day changed\n self.expired_date = Date.today + 1\n\n end while self.class.exists?(apikey: apikey)\n end", "title": "" }, { "docid": "8a4f89e1e2c115ab0bc1c88bd816b99e", "score": "0.6999835", "text": "def generate_token\n headers = { 'kid' => @key_id }\n claims = { 'iat' => Time.now.utc.to_i, 'iss' => @team_id }\n\n JWT.encode(claims, @key, 'ES256', headers)\n end", "title": "" }, { "docid": "f7de8893371d869b359e93dd8a4b8406", "score": "0.6970284", "text": "def generate_api_key\n api_key = self.token = SecureRandom.base64\n generate_api_key if User.find_by_token(api_key)\n api_key\n end", "title": "" }, { "docid": "f7de8893371d869b359e93dd8a4b8406", "score": "0.6970284", "text": "def generate_api_key\n api_key = self.token = SecureRandom.base64\n generate_api_key if User.find_by_token(api_key)\n api_key\n end", "title": "" }, { "docid": "95e91323132ca69053664a7a8c9f1b0b", "score": "0.69663763", "text": "def generate_access_token!\n loop do\n token = SecureRandom.hex(50)\n next if ApiAccessToken.find_by(token: token)\n return ApiAccessToken.create!(user: self, token: token, expires_at: Time.now + 1.week)\n end\n end", "title": "" }, { "docid": "58c0c22f6c733ce4275828075fd50d1a", "score": "0.69505227", "text": "def generate_apikey\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token\n end\n end", "title": "" }, { "docid": "4caf0bc10377150a691282fe27736385", "score": "0.6911791", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.team_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "a69edb65ca30d1973dbdadd731d15965", "score": "0.6907568", "text": "def generate_token\n headers = { 'kid' => key_id }\n claims = { 'iat' => time, 'iss' => team_id }\n\n JWT.encode(claims, key, 'ES256', headers)\n end", "title": "" }, { "docid": "39738dc1d7f33d6a44a3563c7bd40c75", "score": "0.689455", "text": "def generate_token! # :nodoc:\n generate_token\n save\n end", "title": "" }, { "docid": "bea5e9c35e11027d3ed38ea3c646f2ad", "score": "0.6773478", "text": "def generate_api_token\n return if api_token.present?\n\n loop do\n self.api_token = SecureRandom.hex\n break unless User.exists? api_token: api_token\n end\n end", "title": "" }, { "docid": "1e71da9f68aaecb49c6203c597b0798c", "score": "0.6768488", "text": "def api_token\n raise \"set_data not called before api_token\" unless @project\n token = Setting.plugin_redmine_flowdock[:api_token][@project.identifier]\n token = nil if token == ''\n token\n end", "title": "" }, { "docid": "1e71da9f68aaecb49c6203c597b0798c", "score": "0.6768488", "text": "def api_token\n raise \"set_data not called before api_token\" unless @project\n token = Setting.plugin_redmine_flowdock[:api_token][@project.identifier]\n token = nil if token == ''\n token\n end", "title": "" }, { "docid": "4b11b9cf737f415a512df90ca9caaee8", "score": "0.67546237", "text": "def generate_auth_token\n self.oauth_token = SecureRandom.urlsafe_base64 50\n self.oauth_expires_at = generate_expiration_time\n self.save!\n end", "title": "" }, { "docid": "d38cedf1f1c144a87f280f06f65bd734", "score": "0.67420006", "text": "def generate_token\n logger.info(\"generating token for #{id} email: #{email} name: #{name}\")\n token_before = \"#{Time.now.to_i}\" + email\n # MD5.md5(token_before).hexdigest\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(AppConstants::FILE_DOWNLOAD_DIGEST), \n AppConstants::FILE_DOWNLOAD_KEY, token_before)\n end", "title": "" }, { "docid": "a8482e716adc60447a792a342cf76305", "score": "0.6732718", "text": "def generate_token\n\t\tself.token = Digest::SHA1.hexdigest([self.group_id, Time.now, rand].join)\n\tend", "title": "" }, { "docid": "1ffe334e5c6fc633085166d453823234", "score": "0.67278624", "text": "def generate_token\n self.update({:token => SecureRandom.hex})\n end", "title": "" }, { "docid": "9e5164faddea65bc4f4e44af727032e9", "score": "0.6708761", "text": "def create_registration_token(project_id)\n headers = { 'x-api-project-id' => project_id }\n self.api '/v1/registrationtokens/', 'POST', headers\n end", "title": "" }, { "docid": "313feb8aa847ea1cefd12d4bd8eb498c", "score": "0.67011225", "text": "def create\n @api_key = ApiKey.new(token: ApiKey.generate_token!)\n\n respond_to do |format|\n if @api_key.save\n format.html { redirect_to api_keys_url, notice: 'Api key was successfully created.' }\n else\n format.html { render :index, notice: \"Unable to generate token\" }\n end\n end\n end", "title": "" }, { "docid": "1fad6c4a9e8f706038b595c9e2303ad2", "score": "0.67009896", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "91eed7eb2a5b2c5c046c31eb2f0df466", "score": "0.66881", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(token: token)\n end\n end", "title": "" }, { "docid": "7b5a70a839e671abf0077c96d5058a16", "score": "0.66832775", "text": "def generate_api_token\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_token: token)\n end\n end", "title": "" }, { "docid": "a4a08ec7075c9210bee2512aaea85ed8", "score": "0.66801476", "text": "def gen_api_key\n u = UUID.new\n self.api_key = u.generate\n end", "title": "" }, { "docid": "b33bbcc770c8a9f60a307f9271418c95", "score": "0.66790974", "text": "def generate_token\n\t\t\tbegin\n\t\t\t\tself.public_token = SecureRandom.hex(nil)\n\t\t\tend while DeployableApplication.find_by_public_token(self.public_token).present?\n\t\t\t\n\t\t\tself.save\n\t\tend", "title": "" }, { "docid": "d94a9692e25e78e9ea95b304002fa427", "score": "0.667221", "text": "def create_token\n self.token = 'IMGRY'+Digest::SHA1.hexdigest(rand().to_s + Time.new.to_s)[0, 32].upcase!\n end", "title": "" }, { "docid": "1a4130660e7a77fd320412aa6cfb6a1c", "score": "0.66663355", "text": "def get_api_token\n encryptor = ActiveSupport::MessageEncryptor.new Rails.application.secrets.secret_key_base[0..31]\n api_token = encryptor.encrypt_and_sign(\"#{Time.now.to_i}#{self.email}#{self.id}\").gsub(/[\\+=\\/-]/, '')\n CACHE.write(api_token, get_cache_key, expires_in: 24.hours)\n api_token\n end", "title": "" }, { "docid": "c2f6494df88884da623e0d7ccfc834b0", "score": "0.66631997", "text": "def create_token\n self.token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "f17234e2cf05cab2d245d10876a0d908", "score": "0.666064", "text": "def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end", "title": "" }, { "docid": "38ca96c4a17c701967633c04569b656d", "score": "0.6658423", "text": "def generate_access_token\n if User.verify_token(self.access_token)\n self.access_token\n else\n loop do\n token = SecureRandom.urlsafe_base64(24)\n status = self.update(:access_token => token) rescue false\n self.update(:token_generated_at => DateTime.now) and break token if status\n end\n end\n end", "title": "" }, { "docid": "66c3081ac52411066878279c55e28e71", "score": "0.6658036", "text": "def generate_token\n u = User.find(params[:id])\n Token.generate(u)\n redirect_to root_path\n end", "title": "" }, { "docid": "e8756c65fe8214ce89da71b38d628fb0", "score": "0.6657617", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_token: token)\n end\n end", "title": "" }, { "docid": "aa4e03f97d3013e0d6c5e5055a5f23e8", "score": "0.6654784", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "959209d38f0a7d97166fc92df4fd3403", "score": "0.6653547", "text": "def generate_token\n self.token = User.encrypt(User.new_token)\n end", "title": "" }, { "docid": "a2d777e4a392d24d6c18468918611aac", "score": "0.6651768", "text": "def regenerate_api_key\n self.api_key = Digest::SHA1.hexdigest(\"#{self._id}-#{Time.now.to_f}-#{self.created_at}\")\n end", "title": "" }, { "docid": "0a6048a18739b108877196d7f3aa7904", "score": "0.6640492", "text": "def generate_token\n begin\n self.access_token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end while Group.exists?(:access_token => self.access_token)\n end", "title": "" }, { "docid": "a6f3c0dccc59e3b3f08057275e4067cd", "score": "0.6640121", "text": "def generate_auth_token\n command = P::GenerateAuthTokenCommand.new\n send_command(:generate_auth_token, command)\n end", "title": "" }, { "docid": "7b093482d9fe6e3c04e6874da732f9be", "score": "0.6633469", "text": "def generate_token\r\n self.token = SecureRandom.base64(15).tr('+/=lIO0', OAUTH_CONSUMER_SECRET)\r\n end", "title": "" }, { "docid": "cd8788be286eca6288475c3772380ab8", "score": "0.6623789", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "1464ee0fe6359d8317998ea9d1e9a7df", "score": "0.6620749", "text": "def generate_token\n\t\t\tbegin\n\t\t\t\tself.auth_token = User.new_auth_token\n\t\t\tend while User.exists?(auth_token: self.auth_token)\n\t\tend", "title": "" }, { "docid": "c000910f3a73fa9246923ecb90140183", "score": "0.66206944", "text": "def generate_api_key\n loop do\n authentication_token = SecureRandom.base64.tr('+/=', 'Qrt')\n break authentication_token unless User.exists?(token: authentication_token)\n end\n end", "title": "" }, { "docid": "c8a7279dd1da2e92ba0bbc45371b63d8", "score": "0.66157454", "text": "def api_token\n credential = self.api_token_credential || Tokens::Api.random_for(self)\n credential.code\n end", "title": "" }, { "docid": "c25902cb70cbca77d0681beb2dd18c1c", "score": "0.66114306", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless Store.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "6cd9b0b792e68215b0f81902b2011920", "score": "0.6592166", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{rand}--\")\n end", "title": "" }, { "docid": "b42ed6f27d7bb347f8c2d8e5cd07edc1", "score": "0.6591914", "text": "def generate_token\n if new_record?\n self.token = SecureRandom.uuid\n end\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.6590475", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.6590475", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.6590475", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "ac6b5f55eced763ae09d95e2f85fd72f", "score": "0.6577208", "text": "def generate_token\n return unless token.nil?\n token = @auth_token\n temp_token = (token + '|' + Time.now.to_s) if token.index('|').nil?\n @token = Magician.encrypt temp_token\n end", "title": "" }, { "docid": "3ac9cf1e6ae6ea8e4adb91265441f96f", "score": "0.6576206", "text": "def create_api_key\n self.api_key = SecureRandom.uuid\n end", "title": "" }, { "docid": "357502841848869bc6df75ed8f1afb9d", "score": "0.6569167", "text": "def generate_access_token!\n AccessToken.create(user: self, token: SecureRandom.hex)\n end", "title": "" }, { "docid": "a2d21f307865adf87d3508daa7f55910", "score": "0.6562112", "text": "def generate_token\n\t\ttoken_gen = SecureRandom.hex\n\t\tself.token = token_gen\n\t\ttoken_gen\n\tend", "title": "" }, { "docid": "a2d21f307865adf87d3508daa7f55910", "score": "0.6562112", "text": "def generate_token\n\t\ttoken_gen = SecureRandom.hex\n\t\tself.token = token_gen\n\t\ttoken_gen\n\tend", "title": "" }, { "docid": "aebaeee5e22d6123247c567ab3aa519d", "score": "0.6558417", "text": "def generate_token\n update_attribute(:token, Digest::MD5.hexdigest(login + Time.now.to_i.to_s + rand(999999).to_s)[0..4])\n end", "title": "" }, { "docid": "21a4d77b602220813dacf812674aa21a", "score": "0.6555249", "text": "def generate_auth_token\n \tJWT.encode({ id: id,\n exp: 60.days.from_now.to_i },\n Rails.application.secrets.secret_key_base)\n end", "title": "" }, { "docid": "6057e92b7c38188b24c8aa82669f4de6", "score": "0.65550095", "text": "def generate_token\n { 'token' => jwt_token.generate(user) }\n end", "title": "" }, { "docid": "f8666102d9947a62336f74006002642d", "score": "0.6554227", "text": "def generate\n # ported from python implementation at https://github.com/fedoco/itc-reporter/blob/master/reporter.py\n mode_backup = @config[:mode]\n @config[:mode] = 'normal' \n _, headers = fetch(@config[:sales_path], 'Sales.generateToken')\n\n # generating a new token requires mirroring back a request id to the iTC server, so let's examine the response header...\n @config[:mode] = mode_backup\n url_params = \"&isExistingToken=%s&requestId=%s\" % ['Y', headers[:service_request_id]]\n data, _ = fetch(@config[:sales_path], 'Sales.generateToken', url_params)\n data\n end", "title": "" }, { "docid": "2806e4a7d0b7e50c6e0e94924a63537c", "score": "0.65525675", "text": "def createToken\n parameters = {\n :scope => @scope,\n :grant_type => @grant_type\n }\n getNewToken(parameters)\n end", "title": "" }, { "docid": "28907f8993e86f8dc484cf47c6b6372e", "score": "0.6549021", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', '')\n break token unless User.exists?(apikey: token)\n end\n end", "title": "" }, { "docid": "709176c7cc3de02bde9104db7c932a00", "score": "0.65451", "text": "def generateToken\n printa \"generating token...\"\n apiKey='16740792'\n location = 'localhost'\n session_id = TBO.create_session(location).to_s\n token= TBO.generate_token :session_id=> session_id, :role=> OpenTok::RoleConstants::MODERATOR, :api_url => 'https://api.opentok.com/hl'\n render :json=>{\n :token=>token,\n :apiKey=>apiKey\n }\n end", "title": "" }, { "docid": "da21b5eac0de5f0104bdfc0187c7ab7b", "score": "0.6541079", "text": "def gen_api_key!\n session[:apikey] = SecureRandom.urlsafe_base64(25)\n end", "title": "" }, { "docid": "891ed5381d64f519095b690deed00aa2", "score": "0.6537328", "text": "def generate_token\n self.token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "a887a75af8fe54d690087016c29af450", "score": "0.65222424", "text": "def generate_api_key!\n self.update_attribute(:api_key, secure_digest(Time.now, (1..10).map{ rand.to_s }))\n end", "title": "" }, { "docid": "c02d586d3c1210e5dfc268da94095dd4", "score": "0.6520655", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n toekn_gen\n end", "title": "" }, { "docid": "0037244db3aafdd6bb9ca7eb3c42aa63", "score": "0.65201545", "text": "def new\n @client_token = generate_client_token\n end", "title": "" }, { "docid": "6bafc72e0269521c6f2dfcd000fcbe8e", "score": "0.65169895", "text": "def generate_token\n self.token = SecureRandom.hex(32)\n end", "title": "" }, { "docid": "5fcb8d3cbbfb30269a51ce3334d2d88b", "score": "0.65107805", "text": "def generate_api_key\n\t\tloop do\n\t\t\ttoken = SecureRandom.base64.tr('+/=', 'Qrt')\n\t\t\tbreak token unless User.exists?(api_key: token)\n\t\tend\n\tend", "title": "" }, { "docid": "6b37e1cb048e6a116befa4b039823f53", "score": "0.6510569", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "6632e4a7f74b00b95a19bc04d13f25d2", "score": "0.6507781", "text": "def generate_api_key\n self.api_key = ActiveSupport::SecureRandom.hex(16)\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "9152ad7a9ecef5de2da25c0a3ad7f291", "score": "0.6499529", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "761bb9549aefe262fb47efaed1c4d1de", "score": "0.64924264", "text": "def generate_token\n self.token = SecureRandom.hex\n end", "title": "" }, { "docid": "b0ad359ac660add86e3c379aa7dc6af6", "score": "0.64832854", "text": "def generate_public_token\n self.regenerate_public_token unless self.featured? \n end", "title": "" }, { "docid": "517a440793b410ad01bba7b41a119c47", "score": "0.64828473", "text": "def generate_token\n\t\tDigest::SHA2.hexdigest(MOBWRITE_SECRET_KEY + self.id.to_s + Time.now.to_i.to_s)\n\tend", "title": "" }, { "docid": "5ee5a828121ce09f7c71b6597541787d", "score": "0.64749616", "text": "def gen_api_key!\n session[:apikey] = SecureRandom.urlsafe_base64(25)\n end", "title": "" }, { "docid": "cad132f7c2227d16a6eba031454d6418", "score": "0.64650375", "text": "def generate_api_key\n begin\n key = rand.to_s[2..11]\n end while User.find_by_api_key(key).present?\n\n self.api_key = key\n end", "title": "" }, { "docid": "a7a45a35445be41ebe7187d2f6e6bbe9", "score": "0.6464588", "text": "def generate_token(options)\n @otsdk.generateToken options\n end", "title": "" }, { "docid": "55118424fa2773dec4227446d412b866", "score": "0.64431584", "text": "def generate_token\n self.token = SecureRandom.hex(16)\n end", "title": "" }, { "docid": "05dce50517cf557258c3f12dae87df02", "score": "0.6431128", "text": "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "title": "" }, { "docid": "05dce50517cf557258c3f12dae87df02", "score": "0.6431128", "text": "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "title": "" }, { "docid": "2f8e50f9a0d07c980dc93783a916ee6d", "score": "0.64272827", "text": "def new_auth_token()\n query = { action: 'authToken', apikey: @apikey, secretkey: @secretkey }\n res = HTTParty.get(@endpoint, query: query)\n parse_response(res).fetch(\"authToken\")\n end", "title": "" }, { "docid": "c6af68fb5a04daca8686fd06f929df10", "score": "0.6413572", "text": "def regenerate_token\n update!(token: self.class.generate_unique_secure_token,\n token_expiration: Time.now.utc + 1.day)\n end", "title": "" }, { "docid": "0c77d2ba5782497cfce55015f0fabdb7", "score": "0.6408062", "text": "def generate_api_key\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless Customer.exists?(api_key: token)\n end\n end", "title": "" }, { "docid": "ea761e935dff412375fdb203cd5e19a7", "score": "0.64041424", "text": "def generate_token\n self.access_token ||= loop do\n random_token = SecureRandom.urlsafe_base64(15).tr('lIO0', 'sxyz')\n break random_token unless self.class.exists?(access_token: random_token)\n end\n end", "title": "" }, { "docid": "8a3c85ac47971a35b5e6f5b364024320", "score": "0.6404071", "text": "def generate\n @tokens = {}\n add_app_tokens\n add_user_tokens\n add_timestamp_token\n @tokens\n end", "title": "" }, { "docid": "578e957f285915e5c63306dcb07971a4", "score": "0.639725", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.trip_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "ca06f30df5d7be7dbe72dc1b4323159e", "score": "0.639026", "text": "def regenerate_token\n self.value = generate_auth_token\n end", "title": "" }, { "docid": "09540591ad21cf9a31ebd212210395c3", "score": "0.63868445", "text": "def generate_token\n\t\tbegin\n\t\t\tself.auth_token = SecureRandom.hex\n\t\tend while self.class.exists?(auth_token: auth_token)\n\tend", "title": "" }, { "docid": "66807d12758155197cd7722016c329ff", "score": "0.6379518", "text": "def token\n payload = { iat: Integer(Time.now), exp: Integer(Time.now + 1), iss: @meta['app_id'] }\n Octokit::Client.new(bearer_token: JWT.encode(payload, @private_key, 'RS256'))\n .create_installation_access_token(@meta['installation_id'])\n end", "title": "" }, { "docid": "cb147201649b7f9f5383d3e9e4d8add4", "score": "0.6367603", "text": "def check_and_set_token\n generate_api_token if self.api_token.nil?\n end", "title": "" } ]
3368cecb12290dea80902a9897800b02
GET /disciplines GET /disciplines.xml
[ { "docid": "c0b1e91497eb2c63608aed484aecc73a", "score": "0.60721093", "text": "def index\n @disciplines = @course.disciplines.latest_versions\n @disciplines = @disciplines.where_code_or_name(params[:term]) if params[:term]\n @disciplines = @disciplines.paginate :page => params[:page] \n \n respond_with @disciplines\n end", "title": "" } ]
[ { "docid": "96844d404e2476d42e0e347ec5737453", "score": "0.64370245", "text": "def index\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @disciplinas }\n end\n end", "title": "" }, { "docid": "113aa49f9e9b7d33ae80b2c99f15cbc1", "score": "0.6430345", "text": "def show\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n @disciplines = collect_disciplines\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projects }\n end \n end", "title": "" }, { "docid": "8d8232195ab6ffa1c3c818314fab656a", "score": "0.6423516", "text": "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "title": "" }, { "docid": "8b073195a05dc7a1d45dbed21c98a573", "score": "0.6413188", "text": "def index\n @disciplines = Discipline.all\n end", "title": "" }, { "docid": "8b073195a05dc7a1d45dbed21c98a573", "score": "0.6413188", "text": "def index\n @disciplines = Discipline.all\n end", "title": "" }, { "docid": "14bab7d17cacb2a4e39e7225ec7ef1bc", "score": "0.62437075", "text": "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "title": "" }, { "docid": "5055f9d2e7ba68070673f477ff42537f", "score": "0.6126154", "text": "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "title": "" }, { "docid": "71f0f26d2025e905e0e8cefc96f5af3b", "score": "0.6007478", "text": "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "title": "" }, { "docid": "79878bb9533072f33337104bc6b36586", "score": "0.59979707", "text": "def consultar\n @disciplina = Disciplina.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @disciplina }\n end\n end", "title": "" }, { "docid": "5f5f7e7600697a4c3da23f93f3df798f", "score": "0.5978286", "text": "def index\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_disciplines = MatrixDiscipline.where(:matrix_id => @matrix.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_disciplines }\n end\n end", "title": "" }, { "docid": "5a49e92e7cc3c8cb3cf0ab56f38c84f2", "score": "0.5883172", "text": "def index\n @psi_disciplines = PsiDiscipline.all\n end", "title": "" }, { "docid": "cac1bbb5cf9ab0a6c3bfac600c6d6b6c", "score": "0.5853048", "text": "def show\n @curriculum = Curriculum.find(params[:id])\n @curriculum_disciplines = @curriculum.curriculum_disciplines.by_module.paginate :page => params[:page]\n\n respond_with @curriculum\n end", "title": "" }, { "docid": "8af7e4fdd5e23247b1e26ac2463e5f8b", "score": "0.5815149", "text": "def index\n @race_disciplines = RaceDiscipline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @race_disciplines }\n end\n end", "title": "" }, { "docid": "364e446d62fa719ec68c5d6a512f304b", "score": "0.57254976", "text": "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "title": "" }, { "docid": "e8628541560383eda568fb15b5a64457", "score": "0.57135695", "text": "def index\n @disciplinas = Disciplina.all\n end", "title": "" }, { "docid": "e10f4c78db281f4110a9fd6bcfadeea9", "score": "0.5664883", "text": "def new\n @project = Project.new\n @project.disciplines = []\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "title": "" }, { "docid": "7e13e00893d31968eae0e3a64625e2bb", "score": "0.56406647", "text": "def index\n @discipleships = Discipleship.all\n end", "title": "" }, { "docid": "592fd4b50034bc79a7c5db15b31e8e35", "score": "0.5635663", "text": "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.where(year: @year).includes(:event)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "title": "" }, { "docid": "aa365b05a3c82248cdbcaacda6fd9b93", "score": "0.55768824", "text": "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "title": "" }, { "docid": "1672d92f4fe918f57ba4caf7ac65cd6f", "score": "0.5561581", "text": "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "title": "" }, { "docid": "f5b288c52a55c54761faf7f741bb3149", "score": "0.55014235", "text": "def show\n @discipline = Discipline.find(params[:id])\n\n respond_with @discipline\n end", "title": "" }, { "docid": "a40d9672b25863000067edbdbd652601", "score": "0.5496676", "text": "def index\n @disciplines = Discipline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disciplines }\n end\n end", "title": "" }, { "docid": "c6d07ad67ea5b179da1e62c8c3014406", "score": "0.54634804", "text": "def index\n @disciplines = Discipline.order(questions_daily_access: :desc)\n end", "title": "" }, { "docid": "8dfaa7a10515c10c497ea31b3ebace9c", "score": "0.5447897", "text": "def index\n @discipline_sections = DisciplineSection.all\n end", "title": "" }, { "docid": "f9c6091283ac8cc90c94e1c35c33e4e8", "score": "0.54367894", "text": "def novo\n @disciplina = Disciplina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @disciplina }\n end\n end", "title": "" }, { "docid": "f146923f133a47746643272a5339bca4", "score": "0.5413397", "text": "def show\n @race_discipline = RaceDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @race_discipline }\n end\n end", "title": "" }, { "docid": "c9141d75e73b40810579883c4469a548", "score": "0.5378305", "text": "def show\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "title": "" }, { "docid": "8f09a750ec732afa86beebeb91a86def", "score": "0.5337463", "text": "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "title": "" }, { "docid": "0ed518b84cf47628261be2edf964d597", "score": "0.5322132", "text": "def parse_disciplines(elem)\n #disciplines, derive an id\n disciplines = elem.following_siblings()[0].search(\"li\")\n @disciplines = []\n disciplines.each { |discipline|\n @disciplines << Discipline.new( discipline.inner_html ) \n } \n end", "title": "" }, { "docid": "d0540aab75e418e18cc4d5de71ded4cd", "score": "0.53081936", "text": "def disciplines_for(discipline)\n if discipline\n [Discipline[discipline]]\n else\n #alphere this is causing nil discipline error in UpcomingEvents.find_all\n #[Discipline[:road], Discipline[:mountain_bike], Discipline[:bmx], Discipline[:track], Discipline[:cyclocross]]\n #works: [Discipline[:road]]\n disciplines = Array.new\n Discipline.find_all_names.each do | name |\n disciplines << (Discipline[name.to_sym]) unless name.to_s == ''\n end\n disciplines\n end\n end", "title": "" }, { "docid": "1ad108f091126bfe7477203ba588d8f9", "score": "0.5288985", "text": "def index\n @discipuladores = Discipulador.all\n end", "title": "" }, { "docid": "d91ed430af1d766c0a08774b90616f03", "score": "0.5288666", "text": "def set_disciplina\n @disciplina = Disciplina.find(params[:id])\n end", "title": "" }, { "docid": "db16f586b3767b66be7a85bcbba62c8d", "score": "0.5239546", "text": "def get_substrates()\n\tputs \"Getting list of substrates.\"\n\tresponse = request_get('/api/partner/substrate')\n\tputs response.body\nend", "title": "" }, { "docid": "664898c141b8ecbcdb0ffa3f9a3a1509", "score": "0.52192354", "text": "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @island }\n end\n end", "title": "" }, { "docid": "43335385879083a3e6ff63f24b99d059", "score": "0.5214358", "text": "def get_citations(word, *args)\n http_method = :get\n path = '/word/{word}/citations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end", "title": "" }, { "docid": "1916b73405bb9a9a6326ecbbf3b9dfb8", "score": "0.5184073", "text": "def index\n @labor_cost_lines = LaborCostLine.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @labor_cost_lines }\n end\n end", "title": "" }, { "docid": "4cd7e5678cafd1a0ced9a06064e85de7", "score": "0.5151974", "text": "def show\n @encyclopaedia = Encyclopaedia.find(params[:id])\n @sections = @encyclopaedia.sections.all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encyclopaedia}\n end\n end", "title": "" }, { "docid": "4de0be88b70207d7301b489376acbbdd", "score": "0.5123691", "text": "def show\n @construction_method = ConstructionMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @construction_method }\n end\n end", "title": "" }, { "docid": "8871b1fdeb577d066b5c5fe333bec142", "score": "0.51188433", "text": "def show\n @labor_cost_line = LaborCostLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @labor_cost_line }\n end\n end", "title": "" }, { "docid": "77267a09bea71c0f25a51b53a4f90310", "score": "0.5104768", "text": "def show\n @citation = Citation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @citation }\n end\n end", "title": "" }, { "docid": "c7cec88d08bfc19a4ff1c1dd343ec92d", "score": "0.5083073", "text": "def show\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clique }\n end\n end", "title": "" }, { "docid": "8fef7d237c28e3c93a7b6e6813b0e26c", "score": "0.5072614", "text": "def show\n @court = Court.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @court }\n end\n end", "title": "" }, { "docid": "35ee58ca9eb633f2222119c3cf147597", "score": "0.5069263", "text": "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end", "title": "" }, { "docid": "e1128e2acb674c4b319c5fdb0fb8b72e", "score": "0.5061289", "text": "def show\n @crit_requirement = CritRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end", "title": "" }, { "docid": "45517282bcf96cdf5042079efd0eb048", "score": "0.50610757", "text": "def show\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visarequest }\n end\n end", "title": "" }, { "docid": "55cddec0788591df823bc23936440972", "score": "0.5030877", "text": "def show\n #render json: @discipline\n respond_with @discipline\n end", "title": "" }, { "docid": "8169bcd52ae4d25b3f38b6255190f9f9", "score": "0.502416", "text": "def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end", "title": "" }, { "docid": "14eceb2836f3dd7c28c61e7ba35239f9", "score": "0.50213575", "text": "def discipline_params\n params[:discipline]\n end", "title": "" }, { "docid": "583cf5d90849df27b0a7ffbbc5157ecc", "score": "0.499956", "text": "def set_discipleship\n @discipleship = Discipleship.find(params[:id])\n end", "title": "" }, { "docid": "0d444409b7554172e8015108b784fde8", "score": "0.4994311", "text": "def getDiscs(types)\n\tdiscs = Array.new\n\n\t@discs_doc.elements.each('acda-discs/disc') { |elem|\n\t\tdisc = parseDisc(elem, types)\n\t\tdiscs.push disc\n\t}\n\n\tdiscs\nend", "title": "" }, { "docid": "34d6001334bf6a63b8e889909e04c0d1", "score": "0.49877113", "text": "def show\n @course_degree = CourseDegree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_degree }\n end\n end", "title": "" }, { "docid": "7f9676285632ebff4f56af09930cc4aa", "score": "0.49866724", "text": "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", "title": "" }, { "docid": "136709639c64ba109f58a993354ff101", "score": "0.49843964", "text": "def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "title": "" }, { "docid": "1d393f565d0168bb2cffb05644c055e3", "score": "0.4980512", "text": "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "title": "" }, { "docid": "6279a206c5e20f991f088b47e12491df", "score": "0.49795917", "text": "def show\n @student_noticeship = StudentNoticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_noticeship }\n end\n end", "title": "" }, { "docid": "88e717d82e3739b77f1a059ff9953ed2", "score": "0.49725467", "text": "def set_discipulador\n @discipulador = Discipulador.find(params[:id])\n end", "title": "" }, { "docid": "918380ce6bf3b17fa8db6d25e8b6b677", "score": "0.49681517", "text": "def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end", "title": "" }, { "docid": "34d165a2e6798922e5162fd417e56275", "score": "0.49627686", "text": "def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @line }\n end\n end", "title": "" }, { "docid": "42bdcab1c18ba9d7ffceb84fb006b98c", "score": "0.4938505", "text": "def index\n authorize(@project, policy_class: CitationPolicy)\n @citations = CitationSupplyingService.new.find_by_project_id(@project.id)\n respond_to do |format|\n format.fhir_xml { render xml: @citations }\n format.fhir_json { render json: @citations }\n format.html { render json: @citations }\n format.json { render json: @citations }\n format.xml { render xml: @citations }\n format.all { render text: 'Only HTML, JSON and XML are currently supported', status: 406 }\n end\n end", "title": "" }, { "docid": "6ff706e96077073526af6ce620a2c8bf", "score": "0.49364722", "text": "def show\n @solicitation = Solicitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @solicitation }\n end\n end", "title": "" }, { "docid": "6cf9e0ad10708ca587ee120ac7acba32", "score": "0.49359518", "text": "def index\n @discipleship_classes = DiscipleshipClass.all\n end", "title": "" }, { "docid": "ee795409ef2cef02b14a3fc575427a8f", "score": "0.49332204", "text": "def show\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institute }\n end\n end", "title": "" }, { "docid": "55f0df4cdb34ab5ba4346dabb4eda6c9", "score": "0.49262217", "text": "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "title": "" }, { "docid": "033969832a6e187873b23f9688042b7c", "score": "0.4924564", "text": "def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end", "title": "" }, { "docid": "ba8eb7c6af4554d6d737c615d216887f", "score": "0.4924522", "text": "def show \n @calorie_intake = CalorieIntake.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calorie_intake }\n end\n end", "title": "" }, { "docid": "c253a32249b44e91de0e5215c64871cb", "score": "0.49226683", "text": "def show\n @discipline = Discipline.find(params[:discipline_id])\n @reporting = @discipline.reportings.find(params[:id])\n end", "title": "" }, { "docid": "cf4ebbd1383689f3dd363f4264fea51c", "score": "0.49197093", "text": "def get_exam_schedules(course_id)\r\n relative_url = Path::COURSES_EXAMSCHEDULES % [course_id]\r\n get(relative_url)\r\n end", "title": "" }, { "docid": "de29fcad1a81ba632b649be3a627a99d", "score": "0.4912859", "text": "def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end", "title": "" }, { "docid": "472dd539d182dc416f9c05edffdaa4ef", "score": "0.4902432", "text": "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "title": "" }, { "docid": "97614e90c7168dbd12dc948902f2cd3a", "score": "0.48979598", "text": "def show\n @interests = Interests.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interests }\n end\n end", "title": "" }, { "docid": "adf23d5c94fc3f896d3f2955094e585e", "score": "0.48973137", "text": "def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "title": "" }, { "docid": "ca9af5c843fc2e27493dfe2719a84ed7", "score": "0.48954585", "text": "def show\n @interest = Interest.find(params[:id])\n @interests = Interest.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interest }\n end\n end", "title": "" }, { "docid": "2349ed6b86ecab46a36d6fe8ff0fbdac", "score": "0.4892437", "text": "def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end", "title": "" }, { "docid": "5e142eaa20cab679e39f03ccdfd9f087", "score": "0.48879308", "text": "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "title": "" }, { "docid": "826e3e961db48c5ce065c52992725ac0", "score": "0.4879782", "text": "def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end", "title": "" }, { "docid": "b8bcd5e6dbfbac3a0647e2133d5379f4", "score": "0.48779717", "text": "def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end", "title": "" }, { "docid": "672f39cc2c227233d576180e4edc0099", "score": "0.48767632", "text": "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "title": "" }, { "docid": "672f39cc2c227233d576180e4edc0099", "score": "0.48767632", "text": "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "title": "" }, { "docid": "69470c9708cc240ae8ce8cff5b949db4", "score": "0.48766747", "text": "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @island }\n end\n end", "title": "" }, { "docid": "dd963fbee530a786ab8117b6e49f1627", "score": "0.4876539", "text": "def show\n @commission_day = CommissionDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @commission_day }\n end\n end", "title": "" }, { "docid": "0152ae852216f0a43d8e01b63a41bceb", "score": "0.48718104", "text": "def show\n @lineas_despacho = LineasDespacho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lineas_despacho }\n end\n end", "title": "" }, { "docid": "4f3a8756654ba8c41b9319c39c44e2dd", "score": "0.4869394", "text": "def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end", "title": "" }, { "docid": "8f3c30c9f3e683762d49347174ba6d15", "score": "0.4867478", "text": "def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end", "title": "" }, { "docid": "bb7bd8a2301323a4e9e1b4a9cf763934", "score": "0.48637283", "text": "def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "title": "" }, { "docid": "f0b9e8c50d9e115081185085183484e8", "score": "0.48578146", "text": "def get_page\n doc = Nokogiri::HTML(open(\"http://learn-co-curriculum.github.io/site-for-scraping/courses\"))\n end", "title": "" }, { "docid": "a457641b3abda8a6381f612a9c846884", "score": "0.48569262", "text": "def get_listings_xml(url)\n @client.get_content(url)\n end", "title": "" }, { "docid": "6573371215554abfa384ebf0ac7aa4ec", "score": "0.48563653", "text": "def create\n @disciplina = Disciplina.new(params[:disciplina])\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to(consultar_disciplina_path(@disciplina),\n :notice => 'Disciplina was successfully created.') }\n format.xml { render :xml => @disciplina, :status => :created, :location => @disciplina }\n else\n format.html { render :action => \"novo\" }\n format.xml { render :xml => @disciplina.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed705320ed967fefc51dfcdfd8c1d90c", "score": "0.48520052", "text": "def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end", "title": "" }, { "docid": "d75f10cd2a39a5122be609fd17c43a97", "score": "0.48510784", "text": "def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end", "title": "" }, { "docid": "41fff5f45a39dc6d78baf076c40b0f61", "score": "0.48465714", "text": "def show\n @cst_ipi = CstIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_ipi }\n end\n end", "title": "" }, { "docid": "ab2170ea65871eaf4e287246a54a1d5e", "score": "0.48451394", "text": "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "title": "" }, { "docid": "8658b75568ce879bed8dcfed95c5a17d", "score": "0.48409542", "text": "def new\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "title": "" }, { "docid": "553cc37c0ea7add0f52656884cc5c390", "score": "0.48377052", "text": "def index\n @contracts = @project.contracts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contracts }\n end\n end", "title": "" }, { "docid": "6a7b1403433bd46fad40c17943dbba2e", "score": "0.4832616", "text": "def index\n @converstation_requests = ConverstationRequest.all\n end", "title": "" }, { "docid": "5b97ab7ad8a8448f2f4eef82fea292e0", "score": "0.4831111", "text": "def index\n @station = Station.find(params[:station_id])\n\t\t@acs = @station.acs\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acs }\n end\n end", "title": "" }, { "docid": "decf247a2dbdab948039461513dab622", "score": "0.48280132", "text": "def show\n @correspondenciasclase = Correspondenciasclase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @correspondenciasclase }\n end\n end", "title": "" }, { "docid": "98c91efe0189bf990d9da57a3283bfb3", "score": "0.4827796", "text": "def index\n @curriculums = Curriculum.all(:order => 'start_year DESC')\n authorize! :read, Curriculum\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @curriculums }\n end\n end", "title": "" }, { "docid": "27c0c46a9b3c16a3ede03df00b71f1b8", "score": "0.48258173", "text": "def show\n @lookup_demographichandedness = LookupDemographichandedness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_demographichandedness }\n end\n end", "title": "" }, { "docid": "e014a29256a6e421e92886c03f97c4aa", "score": "0.4825543", "text": "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "title": "" }, { "docid": "52f935bffa35783124280e6bfa912451", "score": "0.48229665", "text": "def show\n @courtstation = Courtstation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @courtstation }\n end\n end", "title": "" } ]
c0e59fd941015869b222542c96d22a8a
POST /teams POST /teams.json
[ { "docid": "119df72636139a28531344aea3f4d286", "score": "0.6778875", "text": "def create\n @team = Team.new(team_params)\n @team.save\n respond_with(@team)\n end", "title": "" } ]
[ { "docid": "3280629651000a453e2e1dec9c2eca31", "score": "0.7685086", "text": "def create\n\n\t @team = Team.new\n\n\t #Need the [:teams] because its a hash based on the post, and then\n\t #within that hash, we access the [:name]\n\t @team.name = params[:team][:name]\n\t @team.wins_total = params[:team][:wins_total]\n\t @team.loss_total = params[:team][:loss_total]\n\t @team.save!\n\n\t respond_to do |format|\n\t format.html { redirect_to teams_url }\n\t format.json { render :json => @team }\n\t end\n\n\t end", "title": "" }, { "docid": "b8f98bb2d83fbfb5c1124100304e341f", "score": "0.7550354", "text": "def create\n render json: Team.create(params[\"team\"])\n end", "title": "" }, { "docid": "5985f6aac5ae9f85f8f5de24bd0bf33d", "score": "0.72262913", "text": "def teams\n puts 'REACHED TEAMS CONTROLLER METHOD'\n @teams = Team.in_division(params[:id])\n\n render json: @teams\n end", "title": "" }, { "docid": "a4ec387fcad7093210258afed933b6c6", "score": "0.71812963", "text": "def create\n @team = current_management.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to teams_url, notice: 'team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65047eefc2a11ce140541b69e5121f5b", "score": "0.7165639", "text": "def create\n team = Team.new(team_params)\n if team.save\n render json: team, status: 201, location: [:api, team]\n else\n failed_to_create(team, \"team\")\n end\n end", "title": "" }, { "docid": "3d91b8b7fb1e93ad07e0dfcd74688e96", "score": "0.7133525", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to teams_path }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf4d25e944ccf57e1eeac6d4333eb6b7", "score": "0.7127962", "text": "def create\n @tournament = Tournament.new(params[:tournament])\n teams = params[:teams]\n\n respond_to do |format|\n if @tournament.save\n fixture teams\n create_standings teams\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render json: @tournament, status: :created, location: @tournament }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fca520bb62b6ef62e53fbb8af3b422a7", "score": "0.7104335", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e34bdfd5a55acd3dd4db48237b1de761", "score": "0.7063621", "text": "def create\n\n @team = Team.new(params[:team])\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08e04558df822f8a6228c1dbf6e471c1", "score": "0.7062498", "text": "def create\n @team = Team.new(team_params)\n\n if @team.save\n render :show, status: :created\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "977b1aa1ce0411c2bfc48536e54b81c8", "score": "0.70584774", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to teams_path, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9492a23d95d09d5489a2b03ca79ceb17", "score": "0.7029483", "text": "def create\n team = Team.new(team_params)\n\n if team.save\n render json: serializer(team)\n else\n render json: { error: team.errors.messages }\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b51a1852569cfde80e3d70220b0d114", "score": "0.7022947", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "befd9be1ac97a1dfc5234cb0b72c699c", "score": "0.69931924", "text": "def create\n json = team_params\n json[:doubles] = true\n @team = Team.new(json)\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: {errors: @team.errors}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "673a30744c9952f94cd96f985b5fb532", "score": "0.69736075", "text": "def create\n @team = Team.new(params[:team])\n Person.all.each do |person|\n @team.people << person if params[person.id.to_s]\n end\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6b20d604180c31b42d4f6a8bf9b4b3f", "score": "0.696013", "text": "def create\n players = params[:team][:players_attributes].values.collect { |p| Player.find_by_id(p.values.first) }.compact\n params[:team].delete(\"players_attributes\")\n @team = Team.new(params[:team])\n @team.players=players\n\n respond_to do |format|\n if params[:team] && @team.save\n format.html { redirect_to action: :index, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n elsif params[:team].blank?\n format.html { redirect_to @team }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7d27831d58243692e4d3232144def25", "score": "0.6942594", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { redirect_to @team }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de57b341c89abcf7a77e530a4af84ed1", "score": "0.6934291", "text": "def create\n @team = Team.new(team_savable_params)\n\n if @team.save\n render :show, status: :created\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "bb03276aa7ecdc12838db540b8a1a4a4", "score": "0.6933184", "text": "def index\n league = get_league\n @teams = league.teams\n render json: @teams, status: 201\n end", "title": "" }, { "docid": "4cbfa077848d4e8210c795bd28290150", "score": "0.69325846", "text": "def create\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b45d05c941700c991e4349cbf0e72d4", "score": "0.69244945", "text": "def create\n require_params :name\n\n @team = Team.create(team_params)\n\n if @team.valid?\n @team.add_member(@person, admin: true, no_emails: true, developer: true, public: true)\n\n render \"api/v1/teams/show\", status: :created\n else\n render json: { error: @team.errors.full_messages.to_sentence }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "55c3f8f3b8189b7150450a05173a8511", "score": "0.69196314", "text": "def create\n @api_team = Api::Team.new(api_team_params)\n\n respond_to do |format|\n if @api_team.save\n format.html { redirect_to @api_team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @api_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @api_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ef31b531f2086224f5d96c6ce806576", "score": "0.6915209", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bfad4ff235e59cbd1ec4bf1fd654ef7", "score": "0.6908785", "text": "def create\n @user_team = UserTeam.new(params[:user_team]) \n \n respond_to do |format|\n if @user_team.save\n format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n format.json { render json: @user_team, status: :created, location: @user_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5facae21a04744cb03f28a004fa0596", "score": "0.69016606", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: t('controllers.team.create') }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "627c579b042a910acc313987c4949e48", "score": "0.68992364", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c12a30aa76c5a8e7ea89f9561c9f4c3", "score": "0.68961525", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13ccd2ed374f0f8902bc3afa5efedb51", "score": "0.6886587", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b15abb04c1b83847e8937cdc18e21bc", "score": "0.6885424", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20f847b438ed132c92aa8c73a4d5826d", "score": "0.6880905", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team.league, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "803d8dc047d430b2256c7b8da2e10171", "score": "0.6870229", "text": "def create\n @team = Team.new(params[:team])\n # @team = @match.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1248adcc50e1ed2ef26bdd2dcbd4d425", "score": "0.6869397", "text": "def create\n @team = Team.new(team_params)\n @user = User.find(current_user.id)\n @user.team = @team\n @user.save\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "843344d8f02a38417148c1400c7ce4a0", "score": "0.6865155", "text": "def create\n @team = Team.new(team_params)\n @team.client = current_client if current_client\n respond_to do |format|\n if @team.save\n format.json { render action: 'index', status: :created, locals: {teams: current_client.teams} }\n else\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f580bc4c59d484f22ce48c61acc561d", "score": "0.68639696", "text": "def create\n @team = Team.new(params[:team])\n\n\t\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "56e983201d4b55d1dc8f40e4e5385f6c", "score": "0.6858721", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n add_members\n format.html { redirect_to teams_url, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b04793f609757b6e59982c9dfea225a", "score": "0.68478173", "text": "def create\n @test_team = TestTeam.new(params[:test_team])\n\n respond_to do |format|\n if @test_team.save\n format.html { redirect_to @test_team, notice: 'Test team was successfully created.' }\n format.json { render json: @test_team, status: :created, location: @test_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51a6c3db7ec28431fa1e8c89cf6c8259", "score": "0.6842168", "text": "def create\n @team = event.teams.new(team_params)\n @team.owner = current_user\n\n respond_to do |format|\n if @team.save\n @team.uid = @team.name.parameterize+'-'[email protected]_s\n @team.save\n format.html {redirect_to(event_team_path(event,@team), :notice => 'The new team was created')}\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9ff4f909fd4155431728e4a9c6911c", "score": "0.68343216", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94023a8b18ef26726011d7043e0f8619", "score": "0.683001", "text": "def create\n @team = current_user.created_teams.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(@team, :notice => 'Team was successfully created.') }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd994755a4e1efdb5a26fd39837b188c", "score": "0.6800414", "text": "def create\r\n # This line determines whether the original create team request came from a services or teams and sets up the redirect accordingly\r\n origin_redirect = params[:team][:origin] == 'services'? new_service_path : teams_path\r\n \r\n # Removes the :origin key/value from the params as is not part of saving the model\r\n params[:team].delete :origin\r\n @team = Team.new(params[:team])\r\n @buttonvalue = \"create team\"\r\n \r\n respond_to do |format|\r\n if @team.save\r\n current_user.teamsusers.create!(:team_id => @team.id, :role => 'admin')\r\n format.html { redirect_to origin_redirect + \"?myTeam=\" + @team.id.to_s, notice: 'Your team has been successfully created.' }\r\n format.json { render json: @team, status: :created, location: @team }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @team.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "ef62d04b0fe51fd245fc60bc94fc77e4", "score": "0.6795562", "text": "def create\n @sport = Sport.find(params[:sport_id])\n @team = @sport.teams.build(params[:team_id])\n\n respond_to do |format|\n # if @team.save\n if @team.update_attributes(params[:team])\n format.html { redirect_to [@sport, @team], notice: 'Team was successfully created.' }\n format.json { render json: [@team], status: :created, location: [@team] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "883300b8a7f67c99bc96df2185c25d75", "score": "0.67884076", "text": "def create\n @team = Team.new(team_params)\n \n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Команда успешно создана.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bd2cd4ccb4ceb783b0fe7427264d62c", "score": "0.6781625", "text": "def create\n @divisions = Division.all\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18e8ac7f699395f6efe4b894683c3259", "score": "0.6773573", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n # render :nothing => true\n format.html { redirect_to teams_path, notice: '' }\n format.json { render action: 'index', status: :created }\n else\n # render :text => @team.errors, :status => :unprocessable_entity\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52b402408a368a7d863f54b9585bcb9e", "score": "0.6749269", "text": "def create\n user = User.find_by(id: team_params[:user_id])\n if user\n @team = Team.new(team_params)\n if @team.save\n render \"api/teams/show\"\n else\n render json: @team.errors.full_messages, status: 404\n end\n else\n render json: [\"This user does not exist.\"]\n end\n end", "title": "" }, { "docid": "5e933d91d88ddd1b094b67704b2c44bd", "score": "0.6742657", "text": "def create\n @team = @league.teams.build(team_params)\n\n if @team.save\n redirect_to league_teams_url, notice: \"Team #{@team.name} was successfully created.\"\n else\n render :new\n end\n end", "title": "" }, { "docid": "287ff1b0d5c051f85d8e39fa1c2ec865", "score": "0.67317533", "text": "def create\n\t\t@team = Team.new(team_params)\n\n\t\tif @team.save\n\t\t\trender json: 'show', status: :date_created\n\t\telse\n\t\t\trender json: @team.errors, status: :unprocessable_entity\n\t\tend\n\tend", "title": "" }, { "docid": "f0d01b4ead75c832f22cd3ffc49cae25", "score": "0.6722351", "text": "def create\n @team = Team.new(team_params)\n @team.user_ids = current_user.id\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bdc35ee53f1027b20eafdb2ad5a1565", "score": "0.67195356", "text": "def create\n\n @user = User.new\n\n #Need the [:teams] because its a hash based on the post, and then\n #within that hash, we access the [:name]\n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n\n @user.save!\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { render :json => @user }\n end\n\n end", "title": "" }, { "docid": "4a6dd8c290e6c20486571be68acd030e", "score": "0.6719058", "text": "def create_team()\n begin\n bodyParams = {\n 'public': true,\n 'name': \"Ruby Team\",\n # Add internal members using their extension ids\n # Get your user extension id by calling the /restapi/v1.0/account/~/extension endpoint!\n 'members': [{ 'id': \"590490017\"}, { 'id': \"595861017\"}],\n # You can also add members using their email address, especially for guest members who are not under your account company.\n # 'members': [{'email': \"[email protected]\"}, { 'email': \"[email protected]\"}, {'id': \"[extensionId]\"}],\n 'description': \"Let's talk about Ruby\"\n }\n endpoint = \"/team-messaging/v1/teams\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts resp.body\n rescue StandardError => e\n puts (e)\n end\nend", "title": "" }, { "docid": "670c0e22b70c8484a6af58eaa471252d", "score": "0.67169946", "text": "def seed_teams\n response = HTTParty.get('https://fantasy.premierleague.com/api/bootstrap-static/')\n response.parsed_response\n if response.nil?\n puts 'error seeding teams'\n else\n Team.destroy_all\n response['teams'].each do |team|\n Team.create(name: (team['name']).to_s, code: (team['code']).to_s)\n end\n end\nend", "title": "" }, { "docid": "cf6491e64abfba1450e25a567e1c8e2a", "score": "0.67081666", "text": "def create\n @test_team = TestTeam.new(test_team_params)\n\n respond_to do |format|\n if @test_team.save\n format.html { redirect_to @test_team, notice: 'Test team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43d91bef87726b65dd59948b5ab315b5", "score": "0.67012185", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Die Mannschaft wurde erfolgreich erstellt.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fa8b75290e22120718a1a3f4f791145", "score": "0.6698894", "text": "def create\n @bet_team = Bet::Team.new(bet_team_params)\n\n respond_to do |format|\n if @bet_team.save\n format.html { redirect_to @bet_team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @bet_team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bet_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f436f7194e14cc2bd759539b293f2881", "score": "0.66862035", "text": "def create\n @user_team = UserTeam.new(user_team_params)\n\n respond_to do |format|\n if @user_team.save\n #format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n #format.json {} #render :show, status: :created, location: @user_team }\n format.html { redirect_to teams_path, notice: 'Požádavek odeslán.' }\n\n else\n format.html { render :new }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e86a462ce44c475a94121691a57a0ae", "score": "0.6683318", "text": "def create\n @users_team = UsersTeam.new(users_team_params)\n\n respond_to do |format|\n if @users_team.save\n format.html { redirect_to @users_team, notice: 'Users team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @users_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36b8292705380dd90281f9dbae5d0a65", "score": "0.66757816", "text": "def create\n @teams_test = TeamsTest.new(params[:teams_test])\n\n respond_to do |format|\n if @teams_test.save\n format.html { redirect_to @teams_test, notice: 'Teams test was successfully created.' }\n format.json { render json: @teams_test, status: :created, location: @teams_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teams_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9e34b9e9a571ad4ba0fa64e893e10a6", "score": "0.6675709", "text": "def create\n params[:team][:placeholder] = false\n @team = Team.new(params[:team])\n\n if @team.save\n @division.teams << @team\n @team.users << current_user\n @division.replace_fake_team(@team)\n redirect_to [@league, @division, @team], notice: 'Team was successfully created.' \n else\n render action: \"new\"\n end\n end", "title": "" }, { "docid": "51b0b1b17d1fa6b4edda222013bdef05", "score": "0.66401345", "text": "def create\n user_attrs = params[:team].delete(:user_attributes)\n user = User.new(user_attrs)\n if !user.save!\n flash[:error] = user.errors\n redirect_to new\n end\n\n @team = Team.new(params[:team])\n\n @team.user = user\n @team.user_id = user.id\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f75c7096e4ce161a97364167a31cff3", "score": "0.6624162", "text": "def create\n @teams_user = TeamsUser.new(teams_user_params)\n\n respond_to do |format|\n if @teams_user.save\n format.html { redirect_to @teams_user, notice: 'Teams user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teams_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @teams_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33687c3c37de2f0b58ba9060102d8dcd", "score": "0.66207784", "text": "def create\n @season_team = SeasonTeam.new(params[:season_team])\n\n respond_to do |format|\n if @season_team.save\n format.html { redirect_to @season_team, notice: 'Team was successfully created.' }\n format.json { render json: @season_team, status: :created, location: @season_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @season_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2925c6df3afa9cb8cff531c542da3c18", "score": "0.6611193", "text": "def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: t('notice_created', obj: t('label', scope: 'activerecord.attributes.team'), name: params[:team][:name]) }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54ad30191bdf01481b708c2717723e9c", "score": "0.6598855", "text": "def teams\n @tournament = Tournament.find(params[:id]);\n\n ### for the new form ###\n @n = GlobalConstants::FORMAT[:bp][:num_speakers_per_team];\n @name = \"\";\n @emails = [];\n (1..@n).each { |i|\n @emails.push(\"\");\n } #start off with correct number of blank emails\n \n ### for the table of teams ###\n #build a list of institutionally (alphabetical) ordered teams\n # *** will be interesting to try this with 100 teams (small tournament)\n # 400 (WUDC) and 1000 (wtf...)\n @list = @tournament.get_sorted_teams;\n end", "title": "" }, { "docid": "ce1a04957215193360a84c382b19d01e", "score": "0.6595629", "text": "def create\n @team = Team.new(params[:team])\n @users = User.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to teams_path, notice: \"Your team was created!\" }\n else\n format.html { render action: \"new\", layout: false }\n end\n end\n end", "title": "" }, { "docid": "7c38b821a1447bfe51f697f807da0c46", "score": "0.6590708", "text": "def create\n @team = Team.new(params[:team])\n @team.current_user = current_user\n \n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f51d45190f92cbeb19f9f2f36c26f6b", "score": "0.6585911", "text": "def create\n players_to_save = [@current_user]\n\n params[:players_list].split(\",\").each do |id|\n players_to_save.include?(User.find_by_id(id)) ? next : players_to_save.push(User.find_by_id(id))\n end\n\n @team = current_user.teams.new(team_params)\n @team.user_id = current_user.id\n @team.users = players_to_save\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5eaadb4f6992247905b9a7e2bde4399e", "score": "0.6573159", "text": "def new\n @team = @season.teams.build(params[:team])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end", "title": "" }, { "docid": "f4809ad5e43618134256f8e346d92a61", "score": "0.6541958", "text": "def create\n #Keeping in mind that this can be accessed by normal users\n #Ensure that they are not in a team already.\n @user = current_user\n flash[:alert] = \"\"\n\n\n if (not @user.nil? and @user.currentGame().teams.where(:user_id => @user.id).empty?) or current_user.try(:admin?)\n\n\n @team = Team.new(params[:team])\n\n\n #encrypt provided password\n @team.password = BCrypt::Password.create(@team.password)\n\n respond_to do |format|\n if @team.save\n if not current_user.try(:admin?)\n @team.users << @user\n end\n current_user.currentGame().teams << @team\n current_user.created_teams << @team\n current_user.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n else \n flash[:alert] = \"You are already in a team, and you are trying to create a new one!\"\n redirect_to :controller => \"home\", :action => \"index\"\n end\n \n end", "title": "" }, { "docid": "20ae7b6ae41cc03dd8cf8f7bcb3915ef", "score": "0.652406", "text": "def create\n @team = Team.new(\n name: params[:team]['name'],\n logo: \"tempfilename\",\n description: params[:team]['description'],\n member_count: params[:team]['member_count'].to_i,\n captain_player_id: params[:team]['captain_player_id'].to_i\n )\n\n respond_to do |format|\n if @team.save\n\n @player_team = PlayerTeam.new(\n player_id: current_user.player.id,\n team_id: @team.id\n )\n @team.member_count += 1 if @player_team.save\n\n @team_stat = TeamStat.new(\n team_id: @team.id,\n win: 0,\n lose: 0\n )\n @team_stat.save\n\n @team_tournament = TeamTournament.new(\n team_id: @team.id,\n tournament_id: params[:post][:tournament_id].to_i\n )\n @tournament = Tournament.find params[:post][:tournament_id].to_i\n @tournament.team_count += 1\n @tournament.save \n @team_tournament.save\n\n format.html { redirect_to action: 'captain_teams', id: 0 , notice: t('successfully_created_team') }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "997b859f57b2baaa1a0041ec769cb36c", "score": "0.6522848", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to :action => \"teamassign\", :id => @team.id, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27620ae847673b5a656f1282672c0531", "score": "0.65090567", "text": "def create\n @team = @current_competition.teams.new(team_params)\n\n respond_to do |format|\n if @team.save\n flash[:notice] = 'Team was successfully created.'\n format.html { redirect_to(@team) }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "844a828f1d329847fdbff07f558bd908", "score": "0.6508577", "text": "def teams(attrs = {})\n Dribbble::Team.batch_new token, html_get('/user/teams', attrs)\n end", "title": "" }, { "docid": "f79fb21a8310a4a18fec88daec6790bb", "score": "0.65078586", "text": "def create\n @team = Team.new(team_params)\n \n respond_to do |format|\n if @team.save \n @team.update(:owner => current_user.id)\n @team.users << current_user\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e33cd7b11cb2e91e7dbfc5b95be8aa6c", "score": "0.6507042", "text": "def create\n @team = Team.new(params[:team])\n if @team.save\n flash[:notice] = \"Team Created!!\"\n respond_with(@team)\n else\n flash[:alert] = \"Error!!\"\n render :new\n end\n end", "title": "" }, { "docid": "8cbe19c96c0da4fd9c61fb5e23078ecd", "score": "0.6484479", "text": "def new\n @teams = Team.all\n @tournament = Tournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end", "title": "" }, { "docid": "59493e49b1a0b9e611bcdbe63656e0e0", "score": "0.6481958", "text": "def create\n @team = Team.new(team_params)\n\n\n respond_to do |format|\n if @team.save\n @team.create_owner(current_user)\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27d9e447e63f310ee7f548c1c7b95dee", "score": "0.6481", "text": "def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(teams_url, :notice => 'Team was successfully created.') }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c2c534442ef0e3de003568e42a997b5", "score": "0.6468219", "text": "def new\n @team = Team.new\n @people = Person.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end", "title": "" } ]
74e550258132c14a508ae46fdec0b264
GET /bus_line_directions GET /bus_line_directions.json
[ { "docid": "8f97ea45eec976a777e8a7dfe322684b", "score": "0.7396735", "text": "def index\n @bus_line_directions = BusLineDirection.all\n end", "title": "" } ]
[ { "docid": "7e09d1d0931a97b1e6729cd59d9ef950", "score": "0.7047474", "text": "def bus_api_getdirections(route)\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getdirections?key=#{apiKey}&rt=#{url_safe_route}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end", "title": "" }, { "docid": "9794e0e0794e147448b85a4b223d99af", "score": "0.67039806", "text": "def create\n @bus_line_direction = BusLineDirection.new(bus_line_direction_params)\n\n respond_to do |format|\n if @bus_line_direction.save\n format.html { redirect_to @bus_line_direction, notice: 'Bus line direction was successfully created.' }\n format.json { render :show, status: :created, location: @bus_line_direction }\n else\n format.html { render :new }\n format.json { render json: @bus_line_direction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6498f67b5b3209c081a0d3921ec19c94", "score": "0.6550767", "text": "def new\n @bus_route = BusRoute.new\n @break_points=BreakPoint.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_route }\n end\n end", "title": "" }, { "docid": "954d4c263f50f8b8b20c8e697f88355e", "score": "0.6424612", "text": "def fetchRoutes\n\t\t# Bus routes\n\t #http://api.wmata.com/Bus.svc/json/JRoutes?api_key=YOUR_API_KEY\n\t #\n\t # Bus route details...\n\t #\n\t logger.info \"Fetching, fetching...\"\n\t result = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRoutes?api_key=#{@@apiKey}\")\n\n\t # if the hash has 'Error' as a key, we raise an error\n\t logger.info \"Got some data...\"\n\t if result.has_key? 'Error'\n\t \traise \"JSON error\"\n\t end\n\t logger.info \"No error...\"\n\t result['Routes'].each do |route|\n\t \trouteId=route['RouteID']\n\t \tlogger.info \"Processing route #{routeId}...\"\n\t \trouteData = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRouteDetails?routeId=#{URI.escape(routeId)}&api_key=#{@@apiKey}\")\n\t \t#d.keys: [\"Direction0\", \"Direction1\", \"Name\", \"RouteID\"] \n\t \taddRouteData(routeData)\n \t\tend\n\tend", "title": "" }, { "docid": "211f910b74945f7055e0669b174c164a", "score": "0.6380865", "text": "def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend", "title": "" }, { "docid": "bfe5fed12a660aae7ec52b34fc71d931", "score": "0.6279031", "text": "def directions(user_address, end_address)\n directions_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {:origin => user_address,\n :destination => end_address,\n :sensor => false}\n ).to_s\n\n legs = JSON.parse(RestClient.get(directions_url))[\"routes\"][0][\"legs\"]\n\n directions = legs[0][\"start_address\"] + \"\\n\"\n steps = legs[0][\"steps\"]\n steps.each do |step|\n directions += \"#{Nokogiri::HTML(step[\"html_instructions\"]).text} \" +\n \"[#{step[\"distance\"][\"text\"]}]\\n\"\n end\n directions += legs[0][\"end_address\"]\nend", "title": "" }, { "docid": "8658ce138c3784c3eaf1fedd768705a4", "score": "0.6225124", "text": "def get_directions(start_point, end_point)\n user_direc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/directions/json\",\n :query_values => {:origin => \"#{start_point}\",\n :destination => \"#{end_point}\",\n :sensor => \"false\",\n :mode => \"walking\"}\n )\n directions_json = RestClient.get(user_direc.to_s)\n JSON.parse(directions_json)\n end", "title": "" }, { "docid": "cd4dc6d789c15aedba7281ac609034f5", "score": "0.62024826", "text": "def bus_line_direction_params\n params.require(:bus_line_direction).permit(:display_name, :bus_route_id, :direction_name, :code)\n end", "title": "" }, { "docid": "c01038440bb33f614edb91f12d6529c5", "score": "0.619056", "text": "def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end", "title": "" }, { "docid": "316cd85946f03b01c3286e9f4a2ea080", "score": "0.61443996", "text": "def set_bus_line_direction\n @bus_line_direction = BusLineDirection.find(params[:id])\n end", "title": "" }, { "docid": "4d4768d1cfbeb48841199153125c9b4e", "score": "0.6131847", "text": "def show\n @service = Service.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { \n render :json => @service.to_json(:methods => [:polyline],:only => [:shipment]) \n }\n end\n end", "title": "" }, { "docid": "ef029020e5cfa600a5063fbf68dbeca0", "score": "0.60822713", "text": "def index\n\n @directions = Direction.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @directions }\n format.xml { render :xml => @directions }\n end\n end", "title": "" }, { "docid": "8e10cc2d5fc40dcac06a60a25911a034", "score": "0.6054076", "text": "def bus_api_getstop(route, directions, latitude, longitude)\n\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n\n directions.each do |direction|\n url_safe_direction = URI.encode(direction)\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getstops?key=#{apiKey}&dir=#{url_safe_direction}&rt=#{url_safe_route}\"\n apiResults = Hash.from_xml(open(apiLink).read)\n stops = apiResults[\"bustime_response\"][\"stop\"]\n stops.each do |stop|\n if (stop[\"lat\"][0, 6] == latitude[0, 6] && stop[\"lon\"][0, 7] == longitude[0, 7])\n return stop\n end\n end\n end\n return 0\n end", "title": "" }, { "docid": "7f6fd84d81928dc47067a06689cbd71e", "score": "0.6019408", "text": "def search_coord_route\n sql_results = Route.select(\"ST_AsGeoJSON(path) as path\")\n .where(\"cod_route = ?\", \"#{params[:id]}\").to_sql\n\n resp = ActiveRecord::Base.connection.execute(sql_results).map do |value|\n ActiveSupport::JSON.decode(value[\"path\"])[\"coordinates\"]\n end\n render json: resp\n end", "title": "" }, { "docid": "5633616f44330309e5271d02acb4a4b7", "score": "0.59596235", "text": "def index\n @directions = Direction.all\n end", "title": "" }, { "docid": "aebce5b9df939f603b9e29c103fb53f9", "score": "0.593006", "text": "def update\n respond_to do |format|\n if @bus_line_direction.update(bus_line_direction_params)\n format.html { redirect_to @bus_line_direction, notice: 'Bus line direction was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_line_direction }\n else\n format.html { render :edit }\n format.json { render json: @bus_line_direction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2eb7f9c3d3cca9c8905c617d9ce10abf", "score": "0.5887481", "text": "def index\n @recipe_directions = @recipe.directions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_directions }\n format.json { render :json => @recipe_directions }\n end\n end", "title": "" }, { "docid": "0a50c13cb6a34b1d2b64d0319e3f4d9f", "score": "0.5876215", "text": "def get_stops\n @agency = params[:agency]\n @route = params[:route]\n @direction = params[:direction] ? \"~\" + params[:direction] : \"\"\n\n request_url = \"http://services.my511.org/Transit2.0/GetStopsForRoute.aspx?token=#{@@token}&routeIDF=#{@agency}~#{@route}#{@direction}\"\n request_url = request_url.gsub(/ /,\"%20\")\n p parse_request(request_url)\n @stops = search_for_key(parse_request(request_url), \"Stop\") || []\n\n @stops = [@stops] unless @stops.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "title": "" }, { "docid": "43c2cc6e614f30c134831dc110abd37e", "score": "0.5852612", "text": "def get_route\n data = {\n visits: visits,\n fleet: fleet\n }\n\n data[:options] = options if options\n result = Util.send_request(\"POST\", \"vrp\", Routific.token, data)\n RoutificApi::Route.parse(result)\n end", "title": "" }, { "docid": "5302658801ad6db915c08b26cf275c36", "score": "0.58376", "text": "def index\n @line_destinations = LineDestination.all\n end", "title": "" }, { "docid": "c5388e73b10f2d89a111d8ca2e7cf6de", "score": "0.5817161", "text": "def search_directions\n @query = 1\n @error = 0\n @departure_address = params[:departure_address]\n @arrival_address = params[:arrival_address]\n bus_transit = params[:bus_transit]\n train_transit = params[:train_transit]\n metra_transit = params[:metra_transit]\n @preferred = params[:preferred]\n apikey = \"AIzaSyCDeWWmT-KYmsgSz9d2vCy0KcOmJe114y4\"\n\n if @departure_address != \"\" && @arrival_address != \"\"\n url_safe_dep = URI.encode(@departure_address)\n url_safe_arr = URI.encode(@arrival_address)\n @type_transport = ''\n\n if !bus_transit.nil?\n @type_transport = bus_transit\n end\n\n if !train_transit.nil?\n @type_transport += \"|\" + train_transit\n end\n\n if !metra_transit.nil?\n @type_transport += \"|\" + metra_transit\n end\n\n if !@type_transport != '' && [email protected]? && @preferred != \"\"\n url_safe_typ = URI.encode(@type_transport)\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{@url_safe_typ}&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n\n elsif !@type_transport != ''\n url_safe_typ = URI.encode(@type_transport)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{url_safe_typ}&key=#{apikey}\"\n\n elsif [email protected]? && @preferred != \"\"\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n else\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true\"\n end\n\n @directions = JSON.parse(open(apiLink).read, object_class: OpenStruct)\n\n if @directions.status == \"OK\"\n @routes = @directions.routes\n @error = 0\n else\n @message = \"No station found, try again\"\n @error = 1\n end\n else\n @message = \"Please enter a value for departure and arrival address\"\n @error = 1\n end\n\n #render :json => @routes\n render 'directions'\n end", "title": "" }, { "docid": "1139680562442147099ab3c362b3fb8d", "score": "0.5768241", "text": "def routes\n @logger.info \"#{__method__}\"\n fill_in \"JourneyPlanner$txtNumberOfPassengers\", with: \"1\"\n country_routes = list_countries.inject([]) do |country_result, country|\n @logger.info \"routes for #{country}\"\n select(country, :from => \"JourneyPlanner_ddlLeavingFromState\")\n sleep 3\n to_from = list_leaving_from.inject([]) do |from_result, from|\n @logger.info \"routes from #{from}\"\n sleep 2\n select(from, :from => \"JourneyPlanner$ddlLeavingFrom\")\n from_result << {from => list_travelling_to}\n from_result\n end\n country_result << {country => to_from}\n country_result\n end\n end", "title": "" }, { "docid": "33d4fcedaecdc31ba47b6d9b5c61359a", "score": "0.5747181", "text": "def show\n @journey = Journey.find(params[:id])\n render json: @journey\n end", "title": "" }, { "docid": "bab52a046e89fc454be89f5c19b6b718", "score": "0.5729726", "text": "def create\n @bus_route = BusRoute.new(params[:bus_route])\n\n respond_to do |format|\n if @bus_route.save\n format.html { redirect_to @bus_route, notice: 'Bus route was successfully created.' }\n format.json { render json: @bus_route, status: :created, location: @bus_route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bus_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a53539ceb0770abf1cf00526434c5025", "score": "0.5715415", "text": "def add_route\n type = OrderType.find_by_name('route')\n \n hwb = Order.find(params[:id])\n \n data = params[\"route\"]\n data[\"parent_id\"] = params[:id]\n \n data[\"created_by\"] = self.current_user.account # <-- hardcoded to Transmance compnay id\n data[\"order_type_id\"] = type.id\n data[\"bill_to_id\"] = 1 # <-- hacked to Transmanage company id\n data[\"billing_method_id\"] = 1 # <-- read this from db!!!!!!!!!!!!!!\n data[\"shipping_method_id\"] = 1 # <-- hardcoded.\n data[\"pieces\"] = 1\n data[\"declared_value\"] = 0\n data[\"purpose\"] = ''\n data[\"weight\"] = 0\n data[\"shipping_commodity_id\"] = 1\n\n res = {\n :success => false,\n :data => [],\n :msg => ''\n }\n\n Order.transaction do \n # super can handle it from here...\n order = Order.create(data)\n \n # get OrderTypeEntity list\n entities = order.type.entities(:include => [:domain])\n \n case params[\"pickup_mode\"]\n when \"shipper\" \n params[\"shipper\"] = {\"company_id\" => Order.find(params[:id]).find_entity_by_type(\"shipper\").company.id}\n when \"carrier\"\n params[\"shipper\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]} \n end\n \n case params[\"delivery_mode\"]\n when \"carrier\"\n params[\"consignee\"] = {\"company_id\" => params[\"carrier\"][\"company_id\"]}\n end\n entities.each do |e| \n data = params[e.name] \n case e.name\n when \"shipper\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['origin_airport_id']} AND company_id = #{params['shipper']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"shipper\"][\"company_id\"], hwb.find_entity_by_type('shipper').location)\n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_in\"] + ' ' + params[\"carrier\"][\"time_in\"]\n when \"consignee\"\n location = CompanyLocation.find(:first, \n :conditions => \"airport_id = #{params['destination_airport_id']} AND company_id = #{params['consignee']['company_id']}\"\n ) || Company.create_anonymous_location(params[\"consignee\"][\"company_id\"], hwb.find_entity_by_type('consignee').location) \n data[:company_location_id] = location.id\n data[:date_in] = params[\"carrier\"][\"date_out\"] + ' ' + params[\"carrier\"][\"time_out\"]\n when \"carrier\" \n data[:company_location_id] = Company.find(params[\"carrier\"][\"company_id\"], :include => [:head_office]).head_office.id \n end\n data[:order_id] = order.id\n data[:order_type_entity_id] = e.id \n oe = OrderEntity.create(data)\n end\n \n res[:success] = true\n res[:data] = {:route => Order.render_route(order)}\n res[:msg] = 'Added order route' \n end\n\n render :json => res.to_json, :layout => false\n\n end", "title": "" }, { "docid": "ac3c510eb861aca101e6da4fc4754f83", "score": "0.5710759", "text": "def arrivals(lang = 'is')\n Apis.client.get(\"/flight?type=arrivals&language=#{lang}\")\n end", "title": "" }, { "docid": "f443ae4fa0778eb82d4287cbb4cb16d1", "score": "0.57102185", "text": "def find_by_route\n @result = Array.new\n @distancias = Array.new\n\n @ride = Ride.order('id')\n if params[:radio] != '0'\n @ride.each do |p|\n distancia1 =Geocoder::Calculations.distance_between([params[:destLatitud],params[:destLongitud]], [p.destPointLat,p.destPointLong])\n distancia2 =Geocoder::Calculations.distance_between([params[:startLatitud],params[:startLongitud]], [p.startPointLat,p.startPointLong])\n if distancia1 <params[:radio].to_f && distancia2 <params[:radio].to_f\n @result.push(p)\n #@distancias.push(distancia1)\n end\n end\n # json_response={\n # result: @result,\n # distancias: @distancias\n # } \n respond_with @result , location: nil\n end\n if params[:radio] == '0'\n respond_with @ride,location: nil\n end \n #Ride.find_by_destPointLat_and_destPointLong(params[:latitud],params[:longitud])\n \n end", "title": "" }, { "docid": "fa9e6d3dab3bd358ce45d1dd287f14d3", "score": "0.5700492", "text": "def show\n @tripJson = []\n @trip.segments.order(:order).each do |segment|\n locations = []\n segment.locations.order(:order).each do |location|\n locations << {:id => location.id, :lat => location.latitude, :lng => location.longitude }\n end\n @tripJson << {:id => segment.id, :transportation => segment.transportation, :locations => locations}\n end\n end", "title": "" }, { "docid": "29648a61f7233f87fdc246c2d7716707", "score": "0.5692966", "text": "def getVideoFromPolylineAS\n\t\t\n\t\tif !params[:poly_id]\n\t\t\trender :text => \"Failed. (Parameters set improperly)\"\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tspeed = Syncronisation.find_by_sql([\"select time, distance from syncronisations where route_id in (select id from routes where polyline_id = ?) order by time\", params[:poly_id]])\n\t\troute = Route.find(:first, :conditions => [ \"polyline_id = ?\", params[:poly_id] ]);\n\t\t\n\t\trender :json => {:video_id => route.video_id, :sync => speed}.to_json\n\tend", "title": "" }, { "docid": "29648a61f7233f87fdc246c2d7716707", "score": "0.5692966", "text": "def getVideoFromPolylineAS\n\t\t\n\t\tif !params[:poly_id]\n\t\t\trender :text => \"Failed. (Parameters set improperly)\"\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tspeed = Syncronisation.find_by_sql([\"select time, distance from syncronisations where route_id in (select id from routes where polyline_id = ?) order by time\", params[:poly_id]])\n\t\troute = Route.find(:first, :conditions => [ \"polyline_id = ?\", params[:poly_id] ]);\n\t\t\n\t\trender :json => {:video_id => route.video_id, :sync => speed}.to_json\n\tend", "title": "" }, { "docid": "f74ae16835364318cf8bba9e0fc97a19", "score": "0.56778234", "text": "def flight_route(origin, destination, date=nil, params={})\n args = [origin, 'departures', destination, format(date)].compact.join('/')\n perform_get(\"/airports/#{args}.xml\", params)\n end", "title": "" }, { "docid": "9e0fe825fbba63ecb76f1f131b800414", "score": "0.5674963", "text": "def index\n @roadmap_steps = RoadmapStep.all\n end", "title": "" }, { "docid": "67efd610d0f1c1d62d694e279efed546", "score": "0.5667174", "text": "def show\n @trip = Trip.find(params[:id])\n @markers = @trip.markers\n @gmaps_options = @markers.to_gmaps4rails\n\n @polylines_json = {}\n polylines = [] \n polylines[0] = []\n @trip.markers.each do |marker|\n polylines[0] += [{:lng=>marker.longitude.to_f, :lat=>marker.latitude.to_f}]\n end\n\n \n @polylines_json = polylines.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end", "title": "" }, { "docid": "cab75a3a13165832124bdccc8c1833c4", "score": "0.5647445", "text": "def show\n \n @url = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{@trip.origin.gsub(\" \", \"_\") + \"_ny\"}&destination=#{@trip.destination.gsub(\" \", \"_\") + \"_ny\"}\"\n \n #driving details\n @drivingroute=HTTParty.get(@url)\n @drivingroutedetails = {'distance' => @drivingroute['routes'][0]['legs'][0]['distance']['text'], 'time' => @drivingroute['routes'][0]['legs'][0]['duration']['text']}\n @urltransit = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{@trip.origin.gsub(\" \", \"_\") + \"_ny\"}&destination=#{@trip.destination.gsub(\" \", \"_\") + \"_ny\"}&departure_time=#{@trip.departure_time.to_i}&mode=transit\"\n\n #transit details\n @transitroute=HTTParty.get(@urltransit)\n @transitroutedetails = {'distance' => @transitroute['routes'][0]['legs'][0]['distance']['text'], 'time' => @transitroute['routes'][0]['legs'][0]['duration']['text']}\n\n \n @carbondioxideemission = @drivingroute['routes'][0]['legs'][0]['distance']['text'].to_f*248\n @gasolineused = @drivingroute['routes'][0]['legs'][0]['distance']['text'].to_f*0.04149\n\n # Trip.find(params[:id]).cabcost(@drivingroutedetails['distance'].to_f,@drivingroutedetails['time'].to_i)\n\n @moneyspent = Trip.find(params[:id]).cabcost(@drivingroutedetails['distance'].to_f,@drivingroutedetails['time'].to_i)\n @moneysaved = (@moneyspent/(Trip.find(params[:id]).number_of_people.to_f) - 2.50).to_f\n\n\n # 163g of CO2 emitted per mile for transit....411g of C02 emitted per mile for cars = 248 diff\n # 9.4g of CO emitted per mile for cars ...\n #sources: EPA, CarbonFund.org, \n\n #http://www.epa.gov/otaq/consumer/420f08024.pdf\n\n #stats to be seen: CO2, gasoline saved, money saved \n\n\n \n end", "title": "" }, { "docid": "841dcdc39c3621b3716d90de74916fc9", "score": "0.5635717", "text": "def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end", "title": "" }, { "docid": "8c0788227622391e63035342e622d20c", "score": "0.56132007", "text": "def destroy\n @bus_line_direction.destroy\n respond_to do |format|\n format.html { redirect_to bus_line_directions_url, notice: 'Bus line direction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a7d1c06ac9b049b43dde2b407cf95db", "score": "0.5610444", "text": "def arrivals\n #Project.hit 35\n @departing = false\n @from = params[:from]\n @to = params[:to]\n\n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end", "title": "" }, { "docid": "0181a2f8caf71f7966579a42a382709e", "score": "0.56024754", "text": "def show\n @destination = Destination.find(params[:id])\n @rentals = @destination.rentals\n\n @json = @destination.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end", "title": "" }, { "docid": "6fb02f60104371e170526d8894455157", "score": "0.5599665", "text": "def show\n @batting_line = BattingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batting_line }\n end\n end", "title": "" }, { "docid": "e50e137436a0ef573e0295996b13d90c", "score": "0.55909586", "text": "def show\n @road = Road.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @road }\n end\n end", "title": "" }, { "docid": "565c076d293e70594962ae162a3a2989", "score": "0.5590399", "text": "def directions(options)\n %i[start finish way_points].each do |key|\n options[key] = options[key].join(',') if options[key].respond_to?(:join)\n end\n\n response = client.get(DIRECTIONS_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_directions_from(response.items)\n end", "title": "" }, { "docid": "8aa63d2b8b3bccfb0722d7261b3c905b", "score": "0.558686", "text": "def index\n # @checkpoints = Checkpoint.all\n @route = Route.find(params[:route_id])\n @checkpoints = @route.checkpoints\n # render json: {\n # checkpoints: @checkpoints.to_a\n # }\n end", "title": "" }, { "docid": "b697f84e6ae534a6b54c80a7be9271c8", "score": "0.55856925", "text": "def index\n @ways = Way.all\n end", "title": "" }, { "docid": "20622ac8b4506aaa0c28c398583c6f04", "score": "0.5583398", "text": "def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end", "title": "" }, { "docid": "74e22faa13ce632c80034a6b0b1be543", "score": "0.55822", "text": "def generate_route_shapes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routeShapes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tjson = nil\n\t\t\twhile json.nil?\n\t\t\t\tresponse2 = HTTParty.get('http://citppuc.cloudapp.net/api/lineas/'+item[\"linea_id\"].to_s)\n\t\t\t\tnext if response2.body == ''\n\t\t\t\tjson = JSON.parse(response2.body)\n\t\t\tend\n\t\t\tif json[\"secuencias\"]\n\t\t\t\tjson[\"secuencias\"].each do |sec|\n\t\t\t\t\tputs \"Agregando secuencia \"+sec[\"codigo_secuencia\"]\n\t\t\t\t\tif sec[\"horarios\"]\n\t\t\t\t\t\tsec[\"horarios\"].each do |h|\n\t\t\t\t\t\t\tdias = ''\n\t\t\t\t\t\t\th[\"dias\"].each do |dia|\n\t\t\t\t\t\t\t\tdias << dia+','\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcsv << [ item[\"codigo_linea\"], sec[\"codigo_secuencia\"], h[\"hora_inicio\"], h[\"hora_termino\"], dias]\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"No tiene horarios!\"\n\t\t\t\t\tend\n\n\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"No tiene secuencias\"\n\t\t\tend\n\n\t\tend\n\tend\nend", "title": "" }, { "docid": "839f9f29be4cac931d11c08e9fce8a85", "score": "0.5565922", "text": "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "title": "" }, { "docid": "ae105b383eb94bf219a1952801775dc6", "score": "0.55503166", "text": "def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end", "title": "" }, { "docid": "bd8441aad3ec64d6dd7b26a5ac39a5c9", "score": "0.5546232", "text": "def show\n @bus = Bus.find(params[:id])\n @stops = @bus.stops.order('stop_number ASC')\n @h = Hash.new\n @h[:lat] = @bus.current_lat\n @h[:lng] = @bus.current_lan\n @h[:infowindow] = \"Driver Email: \" + @bus.user.email + \"<br>Bus Number: \"+ @bus.bus_number + \"<br>\" + @bus.description + \"<br>Bus Starting Point\"\n @hash = Gmaps4rails.build_markers(@stops) do |s, marker|\n marker.lat s.latitude\n marker.lng s.longitude\n marker.infowindow s.name\n end\n @points = []\n @points << @h\n @hash.each do |h|\n @points << h\n end\n end", "title": "" }, { "docid": "9397c75190603a19fa625a8cbc0e1e5e", "score": "0.55423486", "text": "def show\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_station }\n end\n end", "title": "" }, { "docid": "27701d8f5b54c98d2ed9e0d38d93eade", "score": "0.55272126", "text": "def show\n @rubidevice = Rubidevice.find(params[:id])\n # authorize! :show, @rubidevice\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render :json => @track.to_json(:methods => [:polyline],:only => [:name])}\n #format.json { render json: { \"language\" => @languages.as_json(:root => false) }.to_json }\n # render :json => @track.to_json(:methods => [:polyline],:only => [:name])\n end\n end", "title": "" }, { "docid": "8975740be2b745ec9b5db02cef8d42ca", "score": "0.5525351", "text": "def tfl_journey_planner\n Tube.display_lines\n get_start_line\n Station.list_all_stations(@start_line)\n get_start_station\n Tube.display_lines\n get_end_line\n get_end_station\n print_stations_en_route\n end", "title": "" }, { "docid": "fb36d7df047c63431041bab55a632b3f", "score": "0.5514039", "text": "def test_find_route_success\n @south_america = Init.set_up_map('../JSON/test_data.json')\n santiago = @south_america.vertices[@south_america.metros['santiago']]\n lima = @south_america.vertices[@south_america.metros['lima']]\n route = santiago.find_route(@south_america.metros['lima'])\n assert_equal(1, route.length)\n assert_instance_of(Array, route)\n assert_equal(route[0].vertex, lima)\n end", "title": "" }, { "docid": "b8a4b5b0451af27dec6cc8bcf23be933", "score": "0.5498584", "text": "def create_route(itinerary)\n locations = []\n # puts itinerary\n itinerary.each do |item|\n if item[:error] == nil\n locations << item[:route_coords]\n end\n end\n get_route(locations)\nend", "title": "" }, { "docid": "f441f28af6eacb6817876c08c5d32f45", "score": "0.54924107", "text": "def index\n @trips = Trip.order(params[:sort].to_s + \" \" + params[:direction].to_s)\n @tripLocation = Trip.pluck(:id)\n @markers = Marker.where(\"trip_id in (?)\", @tripLocation)\n @gmaps_options = @markers.to_gmaps4rails\n\n @polylines_json = {}\n polylines = []\n\n @trips.each_with_index do |trip, i|\n polylines[i] = []\n trip.markers.each do |marker|\n polylines[i] += [{:lng=>marker.longitude.to_f, :lat=>marker.latitude.to_f}]\n end\n end\n \n @polylines_json = polylines.to_json\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "title": "" }, { "docid": "dc656993a50c5ce142196c2334c6f09d", "score": "0.5491042", "text": "def filter_by_route\n array = []\n data.entry.arrivalsAndDepartures.each do |bus|\n time = OneBusAway::Utilities.convert_time bus.scheduledDepartureTime\n array << { bus.routeShortName => time }\n end\n array\n end", "title": "" }, { "docid": "8938d9aacb89371e75432e023bee0867", "score": "0.5485464", "text": "def show\n set_delivery_truck\n @myVehicles = Vehicle.where(\"truck_id LIKE ?\", params[:id])\n @delivery_truck.update(occupied_slots: @myVehicles.length)\n @waypoints = Array.new\n @distances = Array.new\n @directions = Array.new\n @destination;\n\n @myVehicles.each do |vehicle|\n ##Include only one of each destination \n @waypoints.push(vehicle.origin)\n @waypoints.push(vehicle.destination)\n end\n if @waypoints.empty?\n else\n ###Find furthest point for destination\n @waypoints.each do |wp|\n @directions.push GoogleDirections.new(@delivery_truck.origin, wp)\n @distances.push (@directions.last.distance_in_miles)\n end\n if @directions.any?\n @destination = @waypoints[@distances.index(@distances.max)]\n end\n end\n\n end", "title": "" }, { "docid": "bc4aa696a2bff328e7b9af95bee4363c", "score": "0.5481543", "text": "def route_config(direction)\n stops_xml = MbtaWrapper::BusLine.get_xml('routeConfig', line.to_i)\n stops = []\n stops_xml.elements.each('body/route/stop') do |stop|\n stops << stop.attributes['title']\n end\n stops\n end", "title": "" }, { "docid": "c71306191c44e81ebff04844d4d975de", "score": "0.546787", "text": "def bus_api(stpid, route)\n url_safe_stpid = URI.encode(stpid)\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getpredictions?key=#{apiKey}&stpid=#{url_safe_stpid}&rt=#{url_safe_route}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end", "title": "" }, { "docid": "c9413738f0c3b8242d31e814b6af7400", "score": "0.5467366", "text": "def new\n @line_station = LineStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_station }\n end\n end", "title": "" }, { "docid": "721a55e52c91eb274e4c65cb84e149f9", "score": "0.5463966", "text": "def getRoutes\n # [[\"MTA NYCT_B65\", \"B65\", \"Downtown Brooklyn - Crown Heights\", \"via Bergen St & Dean St\"]...]\n url = \"http://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=#{APIKEY}\"\n xml_str = Net::HTTP.get URI(url)\n xml = Nokogiri::XML(xml_str)\n xml.css(\"response data list route\").to_a.map{|rte| [rte.css('id').text, rte.css('shortName').text, rte.css('longName').text, rte.css('description').text]}\nend", "title": "" }, { "docid": "3142f03a8daa56bdb1169b2b18b9fe50", "score": "0.545748", "text": "def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end", "title": "" }, { "docid": "7a0ba41aeed38c4b30cec27a9b8f425d", "score": "0.54522973", "text": "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", "title": "" }, { "docid": "53e2f8fda614acf5ac023f968fce1e47", "score": "0.5441606", "text": "def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end", "title": "" }, { "docid": "ca6a4a97ba22b273ad31e20f3cca0be3", "score": "0.5436505", "text": "def new\n @batting_line = BattingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batting_line }\n end\n end", "title": "" }, { "docid": "0b02f2dace6a0a01131999afbecaaefa", "score": "0.5424819", "text": "def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end", "title": "" }, { "docid": "2ae7a55dae8529928210360a454a37af", "score": "0.5424282", "text": "def new\n @route_line = RouteLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_line }\n end\n end", "title": "" }, { "docid": "2f43b08ddbac5ed2890cfb5b7cf9b8ad", "score": "0.5418724", "text": "def index\n @dte_directions = DteDirection.all\n end", "title": "" }, { "docid": "f01ab6501601786cdfd37f22eb824c6d", "score": "0.5412204", "text": "def index\n @way_points = WayPoint.all\n end", "title": "" }, { "docid": "ac3f70b19375fe17f40120c63b9ed931", "score": "0.5411405", "text": "def show\n @bemap = Bemap.find(params[:id])\n @bemap_polylines = []\n @bemap_characters = []\n @bemap.characters.each do |v|\n @bemap_characters << { :lng => v[:longitude], :lat => v[:latitude]}\n end\n @bemap_polylines << @bemap_characters\n @bemap_polylines = @bemap_polylines.to_json\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bemap }\n end\n end", "title": "" }, { "docid": "c5a67f504d7dc99c72d8bd46842e87b6", "score": "0.54104996", "text": "def index\n @roadstops = Roadstop.all\n end", "title": "" }, { "docid": "11adcdf2ad6ef1007359c524c619beac", "score": "0.5397015", "text": "def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end", "title": "" }, { "docid": "4af465dc5425253cbf6a598803fb8a51", "score": "0.5390471", "text": "def index\n info = ScheduleProcessor.headway_info\n query = params[:text]\n workspace = params[:enterprise_name] || params[:team_domain]\n user_id = params[:user_id]\n\n if query == 'help'\n result = help_response(info[:routes])\n elsif (data = info[:routes].find { |r| r[:id] == query})\n track_event('slash', \"route/#{query}\", user_id, workspace)\n result = route_response(data)\n elsif query == 'delays'\n track_event('slash', 'delays', user_id, workspace)\n result = delays_response(info[:routes])\n else\n track_event('slash', 'default', user_id, workspace)\n result = default_response(info)\n end\n \n render json: result\n end", "title": "" }, { "docid": "5f74caec13e5671976c9c790332dc8e0", "score": "0.53874546", "text": "def new\n @road = Road.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @road }\n end\n end", "title": "" }, { "docid": "0062913b3486d2fb485e05f86c473c92", "score": "0.538456", "text": "def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end", "title": "" }, { "docid": "eab79a7de536f30f13c4576f205255d4", "score": "0.538255", "text": "def departures\n # Project.hit 35\n @departing = true\n @from = params[:from]\n @to = params[:to]\n \n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n \n respond_to do |format|\n format.html\n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end", "title": "" }, { "docid": "db9ce58ee41dc9bd0599cd9944b81c2f", "score": "0.5381776", "text": "def index\n @trip_routes = TripRoute.all\n end", "title": "" }, { "docid": "7d8917753c2486acdcd456e4a68fcebb", "score": "0.5381104", "text": "def show\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shipping_line }\n end\n end", "title": "" }, { "docid": "575100347139cf404cd85274968c092e", "score": "0.5380854", "text": "def show\n @recipe_direction = @recipe.directions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_direction }\n format.json { render :json => @recipe_direction }\n end\n end", "title": "" }, { "docid": "6eed3aa5ab78c24729c3ef7f433d06e6", "score": "0.53773034", "text": "def index\n @line_stations = LineStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_stations }\n end\n end", "title": "" }, { "docid": "8f3c30c9f3e683762d49347174ba6d15", "score": "0.5375173", "text": "def show\n @route_line = RouteLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_line }\n end\n end", "title": "" }, { "docid": "e32b691ccae6f25b316e5b661e4f6442", "score": "0.5371859", "text": "def get_routes(params)\n graph_data = create_data(params)\n if graph_data.is_a?(Array)\n graph_data.each do |data|\n add_vertex(data[0][0], data[0][1])\n end\n path_array = shortest_path(params[:source], params[:destination])\n if path_array.is_a?(Array)\n get_path_description(path_array, params)\n else\n path_array\n end\n else\n graph_data\n end\n end", "title": "" }, { "docid": "5421f6d256b365f33fd4982e66bfbe77", "score": "0.5366129", "text": "def location_history(params = {})\n @client.get(\"#{path}/location/waypoints\", params)\n end", "title": "" }, { "docid": "03fb7e6bd03816ae67c3a43356ffd3c3", "score": "0.5365442", "text": "def get_routes\n @agency = params[:name]\n request_url = \"http://services.my511.org/Transit2.0/GetRoutesForAgency.aspx?token=#{@@token}&agencyName=#{@agency}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @routes = search_for_key(parse_request(request_url), \"Route\")\n @routes = [@routes] unless @routes.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "title": "" }, { "docid": "ef260ab9d0d50ec319790716d58a5025", "score": "0.5359761", "text": "def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "title": "" }, { "docid": "3f6e93816d1a6ccfd2e5694062df27e9", "score": "0.53592837", "text": "def show\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_line }\n end\n end", "title": "" }, { "docid": "dfdf6e7d02c439b3819035056dda33ab", "score": "0.53486395", "text": "def get_routes from, to, options = {}\n options[:start_type] = check_point_type(from) || options[:start_type]\n options[:target_type] = check_point_type(to) || options[:target_type]\n # default options\n options = {\n :time => Time.now, \n :depth => 0, \n :include_coords => true, \n :limit => 2,\n :time_relation => :depature,\n :identify_part_prices => :none }.merge(options)\n\n options[:time] = options[:time].in_time_zone(\"Berlin\") #+ 10.minutes # Ansonsten liegt die erste Verbindung in der Vergangenheit\n page = @agent.get @@options[:url_route]\n \n result = submit_form page.forms.first, from, to, options\t\t\n routes = []\n links = result.links_with(:href => /details=opened!/).select { |l| l.to_s.size > 0} # only select connection links, no warning links\n links.reverse! if options[:time_relation] == :arrival # respect :time_relation for route processing\n \n link_threads = Array.new\n links.each_index do |idx|\n link_threads[idx] = Thread.new {\n # maybe we are too fast in requesting :-)\n (1..5).each do |i|\n page = links[idx].click \n break unless page.title.match(/Fehler/)\n # puts \"link.click error: %i\" % i\n sleep(1)\n end\n Thread.current[:route] = Route.new(page, options)\n }\n break if idx == options[:limit]\n end\n\n link_threads.each { |t| t.abort_on_exception = true}\n routes = link_threads.map { |t| t.join; t[:route] }\n\n # Keine Station gefunden also suchen wir nach der nächstbesten Adresse/Station\n if links.count == 0 && options[:depth] == 0\n if options[:start_type] == :address\n from = find_address(from, options)\n options[:start_type] = from.station_type\n from = from.name\n elsif options[:start_type] == :station\n from = find_station(from, options)\n options[:start_type] = from.station_type\n from = from.name\n end\n \n if options[:target_type] == :address\n to = find_address(to, options)\n options[:target_type] = to.station_type\n to = to.name\n elsif options[:target_type] == :station\n to = find_station(to, options)\n options[:target_type] = to.station_type\n to = to.name\n end\n \n return get_routes from, to, options.merge(:depth => options[:depth]+1)\n end\n \n raise \"no_route\" if routes.count == 0 || links.count == 0\t\t\t\n\n # attach price information for each routepart if necessary\n identify_part_prices(routes, options) unless options[:identify_part_prices] == :none\n \n return routes\n end", "title": "" }, { "docid": "cee59dbb75f2629524ab3b745ce0f1c4", "score": "0.53472775", "text": "def generate_routes\n\trequire 'csv'\n\tinclude HTTParty\n\trequire 'json'\n\tresponse = HTTParty.get('http://citppuc.cloudapp.net/api/lineas')\n\tbody = JSON.parse(response.body)\n\tCSV.open('csv/aplicacion/routes.csv', 'w') do |csv|\n\t\tbody.each do |item|\n\t\t\tputs \"Agragando ruta: \"+item[\"codigo_linea\"]\n\t\t\tcsv << [item[\"codigo_linea\"], 0, 'FFFFFF']\n\t\tend\n\tend\nend", "title": "" }, { "docid": "506f579b1d24fd49632dc0b5cf2c596c", "score": "0.53346574", "text": "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "title": "" }, { "docid": "30abc7ae4ca20aae4e8b4cf39f0e15d7", "score": "0.53344566", "text": "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "title": "" }, { "docid": "792e969199d284bc05f82dcf12f519b7", "score": "0.5328134", "text": "def index\n @order_ways = OrderWay.all\n end", "title": "" }, { "docid": "ad0d28c5e445bef029a234715ba2c07f", "score": "0.53222704", "text": "def create\n @direction = Direction.new(direction_params)\n @direction.origin = Place.find_by(name: 'AIT')\n @direction.created_by = current_user\n respond_to do |format|\n if @direction.save\n format.html { redirect_to service_path, notice: 'direction was successfully created. You can manage your directions via Account > Manage your account'}\n format.json { render :show, status: :created, location: [:service, @direction] }\n else\n format.html { render :new }\n format.json { render json: @direction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ab00750d4aa84185e184ff737e09f26", "score": "0.5319553", "text": "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "title": "" }, { "docid": "9aad9ca3ee802b5912159a8c53fb15fc", "score": "0.53080416", "text": "def show\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subway }\n end\n end", "title": "" }, { "docid": "84e407555e18be4960d16a76daa33522", "score": "0.5307702", "text": "def get_departures\n @stop_code = params[:stop_code]\n\n request_url = \"http://services.my511.org/Transit2.0/GetNextDeparturesByStopCode.aspx?token=#{@@token}&stopcode=#{@stop_code}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @departures = search_for_key(parse_request(request_url), \"Route\")\n @departures = [] unless @departures\n @departures = [@departures] unless @departures.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "title": "" }, { "docid": "94c32f3a5196fa98b264d8a887956d24", "score": "0.5301451", "text": "def show\n recorrido = Recorrido.find(params[:id].to_i)\n @polylines = []\n @stops = []\n # @shapes = Shape.all\n secuencias = recorrido.get_secuencias_of_the_hour\n\n secuencias.each_with_index do |s, i|\n @polylines[i] = []\n Shape.where(:code => s.code).first.points.each_with_index do |p, e|\n e == 0 ? @polylines[i] << {:strokeColor => '#000000', :icons => [], :lat => p.lat, :lng => p.lng } : @polylines[i] << {:lat => p.lat, :lng => p.lng }\n end\n s.stops.each do |stop|\n @stops << {:title => stop.code,\n :lat => stop.lat,\n :lng => stop.lng,\n :width => 12,\n :height => 14,\n :picture => \"../images/parada_12.png\", :type => 'stop',\n :type => 'stop',\n :ida => i,\n :description => render_to_string(:partial => \"/recorridos/stop_infowindow\", :locals => { :stop => stop})}\n end\n end\n\n\n respond_to do |format|\n format.js\n format.html\n format.json { render json: @recorrido }\n end\n end", "title": "" }, { "docid": "6b0331797e4763bc5da5d85ddf059b8c", "score": "0.52986", "text": "def route_params\n params.require(:route).permit(:from_id, :to_id, :calculation_basis, :distance, :status)\n end", "title": "" }, { "docid": "70a17ae2b6a006a03d59c45afd8b3b88", "score": "0.5298065", "text": "def set_route\n route = Gmaps4rails.destination({\"from\" =>address_start, \"to\" =>address_end},{},\"pretty\")\n\n self.distance = route[0][\"distance\"][\"value\"]\n self.duration = route[0][\"duration\"][\"value\"]\n end", "title": "" }, { "docid": "32b359c1e88a70d212eeb598b69121be", "score": "0.5297629", "text": "def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end", "title": "" }, { "docid": "27da67e97a8cdfed2f4b5fcee5176ecf", "score": "0.52956814", "text": "def index\r\n @way_points = WayPoint.all\r\n end", "title": "" }, { "docid": "e70752a736ec839094b209cfcf7b1c8d", "score": "0.52921414", "text": "def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end", "title": "" } ]
5d881e0cf507b56fe367237be87f25d9
GET /admin/contacts/1 GET /admin/contacts/1.json
[ { "docid": "4eaa6bae49fcaead8d26dbe39e4c6c1d", "score": "0.7703216", "text": "def show\n @admin_contact = Contact.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_contact }\n end\n end", "title": "" } ]
[ { "docid": "8eea3a2e86364d38226af95d61abd66e", "score": "0.81767255", "text": "def contacts\n get('contacts')\n end", "title": "" }, { "docid": "680464823216e7f4871a0a4894b924aa", "score": "0.8123372", "text": "def contacts()\n get('contactsList')\n end", "title": "" }, { "docid": "6c28b11411bf98aacfb49823cc947f01", "score": "0.77890944", "text": "def contacts\n GET base_url \"/contacts\"\n end", "title": "" }, { "docid": "82011e3ad9aa8877ecd5ae97bf344ce8", "score": "0.77740073", "text": "def index\n @contacts = User.find(current_user.id).contacts\n render json: { contacts: @contacts }, status: :ok\n end", "title": "" }, { "docid": "064f9e180d3f96c3047631b6cc4d7191", "score": "0.77733546", "text": "def index\n @contacts = current_user.contacts\n\n render json: @contacts\n end", "title": "" }, { "docid": "064f9e180d3f96c3047631b6cc4d7191", "score": "0.77733546", "text": "def index\n @contacts = current_user.contacts\n\n render json: @contacts\n end", "title": "" }, { "docid": "5601706bb6ad656d3e4ca7fd563a4eb5", "score": "0.776192", "text": "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n PassaporteWeb::Entities::Profile::Contacts)\n end", "title": "" }, { "docid": "9a91b474d4fb12729cd46425fc407da1", "score": "0.77300894", "text": "def get_contacts\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "82f8a333a6f4d5d3cc12f7925a7a71d9", "score": "0.76117027", "text": "def index\n @contacts = current_user.contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "96e93b47bdc631e97f7d309bb2bb4aa5", "score": "0.75643766", "text": "def get_contacts_request\n url = @url_base + \"/api/v1/user/contacts\"\n @response = RestClient.get(url, \n {\n \"Content-Type\" => \"application/json\",\n \"X-User-Email\" => \"[email protected]\"\n }\n ) \n @data = JSON.parse @response.body\n @contact = @data.first\n end", "title": "" }, { "docid": "b5a68395dd9943fde02e8ecc1bcb6570", "score": "0.7453618", "text": "def index\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "b5a68395dd9943fde02e8ecc1bcb6570", "score": "0.7453618", "text": "def index\n @contacts = Contact.all\n render json: @contacts\n end", "title": "" }, { "docid": "db036fa4b829b95467922f91b16d9505", "score": "0.7442045", "text": "def index\n @contacts = Contact.all\n\n render json: @contacts\n end", "title": "" }, { "docid": "1f091a8c1de3f52ce7a8a65675b39eee", "score": "0.742809", "text": "def index\n contacts = Contact.all\n\n render json: contacts\n end", "title": "" }, { "docid": "c457cb67a5314bb622da8d1dc06387b2", "score": "0.7386124", "text": "def show\n @contactadmin = Contactadmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactadmin }\n end\n end", "title": "" }, { "docid": "0b3803fc6eaf0cc24fc03c9a1f9574c0", "score": "0.73757756", "text": "def index\n @admin_contacts = Admin::Contact.all\n @admin_contact = Admin::Contact.first\n render :show\n end", "title": "" }, { "docid": "b726e5bdaa45ac838ffa79657a8e789d", "score": "0.7369067", "text": "def index\n @account_contacts = @account.account_contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @account_contacts }\n end\n end", "title": "" }, { "docid": "724333145cb934cb903a21f5042c41dc", "score": "0.7341163", "text": "def index\n @contact_details = ContactDetail.with_permissions_to(:index)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contact_details }\n end\n end", "title": "" }, { "docid": "33714e73a3bd01b65c9d6806157d61ec", "score": "0.7323754", "text": "def index\n if current_user.master_admin?\n @contacts = Contact.order(:name).where(\"name like ?\", \"%#{params[:term]}%\")\n elsif current_user.admin? && (current_user.account)\n @contacts = current_user.account.contacts.order(:name).where(\"name like ?\", \"%#{params[:term]}%\")\n else\n @contacts = []\n end\n\n respond_to do |format|\n format.html { }\n format.json { \n # render json: @contacts.to_json\n render json: @contacts.map{ |c| {label: c.name, id: c.id} } \n }\n end\n end", "title": "" }, { "docid": "4a3ada9c96ad2ec6b7aac81c41c7203a", "score": "0.73089397", "text": "def index\n @contacts = Contact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "4a3ada9c96ad2ec6b7aac81c41c7203a", "score": "0.73089397", "text": "def index\n @contacts = Contact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end", "title": "" }, { "docid": "25bea3e02dc3a65fd022f2fc09470f6b", "score": "0.7275681", "text": "def show\n @admin_contact_detail = Admin::ContactDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_contact_detail }\n end\n end", "title": "" }, { "docid": "858daf1ca19f26952d0dd388cfe1945c", "score": "0.7271328", "text": "def contacts(params = {})\n get_contacts(params)\n end", "title": "" }, { "docid": "725e24804cee3e5fa28af6db6dab5bca", "score": "0.7259946", "text": "def index\n respond_with(contacts)\n end", "title": "" }, { "docid": "cf078ed48a5bc99160ce26d4af6559ea", "score": "0.7254527", "text": "def get_contact_details(id)\n get(\"contacts/#{id}.json\")\n end", "title": "" }, { "docid": "cf078ed48a5bc99160ce26d4af6559ea", "score": "0.7254527", "text": "def get_contact_details(id)\n get(\"contacts/#{id}.json\")\n end", "title": "" }, { "docid": "14eb6311eb05892bda4696130399656c", "score": "0.7249513", "text": "def index\n @admin_contacts = AdminContact.all\n end", "title": "" }, { "docid": "6dc9adbbf0fda6436362f37dfb0e26f8", "score": "0.72454214", "text": "def index\n @contact_notes = current_user.contacts.find(params[:contact_id]).contact_notes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_notes }\n end\n end", "title": "" }, { "docid": "151c4f2f0a55a6c23ebf62385b1f6cb5", "score": "0.7244543", "text": "def show\n render json: @contact, status: 200\n end", "title": "" }, { "docid": "5d3c79bb02239f4cdf5c65eb64b1cc9c", "score": "0.72097325", "text": "def index\n @contactadmins = Contactadmin.find(:all, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contactadmins }\n end\n end", "title": "" }, { "docid": "dc294297085894c6d426397c67de0b99", "score": "0.72052646", "text": "def show\n @account_contact = @account.account_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account_contact }\n end\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "a12e394192f59e9af72de50eebe4631e", "score": "0.72045344", "text": "def index\n @contacts = current_user.contacts\n end", "title": "" }, { "docid": "426d760cc40f9b3428fef86492072e2b", "score": "0.7082658", "text": "def get_contact(contact_id)\n request :get,\n \"/v3/contacts/#{contact_id}.json\"\n end", "title": "" }, { "docid": "ed369119663639e9b8cb9fb05a4808e4", "score": "0.70546865", "text": "def contacts_info(contacts)\n request(:get, '/api/contact_info/', {:contacts=>contacts}).data\n end", "title": "" }, { "docid": "e00d8e1c1a2b7e6092cf5e6e091795e7", "score": "0.70512825", "text": "def index\n @customer_contacts = CustomerContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @customer_contacts }\n end\n end", "title": "" }, { "docid": "9f141f30fef9074c0ebb375a286d189e", "score": "0.70495063", "text": "def index\n @contacts = Contact.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {odata: @contacts }}\n end\n end", "title": "" }, { "docid": "21355021878051bdca61d00026ee0a2b", "score": "0.70480454", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "96bc2d1e07856e790646981a0c5c31fe", "score": "0.70379615", "text": "def index\n @supplier_contacts = @supplier.supplier_account.supplier_contacts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplier_contacts }\n end\n end", "title": "" }, { "docid": "96bc2d1e07856e790646981a0c5c31fe", "score": "0.70379615", "text": "def index\n @supplier_contacts = @supplier.supplier_account.supplier_contacts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplier_contacts }\n end\n end", "title": "" }, { "docid": "c49b4fbc045d0f1d3a35acd3171b4662", "score": "0.7036488", "text": "def index\n respond_with @contacts = Contact.all\n end", "title": "" }, { "docid": "6aeb4f6c82755671cea15b216c0d9320", "score": "0.70344025", "text": "def index\n @contacts = current_user.contacts.all\n end", "title": "" }, { "docid": "5584be54cca1a2051f29da86f79d50be", "score": "0.702528", "text": "def index\n @contactos = Contacto.all\n render json:@contactos\n end", "title": "" }, { "docid": "97a23caadedd40291d0bdd6498ce7ccf", "score": "0.7025059", "text": "def show\n @contact_detail = ContactDetail.with_permissions_to(:show).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contact_detail }\n end\n end", "title": "" }, { "docid": "e9bd81e0b29dfc8d1d614c2adb57ca90", "score": "0.70202184", "text": "def show\n @admin_contact_type = Admin::ContactType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_contact_type }\n end\n end", "title": "" }, { "docid": "37b16c77d7b67871ef1c3fa36bc5252a", "score": "0.7010309", "text": "def index\n @organization_contacts = @organization.contacts\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "2edd95d42332ee88ab7f3dc5016ab198", "score": "0.7002512", "text": "def index\n render :json => apply_scopes(Contact).all\n end", "title": "" }, { "docid": "1b399ac185ba93c537ef60748318267c", "score": "0.69941777", "text": "def index\n @contact_details = ContactDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_details }\n end\n end", "title": "" }, { "docid": "2e054b627ba527e56a9507d889cbe992", "score": "0.6989963", "text": "def index\n #binding.pry\n @contact = Contact.new\n @contacts = nil\n\n if !!params[:contact] && !!params[:contact][:name]\n @contacts = Contact.where(name: params[:contact][:name], admin_level: user_admin_level)\n elsif !!params[:contact] && !!params[:contact][:email]\n user = User.find_by(email: params[:contact][:email], admin_level: user_admin_level)\n @contacts = user.contacts if !!user\n elsif !!params[:unclaimed]\n @contacts = Contact.where(user_id: 22, admin_level: user_admin_level)\n elsif !!params[:recently_updated]\n @contacts = Contact.where(\"updated_at >= ? AND admin_level = ?\", Date.today - 1.month, user_admin_level).order(updated_at: :desc)\n elsif params[:event_id]\n event = Event.where(\"id = ? AND admin_level = ?\", params[:event_id], user_admin_level)\n @contacts = event.contacts.order(updated_at: :desc)\n elsif !!params[:all]\n @contacts = Contact.same_level(user_admin_level)\n end\n # render as json or html\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @contacts, status: 200}\n end\n end", "title": "" }, { "docid": "28dcdc79758c8af855fea0f15f72b758", "score": "0.6975953", "text": "def show\n @contact_list = ContactList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_list }\n end\n end", "title": "" }, { "docid": "7d30409fdf2839adcf7944d3d89144bb", "score": "0.6971727", "text": "def index\n @contacts = Contact.all\n\n # Search\n @contacts = @contacts.search(params[:q]) if params[:q]\n\n # Filter for relationship\n @contacts = @contacts.relationship(params[:relationship]) if params[:relationship]\n\n # Order by\n @contacts = @contacts.order(params[:order].gsub(':', ' ')) if params[:order]\n\n # Pagination\n if (params[:offset] && params[:limit])\n @contacts = @contacts.page(1).per(params[:limit]).padding(params[:offset])\n else\n @contacts = @contacts.page(1).per(25)\n end\n\n\n render json: @contacts if stale?(etag: @contacts.all, last_modified: @contacts.maximum(:updated_at))\n end", "title": "" }, { "docid": "2213643afd1168c4585ce8409d10f7ae", "score": "0.69542676", "text": "def index\n\t@contacts = Contact.find(:all)\n\n end", "title": "" }, { "docid": "4dbab3327249c7f921fded2c69e5f08d", "score": "0.6945658", "text": "def index\n @contacts = Contact.all\n respond_to do |format|\n format.json { render json: @contacts.to_json(:include => [:tcm_basic_contact, :tcm_patient_info])}\n end\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "969a6d31831b3cd301cee0f932c4a20d", "score": "0.69452024", "text": "def index\n @contacts = Contact.all\n end", "title": "" }, { "docid": "3cae2c63306c25917ddc70ed82442033", "score": "0.69425666", "text": "def contacts(id, account: nil)\n get account, \"contactlist/#{id}/\", {}\n end", "title": "" }, { "docid": "55060b67087be900774853e54b8ae672", "score": "0.69417274", "text": "def show\n @list_contact = ListContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_contact }\n end\n end", "title": "" }, { "docid": "87a7c242efb3c99de45052afad958040", "score": "0.69387394", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "87a7c242efb3c99de45052afad958040", "score": "0.69387394", "text": "def show\n render json: @contact\n end", "title": "" }, { "docid": "38e8f3737299f33ec390c6930af73e27", "score": "0.69383", "text": "def contacts_info\n @user = User.find(params[:id]) \n @contacts = @user.personal_contacts\n end", "title": "" }, { "docid": "317ca6cf89316e4d14d9b0b80cb83426", "score": "0.6935631", "text": "def index\n \t@contacts = Contact.all\n end", "title": "" }, { "docid": "0a3ee43585d5198f4e7e8e1caa7fb1ce", "score": "0.69259816", "text": "def get_contacts\n @user = current_user\n if @user\n render json: @user.meetings.map { |meeting| { :contacts => meeting.users } }\n else\n render json: {error: 'Contacts not found.'}\n end\n end", "title": "" }, { "docid": "dbf1a87fd1c4e763fa541942a49fe2c2", "score": "0.69251144", "text": "def index\r\n @contacts = Contact.all\r\n end", "title": "" }, { "docid": "4c96512db5b51c427af6994f6490f6bf", "score": "0.6913569", "text": "def index\n\t\t@contacts = Contact.all\n\tend", "title": "" }, { "docid": "00a66196ef80657ca1bda83940ce4c35", "score": "0.691312", "text": "def index\n @client_contacts = ClientContact.all\n end", "title": "" }, { "docid": "a71d9228e7a76e77f0a25cee389bce6e", "score": "0.69028693", "text": "def index\n @organization_contacts = @organization.contacts.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "5979f1da19908196b6b32f69f0d86e37", "score": "0.68875694", "text": "def index\n @contacts_infos = ContactsInfo.all\n end", "title": "" }, { "docid": "ceb6fa22bac99850cef8221da01994db", "score": "0.6887287", "text": "def index\n contacts = Contact.all\n respond_with(contacts)\n end", "title": "" }, { "docid": "598efcff7c344c63ad3e5b7073948061", "score": "0.68867636", "text": "def show\n @consumer_contact = @consumer.consumer_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consumer_contact }\n end\n end", "title": "" }, { "docid": "427dc399d65dc541c5d5f45f1119d27c", "score": "0.6878998", "text": "def index\n @client_additional_contacts = ClientAdditionalContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_additional_contacts }\n end\n end", "title": "" }, { "docid": "92859ef3ca77b16109d0e9ddb8a54821", "score": "0.6862056", "text": "def index\n @contact_people = ContactPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_people }\n end\n end", "title": "" }, { "docid": "b32be607d87a6ffd3c01aa34e1961387", "score": "0.68576556", "text": "def index\n if params[:search]\n @contacts = Contact.where(:user_id => current_user.id)\n @contacts = @contacts.where(:name => /#{params[:search]}/i)\n else\n @contacts = Contact.where(:user_id => current_user.id)\n end\n\n if @contacts.nil?\n @contacts = []\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render_for_api :contact, :json => @contacts }\n end\n end", "title": "" }, { "docid": "9e37a80f2da8b313bdeb5e50fd5642c0", "score": "0.6836122", "text": "def index\n @contact_numbers = ContactNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_numbers }\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a7211969b35330823082e7eb2f83325d", "score": "0.0", "text": "def order_params\n params.require(:order).permit(:user_id, :status, :orderType, :orderFrom, :image, :user_ids => [])\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980629", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.67819995", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67467666", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.67419875", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.67347664", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.65928614", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6504013", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6498014", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64819515", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64797956", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64562726", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.64400834", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6380117", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6377456", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.63656694", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6320543", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.63002014", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62997127", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.629425", "text": "def valid_params_request?; end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6293866", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.62909746", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62904227", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.62837297", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6240993", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.6239739", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217764", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214983", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62112504", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6194765", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6178", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.61755055", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61729854", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.61636627", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6153461", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151674", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61478525", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6122671", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61188513", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.61075556", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6105721", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6092412", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081011", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071054", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6064436", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6022111", "text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.6018135", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60151577", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.60108894", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60070235", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60070235", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6000806", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6000464", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.5998811", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59926987", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5992257", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5991173", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980311", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59660876", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59596545", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5959415", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.59589994", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957478", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.5953214", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5952233", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5944033", "text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59396756", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59396756", "text": "def filter_parameters; end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59386414", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.59345603", "text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5931261", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5926345", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5925795", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59174526", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59108645", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.5909469", "text": "def url_whitelist; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5908263", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.59053195", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.58980685", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5897738", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589657", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5895971", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.58942044", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5892847", "text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.588742", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.58834344", "text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.5880024", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58739793", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5868253", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.5867907", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58670515", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.58668053", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865756", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5863549", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5863236", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.5862728", "text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5861283", "text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58591247", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5855159", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.5854291", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.58512247", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.58498096", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
a1cee71a99602b70d71851fcbf7cb5b8
there may be a more efficient way to do this but I check the length of the set then I get the score of the last value I want to keep then remove all keys with a lower score
[ { "docid": "e04fdb024244591a1b9e81e4d2c31646", "score": "0.0", "text": "def trim_feed(id=self.id_s, location=\"feed\", indx=FEED_LENGTH)\n k = key(:feed)\n if ($redis.zcard k) >= indx\n n = indx - 1\n if (r = $redis.zrevrange k, n, n, :with_scores => true)\n $redis.zremrangebyscore k, \"-inf\", \"(#{r.last}\"\n end\n end\n end", "title": "" } ]
[ { "docid": "2664002d1cd56d0462d4354cd8b1ad83", "score": "0.6949692", "text": "def remove_by_score keys, *population\n if population.empty?\n population = 1\n else\n population = population.first\n end\n i = 0 \n keys.each {|k| @redis.zremrangebyscore(k, '-inf', population); i+=1} # TODO What zremrangebyscore returns?\n return i \n end", "title": "" }, { "docid": "b7aff6e604a32ed75e05676df7de8e58", "score": "0.66363406", "text": "def filter_by_score(val)\n\t\t\tdh = []\n\t\t\teach_sequence do |hit|\n\t\t\t\tdsh = []\n\t\t\t\thit.each_sequencehit do |sh|\n\t\t\t\t\tdsh << sh if sh.score < val\n\t\t\t\tend\n\t\t\t\tdsh.each do |i|\n\t\t\t\t\thit.delete(i)\n\t\t\t\tend\n\t\t\t\tdh << hit if hit.length == 0\n\t\t\tend\t\n\t\t\tdh.each do |i|\n\t\t\t\tdelete(i)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "6b84e9f7d6a1c70732d96d93ec2e0a7f", "score": "0.6163095", "text": "def retrieveBestCandidatesInHash()\n if(@candidateHashLocal!=nil)\n @candidateHashLocal.each_pair do |k, v| \n key = \"#{k}\"\n value= \"#{v}\"\n if(value.to_i<@countMatchs)\n deleteCandidate(key)\n end \n end\n end \nend", "title": "" }, { "docid": "ee5edbe411c6911affd34dc6268adf83", "score": "0.60867345", "text": "def keys_to_keep\n SUBKEYS.select { |key| key < @key }.values.flatten\n end", "title": "" }, { "docid": "f8e23c7213c54cc2a06afe79fea78aba", "score": "0.6085687", "text": "def holy_trinity_3(input_array)\n final = Set.new\n\n input_array.each do |v|\n final << v unless final.delete?(v).present?\n end\n\n final.first\nend", "title": "" }, { "docid": "072efeeb567584516deac0b7230ee00b", "score": "0.6077078", "text": "def purge_less_than(x)\n remove_list = {}\n @vocab.keys.each do |token|\n\tcount = @data.keys.inject(0){|sum, cat| sum + @data[cat][:tokens][token] }\n\tnext if count >= x\n\[email protected] do |cat, cat_data|\n\t count = cat_data[:tokens][token]\n\t cat_data[:tokens].delete(token) \t\t# delete and retrieve count\n\t cat_data[:total_tokens] -= count # subtract that count from cat counts\n\tend # each category hash\n\t#print \"removing #{token}\\n\"\n\tremove_list[token]=1\n end # each vocab word\n remove_list.keys.each {|token| @vocab.delete(token) }\n #print \"total vocab size is now #{vocab_size}\\n\" \n end", "title": "" }, { "docid": "7f5c3db660ec18d574eae3b089ad4c3c", "score": "0.6026882", "text": "def removeAnimal(hash,limit)\n hash.each {|key,value|\n if value >= limit\n hash.delete(key)\n end\n }\n return hash\nend", "title": "" }, { "docid": "b71e39f190633b05573fa23a128c1492", "score": "0.5967047", "text": "def trim_worse_players(threshold, all, exceptions)\n all.each do |ary|\n ary.each do |plyr|\n ary.sort! {|a,b| b.salary <=> a.salary}\n ary2 = []\n ary.each do |plyr|\n ary2 << plyr\n end\n ary2.each do |c2|\n num_who_are_better_and_make_the_same_or_less = 0\n ary.each do |c1|\n if ((c1.points > c2.points) && (c1.salary <= c2.salary))\n num_who_are_better_and_make_the_same_or_less+=1\n end\n end\n\n if num_who_are_better_and_make_the_same_or_less>threshold\n if exceptions == nil\n ary.delete(c2)\n elsif c2.name != exceptions.first && c2.name != exceptions.last\n ary.delete(c2)\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "b71e39f190633b05573fa23a128c1492", "score": "0.5967047", "text": "def trim_worse_players(threshold, all, exceptions)\n all.each do |ary|\n ary.each do |plyr|\n ary.sort! {|a,b| b.salary <=> a.salary}\n ary2 = []\n ary.each do |plyr|\n ary2 << plyr\n end\n ary2.each do |c2|\n num_who_are_better_and_make_the_same_or_less = 0\n ary.each do |c1|\n if ((c1.points > c2.points) && (c1.salary <= c2.salary))\n num_who_are_better_and_make_the_same_or_less+=1\n end\n end\n\n if num_who_are_better_and_make_the_same_or_less>threshold\n if exceptions == nil\n ary.delete(c2)\n elsif c2.name != exceptions.first && c2.name != exceptions.last\n ary.delete(c2)\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "278530658885a55dfa4f89607a032190", "score": "0.5962939", "text": "def breakingRecords(scores)\n first = [scores[0], scores[0]]\n scores.each_with_object({max: 0, min: 0}) do |score, hash|\n p \"hash: #{hash} score: #{score} first: #{first}\"\n if score < first[1]\n hash[:min] += 1\n first[1] = score\n end\n if score > first[0]\n hash[:max] += 1\n first[0] = score\n end\n end.values\nend", "title": "" }, { "docid": "67caf2c0e34ace5754ff3b0d4da935e4", "score": "0.593795", "text": "def delete key\n\t\tbefore_list = Array.new(@level_max + 1)\n\t\tafter_list = Array.new(@level_max + 1)\n\t\tunless p = find(key, before_list, after_list) then\n\t\t\treturn nil\n\t\tend\n\t\tp.toplevel.downto(1){|level|\n\t\t\tpp, mark = p[level].get\n\t\t\tuntil mark do\n\t\t\t\tp[level].compare_and_set pp, pp, false, true\n\t\t\t\tpp, mark = p[level].get\n\t\t\tend\n\t\t}\n\t\tpp, mark = p[0].get\n\t\tloop {\n\t\t\ti_marked_it = p[0].compare_and_set pp, pp, false, true\n\t\t\tpp, mark = p[0].get\n\t\t\tif i_marked_it then\n\t\t\t\t@size_lock.synchronize {\n\t\t\t\t\t@size -= 1\n\t\t\t\t}\n\t\t\t\t#find key, before_list, after_list\n\t\t\t\tbreak p.val\n\t\t\telsif mark then\n\t\t\t\tbreak nil\n\t\t\tend\n\t\t}\n\tend", "title": "" }, { "docid": "4846b77462048a3a6e015ee6481b5143", "score": "0.5935533", "text": "def top_genres\n scores = @genres.values \n scores.sort!.reverse!\n top_scores = scores.first(3) # Get the top 3 scores\n sorted_genres = @genres.keys.sort\n top_genres = {}\n sorted_genres.each do |genre| # Find the genres associated with that score\n genre_score = @genres[genre]\n if (top_scores.include?(genre_score)) then # Check if it is a top score\n top_genres[genre] = genre_score\n top_scores.delete_at(top_scores.index(genre_score)) # Remove that score\n end\n end\n return top_genres\n end", "title": "" }, { "docid": "1530fde8ba42508b739e45b552134285", "score": "0.5903446", "text": "def prune\n @set.clear\n end", "title": "" }, { "docid": "e27f506f5ec4cc655056ac25fe28b784", "score": "0.58911526", "text": "def pop()\n x = @count[-1].pop\n @count.pop if @count[-1].empty?\n @hash[x].pop\n @count[@hash[x].size].reject! { |y| @hash[y].empty? }\n i = @count[@hash[x].size].bsearch_index { |y| @hash[y][-1] >= @hash[x][-1] } || -1\n @count[@hash[x].size].insert(i, x)\n x\n end", "title": "" }, { "docid": "dba742c401a4942a25d5585c137e7743", "score": "0.5840541", "text": "def remove(key)\n @count -= 1\n bucket = @set[key.hash % @size]\n bucket.delete(key)\n end", "title": "" }, { "docid": "7d6100d0792eb3b05ca0858dcc72ca62", "score": "0.5839086", "text": "def delete_min_return_key\n return nil if empty?\n\n min_value = @heap.remove!.value\n @priority_map.delete(min_value)\n min_value\n end", "title": "" }, { "docid": "0c63272fafa0533699eeda9f22f5f127", "score": "0.58363676", "text": "def big_shoe_rebounds\n biggest_shoe = 0 \n rebounds = 0\n \n all_players_stats_rebounds.each do |stat_hash| \n\n current_shoe_size = stat_hash.keys.first\n current_rebounds = stat_hash.values.first\n if current_shoe_size >= biggest_shoe\n biggest_shoe = current_shoe_size\n rebounds = current_rebounds\n end \n \n end \n rebounds\nend", "title": "" }, { "docid": "1cb1eb9037c54d6df0e414d646d0733a", "score": "0.5831799", "text": "def delete_extra(arry, indx)\n arry[indx].ss_match = Set.new(arry[indx].ss_match.to_a.drop(1))\nend", "title": "" }, { "docid": "1abdc4ffd2b58f2a518aef9cb973f5d5", "score": "0.58197576", "text": "def highest_score_from(played_words)\n collection_of_played_words_and_scores = []#array of hashes\n played_words.each do |word|\n played_word_to_score = {} #how to deal with word duplicates\n played_word_to_score[:word] = word\n played_word_to_score[:score] = score_word(word)\n collection_of_played_words_and_scores.push(played_word_to_score)\n end\n top_score = collection_of_played_words_and_scores.reduce(0){ |memo, h| h[:score] > memo ? h[:score] : memo } # ==> {score: n}\n tied_highest_scores = collection_of_played_words_and_scores.select {|h| h[:score].to_i == top_score} #highest_score[:score]} # all the hashes in an array\n highest_score_hash = tied_highest_scores.find {|h| h[:word].length == 10}\n if highest_score_hash == nil\n highest_score_hash = tied_highest_scores.min_by{|h| h[:word].length}\n end\n return highest_score_hash #supposed to be a hash\nend", "title": "" }, { "docid": "6978c244bdcb183b87b58fa44203b204", "score": "0.58084905", "text": "def big_shoe_rebounds\n game_hash.each do |team_location, values|\n players = values[:players]\n big_foot = players.max_by{|k| k[:shoe]}[:player_name]\n players.each do |key, value|\n if key[:player_name] == big_foot\n return key[:rebounds]\n end\n end\n end\nend", "title": "" }, { "docid": "a06d054605ff37b64e31057b79964862", "score": "0.58007264", "text": "def reaper!(prev)\n self.reject!{|k,v| (v!=3) && (v!=2 || !prev.has_key?(k)) }\n #self.select!{|k,v| (v==3) || (v==2 && prev.has_key?(k)) }\n end", "title": "" }, { "docid": "dcefe60ba227a7dd5914ac639e98d10b", "score": "0.57904804", "text": "def keeptill(h,x)\n h.each do |k,v| if v > x\n h.delete(k)\n end\n end\nputs h\nend", "title": "" }, { "docid": "c4e49f2ea1e9aa5b8e758a8bb41a2d27", "score": "0.5782778", "text": "def purge_less_than(x)\n remove_list = {}\n @vocab.each do |token|\n if data.purge_less_than(token, x)\n # print \"removing #{token}\\n\"\n remove_list[token] = 1\n end\n end # each vocab word\n remove_list.keys.each {|token| @vocab.delete(token) }\n # print \"total vocab size is now #{vocab.size}\\n\"\n end", "title": "" }, { "docid": "c4e49f2ea1e9aa5b8e758a8bb41a2d27", "score": "0.5782778", "text": "def purge_less_than(x)\n remove_list = {}\n @vocab.each do |token|\n if data.purge_less_than(token, x)\n # print \"removing #{token}\\n\"\n remove_list[token] = 1\n end\n end # each vocab word\n remove_list.keys.each {|token| @vocab.delete(token) }\n # print \"total vocab size is now #{vocab.size}\\n\"\n end", "title": "" }, { "docid": "52f3ce58eb23b71cb002dd8e1cdb9799", "score": "0.5757672", "text": "def finest(set)\n set.map { |elem| [elem].to_set }.to_set\nend", "title": "" }, { "docid": "7d89f4da8492f65f295272d4635ac2f8", "score": "0.5750478", "text": "def big_shoe_rebounds\n shoe_hash = Hash.new(0) # setting the default hash at 0\n\n game_hash.each do |location, attributes|\n attributes.each do |key, values|\n if key == :players\n values.each do |name, status|\n status.each do |key, value|\n if key == :shoe\n shoe_hash[name] = value\n end\n end\n end\n end\n end\n end\n sorted = shoe_hash.sort_by { |k, v| v} # sorting in numerical order, smallest first\n biggest_shoe = sorted[-1][0] # going to index -1 and pulling the value set at 0 \"Mason Plumlee\"\n # binding.pry\n \n game_hash.each do |location, attributes|\n attributes.each do |key, values|\n if key == :players\n values.each do |k, v|\n if k == biggest_shoe # pulled from code above\n v.each do |rebound, rebound_value|\n if rebound == :rebounds\n return rebound_value\n end\n end\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "1338c347d4d44c99d86fa53f485577b9", "score": "0.57428205", "text": "def prune(key, cutoff)\n @hash[key].reject! { |time| time <= cutoff }\n end", "title": "" }, { "docid": "b0c20837a500d5f97e1e382da3487ebf", "score": "0.57393783", "text": "def big_shoe_rebounds\n arr = []\n game_hash.each do |location, team_data|\n team_data[:players].each do |player, data|\n arr << data[:shoe]\n\n end\n end\n biggest_shoe = arr.sort[-1]\n game_hash.each do |location, team_data|\n team_data[:players].each do |player, data|\n if data[:shoe] == biggest_shoe\n return data[:rebounds]\n end\n end\n end\n end", "title": "" }, { "docid": "a9b5ba9b9d890584a0d03da5cee15b77", "score": "0.57371277", "text": "def big_shoe_rebounds\n shoe_size = 0\n rebounds = nil\n game_hash.each_pair do |key1, values1|\n values1.each_pair do |key2, values2|\n if key2 == :players\n values2.each do |key_value_pair| \n if key_value_pair[:shoe] > shoe_size\n rebounds = key_value_pair[:rebounds]\n shoe_size = key_value_pair[:shoe]\n end\n end\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "3d5cb50c22dca99e5abcfb405fb479b3", "score": "0.57327235", "text": "def removePastX myhash, xval\n\t\trtn = Hash.new\n\t\tmyhash.each do |key, value|\n\t\t\tif key < xval\n\t\t\t\trtn.store(key, value)\n\t\t\tend\t\n\t\tend\n\t\trtn\n\tend", "title": "" }, { "docid": "42f642a489a69022b1353fcbb9580fc5", "score": "0.5728092", "text": "def eliminate_worst_chromosome\n # Check if the elitist chromosome is duplicated after crossoverred\n # This may occur if the self object is better than offsprings so self is returned and added to @chromosomes array\n ind = -1\n @chromosomes.each_with_index do |ch, index|\n ind = index if ch.object_id == @chromosomes[0].object_id and index != 0 \n end\n if ind > 0\n @chromosomes.delete_at ind\n return\n end \n \n min, will_be_deleted = -1, -1\n @chromosomes.each_with_index do |ch, ind|\n if ch.fitness_value < min or min == -1\n will_be_deleted = ind\n min = ch.fitness_value\n end\n end\n \n @chromosomes.delete_at will_be_deleted\n end", "title": "" }, { "docid": "234dbe61132c408b0fe72fd84b26fd11", "score": "0.5725005", "text": "def big_shoe_rebounds\n big_shoe = nil\n rebounds = nil\n all_players.each { |player_hash|\n player_hash.each { |field, data|\n if field == :shoe\n if big_shoe.nil?\n big_shoe = data\n elsif data > big_shoe\n big_shoe = data\n end\n end\n }\n }\n\n all_players.each { |player_hash|\n if player_hash[:shoe] == big_shoe\n rebounds = player_hash[:rebounds]\n end\n }\n\n rebounds\nend", "title": "" }, { "docid": "9069ba57dc88fb0dee70fc39f45e96b8", "score": "0.57036114", "text": "def big_shoe_rebounds\n hash = game_hash\n x = 0\n rebounds = 0\n\n hash.each { |key, value|\n value[:players].each { |k, v|\n if x < k[:shoe]\n x = k[:shoe]\n rebounds = k[:rebounds]\n end\n }\n } \n rebounds\nend", "title": "" }, { "docid": "c431d190aecf05eed2dd72141555dd71", "score": "0.5701048", "text": "def delete_from_hash\n\t\t@word_index.delete(@word_index.max_by{|k,v| v}[0])\n\tend", "title": "" }, { "docid": "3d803e922762bf902b4140d00408ea75", "score": "0.5693626", "text": "def cut_below_threshold(all_things)\n candidates = all_things.values.sort[Extractor::THRESHHOLD]\n if candidates\n all_things.reject { |k, v| v < candidates }\n else\n all_things\n end\n end", "title": "" }, { "docid": "84d270ec00f215b10e1d15a1ff605583", "score": "0.56914604", "text": "def min_hash_strategy\n # Precalculate and store min_hashes\n # This should be recalculated every time user likes a product\n $users.each { |u| u.min_hash = min_hash(u.products_liked) }\n\n set = Set.new\n # Also, size of the user set taken should be limited (tweaked by experimentation)\n # to something reasonable giving decent enough results\n $users.each do |u|\n set += u.products_liked if user.min_hash == u.min_hash\n end\n set - user.products_liked\n end", "title": "" }, { "docid": "ccc24dcc2dc791fa5a6cb4fc8dc16c21", "score": "0.56822973", "text": "def trim(leaderboard, spectrum, max)\n sorted = leaderboard\n .map { |peptide| [peptide, score(peptide, spectrum)] }\n .sort_by { |_peptide, score| -score }\n result = [sorted.first]\n inserted = 1\n i = 1\n while inserted < max && i < sorted.size\n _peptide, score = sorted[i]\n result << sorted[i]\n i += 1\n # Don't count an additional inserted if the differences have equal multiplicity\n inserted += 1 if score < result[-2][1]\n end\n result.map { |peptide, _score| peptide }\n end", "title": "" }, { "docid": "04516a80465e8545f8c3d3b46bef58e6", "score": "0.5674355", "text": "def big_shoe_rebounds\n new_hash = {}\n size_arr = []\n biggest_shoe_size = 0\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n size_arr << player[:shoe]\n end\n end\n end\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n if player[:shoe] == size_arr.max\n return player[:rebounds]\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "3da381c50514c5d1ec4d6fa933b77f9b", "score": "0.56632966", "text": "def remove_weakest\n sort_by_weakest_last\n to_remove = @population.size / 3\n to_remove.times { @population.pop }\n end", "title": "" }, { "docid": "5bb5e5ea4a1b3bfe9ee1b003c064f40d", "score": "0.56587315", "text": "def big_shoe_rebounds\n players = []\n shoe_sizes = []\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |x, y|\n players.push(x)\n shoe_sizes.push(data[x][:shoe])\n end\n end\n end\n end\n #this gives you the index of the max value\n max = shoe_sizes.each_with_index.max[1]\n f = players[max]\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n data.each do |x, y|\n if x == f\n return y[:rebounds]\n end\n end\n end\n end\nend", "title": "" }, { "docid": "b1399ad5612d489d7c04890cde4c4a63", "score": "0.5655071", "text": "def big_shoe_rebounds\n hash = game_hash()\n \n # Find biggest shoe\n shoe_size = []\n hash.each do |team, attributes|\n i = 0\n players = hash[team][:players]\n while i < players.length\n shoe_size << players[i][:shoe]\n i += 1\n end\n end\n max = shoe_size.max\n \n # Find big shoe rebounds\n hash.each do |team, attributes|\n i = 0\n players = hash[team][:players]\n while i < players.length\n if players[i][:shoe] == max\n return players[i][:rebounds]\n end\n i += 1\n end\n end\nend", "title": "" }, { "docid": "682773a270f583405b32b2f27a05b0ec", "score": "0.5649509", "text": "def highest_score_from(array_of_words)\n array = [\"cat\", \"dog\", \"rabbit\", \"bananas\"]\n score_hash = Hash.new\n\n # iterate through the array and push the word and score into the hash\n array.each {|x|\n score_hash[x] = score(x) # this puts the key and value pair into the hash\n }\n\n #return the word with the highest value\n # max_record = score_hash.max { |a,b| a.last <=> b.last }\n # puts max_record\n # max_index = max_record && max_record.first #max_index is the key that is correlated to the highest value\n # max_index\n\n max = score_hash.values.max # this code finds and stores the max score\n #puts \"the max score is #{max} points\"\n\n # now find the key(s) that have that max score, and put it into a new hash\n\n max_hash = Hash.new # this is a new hash to store k/v pairs that have the max score\n\n #the code below prints the score of each item of the array\n # array.each {|x|\n # puts score(x)\n # }\n\n # this score iterates over the array, and if the score value is equal\n #to the max value, the put the k/v pair into the max_hash\n array.each{ |x|\n if score(x) == max\n max_hash[x] = score(x)\n end\n }\n #puts max_hash\n\n # now compare the length of the keys of max_hash and return the shortest key\n\n #or if max_hash size is 1, just return the key\n theKey = \"\" # declare a string that will be used to store the key\n max_hash.each do |key, value|\n puts key\n end\n\n #if max_hash size > 1 then return the key with the shortest value\n\n\n end", "title": "" }, { "docid": "2ee6e957deab02518b023fd8ee1d54fc", "score": "0.5647294", "text": "def collate\n candidates = all_things.values.sort[THRESHHOLD]\n if candidates\n all_things.reject { |k, v| v < candidates }\n else\n all_things\n end\n end", "title": "" }, { "docid": "05b91a496e147b584b7cc877c3963c67", "score": "0.56436586", "text": "def big_shoe_rebounds\n name = \"\"\n largest_shoe = nil\n rebounds = nil\n\n game_hash.values.each do |team|\n team[:players].each do |key, value|\n if largest_shoe == nil\n name = key[:player_name]\n largest_shoe = key[:shoe]\n rebounds = key[:rebounds]\n elsif key[:shoe] > largest_shoe\n name = key[:player_name]\n largest_shoe = key[:shoe]\n rebounds = key[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "efc27aa3659647b0e603bbbf6a0d84cc", "score": "0.564355", "text": "def big_shoe_rebounds\n largest = nil\n\n for player in PLAYERS.values do\n shoe = player[:shoe]\n\n if largest == nil\n largest = player\n elsif shoe > largest[:shoe]\n largest = player\n end\n end\n\n largest[:rebounds]\nend", "title": "" }, { "docid": "c6fb783b60924d98f5551adffbd8179b", "score": "0.56406045", "text": "def extinct_by(hash, num)\n p hash.reject{|key, value| value < num}\nend", "title": "" }, { "docid": "31ba2cbd1253b666e9546622e6acfc45", "score": "0.5635909", "text": "def big_shoe_rebounds\nrebound = 0 \nshoe = 0 \n game_hash.each do |team_position, team_data|\n team_data[:players].each do |key,value|\n value.each do |k,v|\n if k == :shoe #when key matches the loop below will trigger. \n if v > shoe #checks the value of each shoe\n shoe = v #max value of the shoe is assigned\n rebound = team_data[:players][key][:rebounds]\n #rebound is corresponding with the value of the shoe and it is assigned with the player with highest shoe size and rebounds.\n \n\n end\n end\n end\n end\n end\n rebound\n end", "title": "" }, { "docid": "3384b106c3e19bb3dbb3a63cb230c814", "score": "0.5634732", "text": "def big_shoe_rebounds\n max = nil\n rebounds = nil\n game_hash.each do |team, team_values|\n team_values[:players].each do |player|\n if max == nil || player[:shoe] > max\n max = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "b8942600b16b69ea0f2b30df764dfb06", "score": "0.5633611", "text": "def remove_dups_no_hash\n benchmark = @head\n current = benchmark.next_node\n remove_count = 1\n changes = length - 2\n changes.times do\n while current != nil\n if benchmark.value == current.value\n remove_count += 1\n end\n current = current.next_node\n end\n if remove_count > 1\n remove_count.times do\n remove(benchmark.value)\n end\n end\n remove_count = 0\n benchmark = benchmark.next_node\n current = benchmark.next_node\n end\n end", "title": "" }, { "docid": "e0c1ab113189f24422344c03897cdd56", "score": "0.5627112", "text": "def big_shoe_rebounds()\n all_players_array = get_all_players()\n max_shoe_size = 0\n max_shoe_player_hash = Hash.new\n len = all_players_array.length()\n i = 0\n while i < len\n player = all_players_array[i]\n shoe_size = player[:shoe]\n if(shoe_size > max_shoe_size)\n max_shoe_size = shoe_size\n max_shoe_player_hash = player\n end\n i += 1\n end\n rebounds = max_shoe_player_hash[:rebounds]\n return rebounds\n\nend", "title": "" }, { "docid": "d0267bc73c114b8bb01da3c3dd73e13b", "score": "0.5626223", "text": "def keep_num_less5(ha,num)\r\n\tnew_hash = Hash.new(0)\r\n\t\r\n\tha.each do |x|\r\n\t\tif x[1] < num\r\n\t\tnew_hash[x[0]]=x[1] \r\n\t\tend\r\n\tend\r\n\r\np ha.replace( new_hash)\r\n\r\n\r\nend", "title": "" }, { "docid": "376a30f3602a81c9b136e5e001493b58", "score": "0.56258285", "text": "def set_minus(set1, set2)\n output = set1\n set2.each_key do |k|\n output.delete k\n end\n output\nend", "title": "" }, { "docid": "6adb23344060be4f4d194fcb63f3ca0d", "score": "0.5616396", "text": "def key_for_min_value(name_hash)\n while name_hash.length > 1 do\n name_hash.delete(name_hash.invert.max&.last)\n end\n name_hash.invert.max&.last\nend", "title": "" }, { "docid": "cf25cacee8c92aef5f43a398ff9f6f36", "score": "0.5612654", "text": "def big_shoe_rebounds\n largest_shoe = nil\n rebounds = nil\n game_hash.each do |home_or_away, team|\n team[:players].each do |key, player|\n if largest_shoe == nil or player[:shoe] > largest_shoe\n largest_shoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "f9cf83aaa0c020149785b7da2f5995b0", "score": "0.56053", "text": "def big_shoe_rebounds\n all_shoes = []\n game_hash.each do |team, team_info_hash|\n if team == :home || :away\n team_info_hash.each do |attribute, data|\n if attribute == :players\n data.each do |index|\n all_shoes << index[:shoe]\n all_shoes.max\n end \n end\n if attribute == :players\n data.each do |index|\n if index[:shoe] == all_shoes.max\n return index[:rebounds]\n end\n end\n end\n end\n end\nend\nend", "title": "" }, { "docid": "f6b28143dcb64514b6e143a00ab31b71", "score": "0.5596803", "text": "def big_shoe_rebounds\nmax_shoe_player = 0\nrebounds = 0\n game_hash.each do |location, attributes|\n attributes[:players].each do |category|\n if category[:shoe] > max_shoe_player\n max_shoe_player = category[:shoe]\n rebounds = category[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "dfaaf7a397329c1646f694a653ede031", "score": "0.55946225", "text": "def big_shoe_rebounds\n biggest_shoe_rebounds = nil\n biggest_shoe_size = nil\n\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_hash|\n if !biggest_shoe_rebounds || (player_hash[:shoe] > biggest_shoe_size)\n biggest_shoe_rebounds = player_hash[:rebounds]\n biggest_shoe_size = player_hash[:shoe]\n end\n end\n end\n\n biggest_shoe_rebounds\nend", "title": "" }, { "docid": "6f6884cbbbf7432103e8011f306184ac", "score": "0.5584125", "text": "def minus(set2)\n\t\tret = MyHashSet.new\n\t\tself.store.each do |el, value|\n\t\t\tunless(set2.include?(el))\n\t\t\t\tret.insert(el)\n\t\t\tend\n\t\tend\n\t\tret\n\tend", "title": "" }, { "docid": "3b29783fe105550e719dbcc5b1611254", "score": "0.55507284", "text": "def shortlist_nominees (nominees,votes_sum,election_summary)\n idx = 0\n votes_sum.each do | a |\n idx += 1\n if a != votes_sum.max\n nominees.delete(election_summary[idx-1][:nominee])\n end\n end\n return nominees\nend", "title": "" }, { "docid": "82de64e40503df54058ca19409f3bd2a", "score": "0.55445594", "text": "def filter_by_eval(val)\n\t\t\tdh = []\n\t\t\teach_sequence do |hit|\n\t\t\t\tdsh = []\n\t\t\t\thit.each_sequencehit do |sh|\n\t\t\t\t\tdsh << sh if sh.eval > val\n\t\t\t\tend\n\t\t\t\tdsh.each do |i|\n\t\t\t\t\thit.delete(i)\n\t\t\t\tend\n\t\t\t\tdh << hit if hit.length == 0\n\t\t\tend\n\t\t\tdh.each do |i|\n\t\t\t\tdelete(i)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c8c14cb2092cd27bdc892cc2ff891d2d", "score": "0.5538345", "text": "def prune_hash\n @mutex.synchronize do\n remove.times do\n @hash.delete(keys.shift)\n end\n end\n end", "title": "" }, { "docid": "a001988c23335b64b4e28fbe5fc539da", "score": "0.5532807", "text": "def remove_notextinct(hash, item, value)\n not_extinct = []\n hash.each do |animal, year|\n if animal == item && year == value\n not_extinct.push(animal) && not_extinct.push(year)\n end\n end\n p not_extinct\n hash.delete(item)\n p hash\nend", "title": "" }, { "docid": "54a78bd2b86d0da44fbf8580773cfb30", "score": "0.5526532", "text": "def zremrangebyscore(key, min, max); end", "title": "" }, { "docid": "54a78bd2b86d0da44fbf8580773cfb30", "score": "0.5526532", "text": "def zremrangebyscore(key, min, max); end", "title": "" }, { "docid": "bb0a8d3e73f2b56cb248bccf260a326f", "score": "0.55212915", "text": "def extinction_deletion(hash)\n hash.delete_if {|key, value| value > 1999}\nend", "title": "" }, { "docid": "5d20eae2372a91e74a48b46d741d2062", "score": "0.55093014", "text": "def unique_cutoff; end", "title": "" }, { "docid": "624e4f96b35494de649901f410539537", "score": "0.55053324", "text": "def select_top_five(ed1,ed2,word)\n \n if(ed1 == nil)\n words = ed2 \n elsif(ed2 == nil)\n words = ed1\n else\n words = ed1.merge(ed2)\n end\n\n words = words.sort_by{|k,v| -v}.first 5\n words = Hash[*words.flatten]\n final_list = Hash.new{}\n\n if !NWORDS.has_key?(word)\n words.each_with_index { |(k,v),index|\n if index == (words.length-1)\n final_list[word] = v*0.5\n else\n final_list[k] = v\n end\n }\n words = final_list\n end \n \n # words_only = Array.new()\n # words.each{ |k,v|\n # words_only.push(k) \n # }\n\n words.each { |k,v| \n print (String(v)+\" \"+String(NWORDS[k])+\" \"+k+\"\\n\")\n }\n #puts words.class\n #return words_only #list of words \n return words #Hash of words and corresponding score \nend", "title": "" }, { "docid": "f0dff3dc12ef5e704c643f848ee2436f", "score": "0.5504349", "text": "def lrem(key, count, value); end", "title": "" }, { "docid": "f0dff3dc12ef5e704c643f848ee2436f", "score": "0.5504349", "text": "def lrem(key, count, value); end", "title": "" }, { "docid": "46c3835d24f167c4ecef291b0fbcb01e", "score": "0.55018467", "text": "def remove_loc(combinations, last_key)\n last_key.each_with_index do |e, i|\n combinations.delete_if {|k, v| k[i] == e}\n end \nend", "title": "" }, { "docid": "18472daf6d4cdadf601468b3f2132c5a", "score": "0.5499349", "text": "def remove_sorted_set(key, member)\n @kvs_instance.zrem(safe_key(key), member)\n end", "title": "" }, { "docid": "7903d6837578d15acb53290aed51649e", "score": "0.5496823", "text": "def key_for_min_value(name_hash)\n winner = nil\n current = 10000\n name_hash.each do |key, value|\n if key != nil && value < current\n \n current = value\n winner = key\n end\n end\n winner \n \nend", "title": "" }, { "docid": "59e19eb04fd1437eb770398ee0599ec6", "score": "0.54927975", "text": "def key_for_min_value(name_hash)\n values = []\n mini = []\n\n name_hash.collect do |name, value|\n values << value\n end\n\n mini << values.min\n\n name_hash.collect do |key, value|\n if(value == mini[0])\n mini << key\n end\n end\n result_key = mini.pop\n\nend", "title": "" }, { "docid": "0ae37c5fa48d823def1ec6e9a6d55f71", "score": "0.54879516", "text": "def pop(key)\n new_head = @least_neglected.prev\n\n @least_neglected.prev = nil\n\n new_head.next = nil\n\n @least_neglected = new_head\n\n @data.delete(key)\n end", "title": "" }, { "docid": "b6c5a2515d0522e3690d7ba360097abf", "score": "0.54840565", "text": "def playersCut(index)\n idHashArray = []\n for i in [email protected]\n idHashArray.push(@playerIds[i].map {|x| [x,true]}.to_h)\n end\n for i in [email protected]\n for j in 0..@players[i].length-1\n if (!(idHashArray[index].has_key?(@players[i][j]['Info']['ID'])))\n @players[i][j] = \"Removed\"\n end\n end\n @players[i].delete(\"Removed\")\n end\nend", "title": "" }, { "docid": "f38a57ad2ff94dde97bfaeee892e5d43", "score": "0.54836535", "text": "def key_for_min_value(name_hash)\n holder = []\n name_hash.each do |key, val|\n holder.push(val)\n end\n i = 0\nwhile holder.length > 1\nif holder[i] > holder[i+1]\n holder.delete(holder[i])\n elsif holder[i] < holder[i+1]\n holder.delete(holder[i+1])\n end\nend\nholder\nname_hash.key(holder[0])\nend", "title": "" }, { "docid": "118f28ac1d53073ae7245529afe0debd", "score": "0.5482881", "text": "def clear_seen_values\n @largest_seen_values = {}\n @smallest_seen_values = {}\n end", "title": "" }, { "docid": "2dfd353cf31e6ab8e9eb61a48759f4a1", "score": "0.5482063", "text": "def big_shoe_rebounds\n max = 0\n rebounds = 0\n game_hash.each do |ho_away, info|\n i = 0 \n while i < info[:players].length do \n if info[:players][i][:shoe] > max\n max = info[:players][i][:shoe]\n rebounds = info[:players][i][:rebounds]\n end\n i += 1\n end\n end\n rebounds\nend", "title": "" }, { "docid": "dd6ed0a6ecc543818ff62f9e9ad3f159", "score": "0.548134", "text": "def delete_min_return_key\n delete_min[0] rescue nil\n end", "title": "" }, { "docid": "86b75179806c3e9ba5ecd35de3aafb59", "score": "0.5481327", "text": "def cleanUp\n @set.values.each { |entry| entry.reject!(&:empty?) }\n @set.reject! { |key, value| value.empty? }\n end", "title": "" }, { "docid": "8080c4bf86dbf4da82d7312c31ec84db", "score": "0.5480852", "text": "def delete_max\n raise 'Priority queue underflow' if is_empty?\n max_key = @keys[1]\n @keys.swap(1, @keys.length - 1)\n @keys.delete_at(@keys.length - 1)\n sink(1)\n max_key\n end", "title": "" }, { "docid": "3795545df3c1e708f188991a7387002c", "score": "0.54716307", "text": "def highest_score_from(words)\n winning_hash = {\n word: \"\", \n score: 0\n }\n words.each do |word|\n if score_word(word) > winning_hash[:score]\n winning_hash[:word] = word\n winning_hash[:score] = score_word(word)\n elsif score_word(word) == winning_hash[:score]\n if word.length == 10 && winning_hash[:word].length != 10\n winning_hash[:word] = word \n elsif word.length < winning_hash[:word].length && winning_hash[:word].length != 10\n winning_hash[:word] = word\n end\n end\n end\n return winning_hash\nend", "title": "" }, { "docid": "c34f39a82fdcb7cbef426046faf70e64", "score": "0.5465356", "text": "def delete_combo(last_value, last_key, poss_num, combinations, poss_loc)\n case last_value.count\n when 1..3\n increment_poss_num(last_value.count, last_key, poss_num, combinations)\n combinations.delete_if {|k, v| k.sort == last_key.sort}\n # if 4 or no matches remove entirely from poss_num\n when 4\n combinations.delete_if {|k, v| k.sort != last_key.sort || k == last_key}\n ([1, 2, 3, 4, 5, 6, 7] - last_key).each do |s|\n poss_num.delete_if {|k, v| k == s}\n poss_loc.delete_if {|k, v| k[0] == s}\n end\n # no matches also remove entirely some poss_num\n else\n puts poss_loc\n last_key.each do |s| \n combinations.delete_if {|k, v| k.include?(s)}\n poss_num.delete_if {|k, v| k == s}\n poss_loc.delete_if {|k, v| k[0] == s}\n end\n end\nend", "title": "" }, { "docid": "d3a3a02957ffd033c75908a65ae04ce6", "score": "0.54628885", "text": "def -(x)\n sum_of_squares = 0\n each do |k, v|\n v2 = x.fetch(k)\n # only calculate score if both values are present; this\n # prevents missing info on one of the entries from generating\n # a large difference and throwing off the calculation\n if v.present? && v2.present?\n score = (v - v2).abs\n else\n # one or both values are missing in the two Entries, so\n # give it a score of 7\n score = 7\n end\n # puts \"score for key=#{k} = #{score}\"\n sum_of_squares += score ** 2\n end\n Math.sqrt(sum_of_squares)\n end", "title": "" }, { "docid": "1be80773f56640a10dc0d4afc3967263", "score": "0.5462792", "text": "def reachable_keys(keys)\n keyring = keys.to_set\n (@all_keys-keys).filter { |k| @required_keys[k] <= keyring } # subset\nend", "title": "" }, { "docid": "0fcdcf45f6471aebb7a51ed8aac93f92", "score": "0.5453787", "text": "def categorize(master, key_arr, duplicates, unique)\n unique_candidates = []\n to_remove = []\n\n #\n # Sort out entries in master into unique \n # and duplicates categories\n #\n for key in master.keys\n if master[key].count > 1\n\n # Because there is more than one entry\n # Append specific reason for tagging this data as a duplicate\n duplicates << {'reason'=> \"Duplicate key #{key}\", 'data' => master[key] }\n else\n\n # Since there is only one entry we will add to the candidates\n unique_candidates << master[key][0]\n end\n end\n\n # Expensive here n-prime^2\n # It seems necessary in order to compare with\n # all other elements in the unique candidates list.\n #\n uc = unique_candidates\n for idx1 in (0...uc.count).to_a\n for idx2 in ((idx1+1)...uc.count).to_a\n\n #Generate the index keys for the elements\n #to be compared\n key1 = gen_key(key_arr, uc[idx1])\n key2 = gen_key(key_arr, uc[idx2])\n \n #Doing straight up computation, but we can\n #chain it. Example: if meta_sim > 0.95 then run \n #levenshtein. If levenshtein is <= 2 then run\n #WhiteSimilarity. You would want the less accurate\n #algorithms to run first, this I'm not sure of\n ls = Text::Levenshtein.distance(key1, key2) \n white = Text::WhiteSimilarity.new\n meta1 = Text::Metaphone.metaphone(key1)\n meta2 = Text::Metaphone.metaphone(key2)\n meta_sim = white.similarity(meta1, meta2)\n sim = white.similarity(key1, key2)\n\n #TODO\n #puts Text::Metaphone.metaphone(uc[key2])\n #puts Text::Soundex.soundex(uc[key1])\n #puts Text::PorterStemming.stem(can['last_name'])\n\n # These are thresholds that were set by looking at the test data\n # This can be set dynamically based on whoever is manually checking these duplicate candidates\n if ls < 5 || sim > 0.85 || meta_sim > 0.85\n duplicates << {'reason'=> \"Levenshtein: #{ls}, Sim: #{sim}, Sim on Metaphone: #{meta_sim}\", 'data'=>[uc[idx1], uc[idx2]]}\n\n # Remove these entries later \n to_remove << key1\n to_remove << key2\n end\n end\n end\n\n # Remove people that were candidates but were disqualified based on\n # further text algorithms\n for key in to_remove\n unique_candidates.delete_if{ |uc| gen_key(key_arr, uc) == key }\n end\n\n # Assign unique people to list\n unique = unique_candidates\n \n #Optional sort on last name \n unique = unique.sort {|s1, s2| s1['last_name']<=>s2['last_name']}\n\n [duplicates, unique]\nend", "title": "" }, { "docid": "9dfc8522197b216d907b052ccef358d8", "score": "0.5453774", "text": "def remove(num)\n # raise \"#{num} does not exist in set\" if !include?(num)\n deleted = self[num].delete(num)\n @count -= 1 if deleted\n deleted\n end", "title": "" }, { "docid": "3bd0c07f3c5e6f6bd323df9d0771dd36", "score": "0.54524565", "text": "def big_shoe_rebounds\n big_shoe_rbnds = 0\n big_shoe = 0\n game_hash.each do |a,b|\n b[:players].each do |c,d|\n if d[:shoe] > big_shoe\n big_shoe_rbnds = d[:rebounds]\n end\n end\n end\n big_shoe_rbnds\nend", "title": "" }, { "docid": "61a788e02510b4c85b71285d47045afb", "score": "0.54493046", "text": "def delete_over_nth(list, max_count)\n numbercounter = {}\n\n i = 0\n while i < list.size\n key = list[i].to_s\n if numbercounter[key] == nil\n numbercounter[key] = 1\n i += 1\n elsif numbercounter[key] >= max_count\n list.delete_at(i)\n else\n numbercounter[key] += 1\n i += 1\n end\n end\n\n list\nend", "title": "" }, { "docid": "f8f07dd23f0d559f738816b103b0bbdc", "score": "0.54487646", "text": "def big_shoe_rebounds\n constant_shoe = 0\n highest_rebounds = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |key, info|\n if info[:shoe] > constant_shoe\n constant_shoe = info[:shoe]\n highest_rebounds = info[:rebounds]\n end\n end\n end\n highest_rebounds\nend", "title": "" }, { "docid": "3c5c8d851bc21874712cc9a045ab59a5", "score": "0.54458225", "text": "def delete_final_word\n finalWord = @wordHash.max_by { |k, v| v }\n finalWordKey = finalWord[0]\n @wordHash.delete(finalWordKey)\n return @wordHash\n end", "title": "" }, { "docid": "e8d225315320547e032759d8d19fc689", "score": "0.5442848", "text": "def you_just_deleted_the_first_word_in_hash\n\t\t@word_index.values.max == nil\n\tend", "title": "" }, { "docid": "f68726f1585790d09a2ab2deffebcf3b", "score": "0.54426587", "text": "def find_unique_elements(arr) #I want to use a hash like in the most-common integer problem. That hash will be populated with keys based on the array and values based on how often that key appears in the array. \n\th = Hash.new(0) #this is my new empty hash\n\tarr.each{ |i| h[i] += 1 } #This each loop will go through the original array, and each time a specific object occurs, it will increase the value of that key in the hash.\n\th.delete_if{ |k, v| v > 1 } #Delete_if goes through the hash and deletes specified objects if the return true. Here they should be deleted if the value is more than 1.\n\treturn h.keys #Returns an array of the remaining keys in h.\nend", "title": "" }, { "docid": "c32148f5d7956acae3cfb862254f01ea", "score": "0.5439209", "text": "def remove_useless_data(data)\n comp = Array.new\n valuation = [\"price_to_sales\", \"PEG\", \"EBITDA\"]\n\n data.each do |company|\n empty = Array.new\n company[3].each do |ratio_hash|\n ratio_hash.each do |key, value|\n if value.empty? and (not valuation.include?(key))\n empty << value\n end\n end\n end\n comp << company if empty.length == 14\n end\n\n data = data - comp\n data.delete_if { |comp| comp[2] == nil }\n data\nend", "title": "" }, { "docid": "e5d4eafcd56fcf2a3c905d6180a59682", "score": "0.54389083", "text": "def big_shoe_rebounds\n \n big_shoe = 0\n rebounds = 0\n \n game_hash.each do |key, value|\n \n value[:players].each do |player|\n \n if big_shoe < player[:shoe]\n rebounds = player[:rebounds]\n big_shoe = player[:shoe]\n \n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "8d8f2c1d6722ee33233054bd01f2f158", "score": "0.54378575", "text": "def remove_ages(hash)\n hash.keep_if do |name, age|\n age > 100\n end\n hash\nend", "title": "" }, { "docid": "1e95d7d33cce5a6721b500d1f0444a77", "score": "0.54364", "text": "def key_for_min_value(name_hash)\n avengers = nil \n heroes = nil\nname_hash.each do |name, value|\n if heroes == nil || value < heroes\n heroes = value\n avengers = name\n end\n end\n avengers\n end", "title": "" }, { "docid": "7ac84713f9a0c2b68735acbf6052fccd", "score": "0.5434865", "text": "def remove_num_less5(ha,num)\r\n\tnew_hash = Hash.new(0)\r\n\tha.each do |x|\r\n\t\tif x[1] > num\r\n\t\tnew_hash[x[0]]=x[1]\r\n\t\tend\r\n\tend\r\n\r\np new_hash\r\nend", "title": "" }, { "docid": "f748e4da09733f544f8f3d6e34dd3403", "score": "0.5425616", "text": "def delete_min\n raise 'Priority queue underflow' if is_empty?\n min_key = @keys[1]\n @keys.swap(1, @keys.length - 1)\n @keys.delete_at(@keys.length - 1)\n sink(1)\n min_key\n end", "title": "" }, { "docid": "29cdd55d972899818569d629f41a55ad", "score": "0.5418829", "text": "def restrict_product_set(set, maxPrice)\n set.select! { |product| product['price_f'] < maxPrice }\n # TODO: If unit isn't grams our ratio will be way off\n # TODO: define methods instead of using some symbols and some methods\n set.sort_by! { |product| product.price_per_g / product.avg_thc }\n end", "title": "" }, { "docid": "8c9c515f1ca8c4dda8162d7a78010019", "score": "0.54180837", "text": "def pop_pair\n if selected = pair_candidates.min { |a,b| a[1].length <=> b[1].length }\n first_in_pair = selected[0]\n else\n return nil\n end\n\n candidates = pair_candidates[first_in_pair]\n # From the pair candidates of first_in_pair find the one with the least candidates.\n candidates_candidates = pair_candidates.select do |k,v|\n candidates.include?(k)\n end\n second_in_pair =\n candidates_candidates.min { |a,b| a[1].length <=> b[1].length }[0]\n\n # Remove the pair from humans\n humans.delete_if { |k,v| [first_in_pair, second_in_pair].include?(k) }\n\n [first_in_pair, second_in_pair].sort\n end", "title": "" } ]
3aa18a23935cfaa5ebce1bf614ca37f5
GET /description_of_components/1 GET /description_of_components/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "bf82ba16654ac983d707a70dc526e17b", "score": "0.7602657", "text": "def index\n @description_of_components = DescriptionOfComponent.all\n end", "title": "" }, { "docid": "7021214e68687f3932b5c92cbc0c0633", "score": "0.68399143", "text": "def components\n\t return JSON.parse(get(\"info/components.json\"))\n\tend", "title": "" }, { "docid": "6d2041e44a1630ec223336e85c81558b", "score": "0.6580675", "text": "def show\n @component = Component.find(params[:id])\n\t@title = @header = @component.name\n\t@componentLinks = @component.component_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @component }\n end\n end", "title": "" }, { "docid": "d4e476948a0ca14ffd53e108a3392cf6", "score": "0.65048426", "text": "def set_description_of_component\n @description_of_component = DescriptionOfComponent.find(params[:id])\n end", "title": "" }, { "docid": "84f8309fedbcb779ef2807e82ba2239f", "score": "0.6387315", "text": "def show\n @component = Component.find(params[:id])\n\t @title = @header = @component.name\n @photos = @component.photos.size > 1 ? @component.photos.where.not(id: @component.get_photo.id) : []\n\t @componentLinks = @component.component_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @component }\n end\n end", "title": "" }, { "docid": "1ed2d669516800ced61b085401002bf7", "score": "0.6339967", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.6306787", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.6306569", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.6306569", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "c39fda7507d708614041aa0605780c54", "score": "0.6231294", "text": "def index\n @components = Component.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "cc1bccaaab636e42be25700a0480d5bd", "score": "0.6221089", "text": "def create\n @description_of_component = DescriptionOfComponent.new(description_of_component_params)\n\n respond_to do |format|\n if @description_of_component.save\n format.html { redirect_to @description_of_component, notice: 'Description of component was successfully created.' }\n format.json { render action: 'show', status: :created, location: @description_of_component }\n else\n format.html { render action: 'new' }\n format.json { render json: @description_of_component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "650aebe631758889faca22349bed4102", "score": "0.6205266", "text": "def show\n @requests_devolutions_components_detail = Requests::Devolutions::Components::Detail.find(params[:id])\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "e794c756b0fa235145af6fe8822ee2ad", "score": "0.6202737", "text": "def index\n @upc_descriptions = UpcDescription.all\n\n render json: @upc_descriptions\n end", "title": "" }, { "docid": "db2aa5899e00deab9076c29c5c71e512", "score": "0.61828965", "text": "def index\n\t@title = @header = 'Комплектующие'\n\t@component_types = ComponentType.order('name ASC')\n\t@components = []\n\tif params[:t] != nil and params[:t] != ''\n\t\t@componentType = ComponentType.find_by_id(params[:t])\n\telse\n\t\t@componentType = ComponentType.find_by_id(10)\n\tend\n\t@components = @componentType.components.select('id, name, cost, designation').order('name ASC') if @componentType != nil\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @components }\n end\n end", "title": "" }, { "docid": "8d7583c289658983f67f685c145ea671", "score": "0.61822873", "text": "def index\n @components = Component.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "2dca8c308425c129b66fabfdc268a7a3", "score": "0.6166881", "text": "def show\n @decription = Decription.find(params[:id])\n\n render json: @description\n end", "title": "" }, { "docid": "066e7a5f0f97a30cde985f3744e77753", "score": "0.61540914", "text": "def get_description_by_id(id)\n url = URI(\"#{BASE_URL}#{EDITION}/#{VERSION}/descriptions/#{id}\")\n response = Net::HTTP.get(url)\n data = JSON.parse(response)\n puts data['term']\nend", "title": "" }, { "docid": "f3b62306555325358d0782dfc0b01fae", "score": "0.6078762", "text": "def show\n @standard_component = StandardComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @standard_component }\n end\n end", "title": "" }, { "docid": "64456b240dae4f2d953308473798fd26", "score": "0.60481614", "text": "def show\n @product_description = ProductDescription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_description }\n end\n end", "title": "" }, { "docid": "1c0a31895b3fe98e4061f170b3fc8190", "score": "0.6041023", "text": "def show\n @component_model = ComponentModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_model }\n end\n end", "title": "" }, { "docid": "eb69a73aab4dc7e932db618239b945a6", "score": "0.60383725", "text": "def new\n @component_package = ComponentPackage.new\n list_components\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "b02456ae24aeed1f3234ffbf6b13b8e1", "score": "0.6030224", "text": "def show\n @component_type = ComponentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_type }\n end\n end", "title": "" }, { "docid": "bc818a75834fc584b6fe5ef96d2307ac", "score": "0.5978324", "text": "def new\n @component = Component.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "bc818a75834fc584b6fe5ef96d2307ac", "score": "0.5978324", "text": "def new\n @component = Component.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "327a88001d26acdae9e850d251121798", "score": "0.596534", "text": "def show\n @componenttype = Componenttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @componenttype }\n end\n end", "title": "" }, { "docid": "b23f86e62fc10a0fde0a1c57055a0803", "score": "0.59460384", "text": "def index\n @component_contents = ComponentContent.all\n end", "title": "" }, { "docid": "c81c2890f3c2f895e6f1ef5aa981095e", "score": "0.59414285", "text": "def new\n @standard_component = StandardComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @standard_component }\n end\n end", "title": "" }, { "docid": "23bfe1b645d55060168f70a40fc7ef50", "score": "0.592426", "text": "def get_description_by_id(id)\n url = URI(\"#{BASE_URL}#{EDITION}/#{VERSION}/descriptions/#{id}\")\n response = Net::HTTP.get(url)\n data = JSON.parse(response)\n puts data['matches'][0]['term']\nend", "title": "" }, { "docid": "c5c6807ea95733c62f63fb0c112c3aca", "score": "0.587684", "text": "def index\n @service_descriptions = ServiceDescription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_descriptions }\n end\n end", "title": "" }, { "docid": "4c4c629f5be926b9e2fe125704a3e881", "score": "0.5873921", "text": "def index\n @eg_components = EgComponent.all\n end", "title": "" }, { "docid": "a84abf5d494d1a1e447b7a14fabce39b", "score": "0.5871439", "text": "def request_components; end", "title": "" }, { "docid": "b83b1f10cb84eda52771ae25ef043f95", "score": "0.58691716", "text": "def show\n @component = current_cms.components.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "3f6be473eb481d1114540d0709f13a21", "score": "0.5855557", "text": "def destroy\n @description_of_component.destroy\n respond_to do |format|\n format.html { redirect_to description_of_components_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31d0b9373a4a7822da6613b316b21249", "score": "0.58548754", "text": "def new\n @available_components = @plan.components.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "title": "" }, { "docid": "0b84ddec1b28ef63e67c45201c828974", "score": "0.58531797", "text": "def index\n @meta_descriptions = MetaDescription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meta_descriptions }\n end\n end", "title": "" }, { "docid": "27f6155e1fe1a2010592af07213f2a8b", "score": "0.5831287", "text": "def update\n respond_to do |format|\n if @description_of_component.update(description_of_component_params)\n format.html { redirect_to @description_of_component, notice: 'Description of component was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @description_of_component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cac2f5f5d0b6bbb8981372ade587fdbe", "score": "0.5817354", "text": "def description_of_component_params\n params.require(:description_of_component).permit(:name, :rus_name, :description, :full_description)\n end", "title": "" }, { "docid": "11d9a390eeae05f6f426415bfba6f142", "score": "0.5810417", "text": "def new\n @product_description = ProductDescription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_description }\n end\n end", "title": "" }, { "docid": "359474617a4e26247eeff3172a882ff2", "score": "0.581035", "text": "def get_component\n @component = Component.find(params[:component_id])\n end", "title": "" }, { "docid": "e83341a0cd1079d65717f4c971ded42d", "score": "0.57872057", "text": "def new\n @component = Component.new\n @new_component = 'true'\n list_components\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "6fa8396b9e1635d280744fc17544eb4e", "score": "0.5784694", "text": "def index\n @descriptions = Description.all\n end", "title": "" }, { "docid": "cd93897483360884d29e84cae0dbff36", "score": "0.5778931", "text": "def show\n @field_description = FieldDescription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @field_description }\n end\n end", "title": "" }, { "docid": "8015ae6281e84711044ef23a41ce3071", "score": "0.5778468", "text": "def new\n @component_model = ComponentModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_model }\n end\n end", "title": "" }, { "docid": "2853ec31dd514754216a7633b88a728e", "score": "0.5776584", "text": "def show\n if @components.present?\n respond_with @components\n else\n respond_with @component\n end\n end", "title": "" }, { "docid": "900a1497cdcba53367a56574bd03b134", "score": "0.5772626", "text": "def new\n\t\t@title = @header = 'Новый компонент'\n\t\t@component = Component.new\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @component }\n\t\tend\n end", "title": "" }, { "docid": "c2deb16498e0eca20ed84155049a3161", "score": "0.5771159", "text": "def description_from_spec\n # QUERY: Use the query to get the description per collection using save navigation\n describe_meta = ActiveFedora::SolrService.query(\"has_model_ssim:AdminSet AND id:#{@spec}\", rows: 1).first['description_tesim']&.first\n\n # CONDITION: Check the condition to return the correct description to display on OAI\n return describe_meta if describe_meta.blank? == false\n end", "title": "" }, { "docid": "3fca80bd66f640b0183d1218c19bd49c", "score": "0.57706666", "text": "def show\n @descriptioncall = Descriptioncall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descriptioncall }\n end\n end", "title": "" }, { "docid": "ca1c0021ef9c993d5554d79de34413e0", "score": "0.575762", "text": "def show\n @assessment_component = AssessmentComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_component }\n end\n end", "title": "" }, { "docid": "6e0ea94b2e5b2f80f072e2e51723668b", "score": "0.57562906", "text": "def show\n @meta_description = MetaDescription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meta_description }\n end\n end", "title": "" }, { "docid": "5ef31fa382e624c5460f11fc68042277", "score": "0.5746557", "text": "def show\n @component = Component.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "65769fe6727efa98645f31a1b03d863e", "score": "0.5744317", "text": "def new\n @component_type = ComponentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_type }\n end\n end", "title": "" }, { "docid": "262325989f76ccc8308e39d9b8152ba2", "score": "0.5738354", "text": "def get_component_family(opts)\n opts[:query]['all_elements'] = \"yes\"\n rest_crud_request(opts[:req_uri], opts[:query]['id'], opts[:format],\n {'Model Entity' => 'pack',\n 'Permission' => 'view'},\n opts[:user], opts[:query])\nend", "title": "" }, { "docid": "8d9b0b9ea80bcdf16cad661cad3205c1", "score": "0.5737009", "text": "def show\n @component_nutrient = ComponentNutrient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_nutrient }\n end\n end", "title": "" }, { "docid": "21389cc8999748460367e5cbb8f38093", "score": "0.573301", "text": "def new\n @decription = Decription.new\n\n render json: @description\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.5729931", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.5729931", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.5729931", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.5729931", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "bb873dbbd8b88677e36c5f3bec34ab79", "score": "0.57231826", "text": "def show\n @requests_devolutions_component = Requests::Devolutions::Component.find(params[:id])\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "f18d79625f607b7b4ffb992ca26def1f", "score": "0.57201684", "text": "def new\n @componenttype = Componenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @componenttype }\n end\n end", "title": "" }, { "docid": "c829632950cdf98d34b105172bcde7da", "score": "0.570849", "text": "def index\n @component_comments = ComponentComment.all\n end", "title": "" }, { "docid": "3376c2714bcaaa332430d9e021e91b13", "score": "0.5697097", "text": "def index\n @system_specification = @service.system_specification\n show\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render :json => @system_specifications }\n end", "title": "" }, { "docid": "15fe36f3ee040cfbfdb6054d8f0738dc", "score": "0.56949514", "text": "def _description_item_list\n\t\t\tblocks = Block.where project_id: params[:project_id]\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: render_to_string(partial: 'blocks/description_item_list', locals: { blocks: blocks })\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "162b763fe121834265d26fbbb3054aeb", "score": "0.56898886", "text": "def show\n render json: @upc_description\n end", "title": "" }, { "docid": "f7cbd8c4753591023b30877a6d5e43c2", "score": "0.5680932", "text": "def show\n @job_description = JobDescription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_description }\n end\n end", "title": "" }, { "docid": "d3df1e26da4b70e6a5f9587cb46bd486", "score": "0.5677405", "text": "def index\n @components = current_cms.components.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "cc4885ac7aaa42e60d3ce9a51dab9f1e", "score": "0.56759024", "text": "def index\n @components = Component\n\n apply_scopes_and_pagination\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "1a7fc87d00ca41b0b9d07facbba5142d", "score": "0.56749016", "text": "def show\n @desc = Desc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @desc }\n end\n end", "title": "" }, { "docid": "4b53c10bda9548a5e7b195a2462f6959", "score": "0.56719875", "text": "def description\n fetch('food.descriptions')\n end", "title": "" }, { "docid": "4b53c10bda9548a5e7b195a2462f6959", "score": "0.56719875", "text": "def description\n fetch('food.descriptions')\n end", "title": "" }, { "docid": "ee7ef55d31fd32cae9f96615008793d5", "score": "0.56698865", "text": "def show\n render json: @specification, serializer: Website::V1::SpecificationSerializer\n end", "title": "" }, { "docid": "c23477a5ba21c025936b774eb1c411e5", "score": "0.5659612", "text": "def get_descriptions\n # Retrieves a dataset from the database\n dataset = Description.first(id: description)\n dataset.description\n end", "title": "" }, { "docid": "f7dc537e5e9774d8bb786e701f318fdb", "score": "0.5658329", "text": "def new\n @assessment_component = AssessmentComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assessment_component }\n end\n end", "title": "" }, { "docid": "0fdfb98e6b698ce5edaa19893e8eb63d", "score": "0.5654599", "text": "def show\n @descriptor = Descriptor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descriptor }\n end\n end", "title": "" }, { "docid": "c7e4cf70929925af240f702b0cc777ee", "score": "0.56536204", "text": "def new\n @component = current_cms.components.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "32ce2823c8c16739e371cdaf3c1d7876", "score": "0.5645956", "text": "def components\n @components ||= ApiFactory.new 'Issues::Components'\n end", "title": "" }, { "docid": "28f4fb7a637054151ea50feb40a77783", "score": "0.56404155", "text": "def new\n @component_nutrient = ComponentNutrient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_nutrient }\n end\n end", "title": "" }, { "docid": "d63f9515bcfdbe65a9798645fe14f4bd", "score": "0.5639693", "text": "def index\n @components = @sys_config.components.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @components.to_xml }\n end\n end", "title": "" }, { "docid": "8f378e939c6d4aafc87248cb9bb44577", "score": "0.56281453", "text": "def new\n @item_description = ItemDescription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_description }\n end\n end", "title": "" }, { "docid": "ac311afcdf6d43ae61fb88b6308d451a", "score": "0.5621317", "text": "def show\n @descripcion = Descripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descripcion }\n end\n end", "title": "" }, { "docid": "f248ed755aaf6e9336f702b6c97f0628", "score": "0.56201965", "text": "def index\n @components = Component.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "9c175f30a06ba937af32e9ffbbed33ae", "score": "0.56130904", "text": "def description\n fetch('phobia.descriptions')\n end", "title": "" }, { "docid": "e84ef1e0a75eba2d968ea00c5550a158", "score": "0.5611664", "text": "def description\n response[\"description\"]\n end", "title": "" }, { "docid": "9f0ba8699df2b0138aa52761c32338fe", "score": "0.5609904", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "bb4db9737a66c773137b7782d06a6f2c", "score": "0.56054145", "text": "def description\r\n @description ||= car_page.content.slice(/\"roo_solution_instance\"(.*?)div/,1).slice(/label.*?(\\d+)/,1)\r\n end", "title": "" }, { "docid": "71953691949f33b67165c835e2f90294", "score": "0.5598861", "text": "def new\n @component = Component.new\n\n # Checking if we already set page via 'Add Component' buttons on pages\n if params[:page]\n @component.page = params[:page]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "0898d8009ceecc07f22e860c6beab307", "score": "0.559694", "text": "def show\n @service_description = ServiceDescription.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_description }\n end\n end", "title": "" }, { "docid": "4a73078e48091560b9de22e4f01b1d14", "score": "0.55833083", "text": "def show\n\n render json: @comp\n end", "title": "" }, { "docid": "4878c94cf40277dd88c8c91c5a6f03b8", "score": "0.5576072", "text": "def update\n @decription = Decription.find(params[:id])\n\n render json: @description\n end", "title": "" }, { "docid": "845fbcf8cc9554bdd0dec231320ebcf7", "score": "0.55725735", "text": "def show\n @partner_org_component = PartnerOrgComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partner_org_component }\n end\n end", "title": "" }, { "docid": "61efce2b438fee91d32a52726a69070b", "score": "0.5567727", "text": "def get path, category=nil, timeout=nil, &block\n\t\t\t# FIXME: Use em-http-request instead of HttpClient,\n\t\t\t# which returns an empty :content field for /description.xml\n\t\t\trequest 'GET', path, category, nil, nil, timeout, &block\n\t\tend", "title": "" }, { "docid": "3f1bfb489eab31affdd20a4a03ce4969", "score": "0.5565876", "text": "def index\n @item_descriptions = ItemDescription.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_descriptions }\n end\n end", "title": "" }, { "docid": "4c1af637df04786cb44c6dc9068cf0db", "score": "0.55657834", "text": "def index\n @specifications = Specification.all\n\n render json: @specifications, each_serializer: Website::V1::SpecificationSerializer\n end", "title": "" }, { "docid": "0dde67aa7b7308cdeb5bf4f4a3efc271", "score": "0.5557503", "text": "def show\n @components_cog = Components::Cog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_cog }\n end\n end", "title": "" }, { "docid": "b6b4f413b294b5298e48afa53d380dd1", "score": "0.5556124", "text": "def index\n @awon_field_descrips = AwonFieldDescrip.all\n end", "title": "" }, { "docid": "4e436afe5380074f6cc7a5109aa128da", "score": "0.55531776", "text": "def index\n @job_descriptions = JobDescription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_descriptions }\n end\n end", "title": "" }, { "docid": "a4a1133558f690e35d15403052a271d3", "score": "0.554867", "text": "def index\n @product_descriptions = ProductDescription.all\n end", "title": "" }, { "docid": "a8067c17ece4aaceb188de6b97bd036a", "score": "0.55470115", "text": "def index\n list_components \n\n if @user.privilege == \"admin\"\n if params[:type] && params[:type] != \"all\"\n @components = Component.find_all_by_component_type(params[:type])\n else\n @components = Component.all\n end\n else\n @components = Component.find_all_by_client_id(@user.client_id)\n\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "e7daca08c8f7ddb1d5ddf950ebe9ecba", "score": "0.5540245", "text": "def index\n @components = Gooey::Component.all\n end", "title": "" }, { "docid": "f4a2bd353b226c8278f72afffa7c21d8", "score": "0.55367357", "text": "def index\n @custom_descriptions = CustomDescription.all\n end", "title": "" }, { "docid": "5c1775ab36ca198e99ea5ca7272e254a", "score": "0.55313915", "text": "def get_description\n\t\tend", "title": "" } ]
bf3482578f2332acb5639834c9a09cce
the cache is expired
[ { "docid": "e1a1a7499692c5dd3570cd2f305e43ab", "score": "0.79037213", "text": "def cache_expired\n if Lock.acquire_lock(cache_path)\n pass\n else\n # haven't acquired lock, return stale cache\n check_cache\n end\n end", "title": "" } ]
[ { "docid": "a55d53b4fc810c24ff722339c3947d98", "score": "0.82542586", "text": "def expire_cache; end", "title": "" }, { "docid": "a55d53b4fc810c24ff722339c3947d98", "score": "0.82542586", "text": "def expire_cache; end", "title": "" }, { "docid": "bf971416243658c6bad2f6f85b20691c", "score": "0.79849803", "text": "def is_expired?(cache)\n cache[\"date\"].to_i < (Time.now.to_i - CACHE_DURATION)\n end", "title": "" }, { "docid": "9331246d45545630b0bf1867a6d750d5", "score": "0.7738772", "text": "def invalidate_cache! now\n end", "title": "" }, { "docid": "385571cb1778b97ba66d229e6c6906e3", "score": "0.7721113", "text": "def invalidate_cache\n end", "title": "" }, { "docid": "cabe9b0cdcad930a65574464f0c74767", "score": "0.763826", "text": "def expire(key)\n CacheModel.expire(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "title": "" }, { "docid": "3fb68128d25619a59c7042d172c64a52", "score": "0.75538933", "text": "def expired?; end", "title": "" }, { "docid": "3fb68128d25619a59c7042d172c64a52", "score": "0.75538933", "text": "def expired?; end", "title": "" }, { "docid": "6663dae7ead8620ce87706778c001846", "score": "0.75483567", "text": "def expired?\n ((@createTime + @cacheLifetimeSec) <=> Time.now) == -1\n end", "title": "" }, { "docid": "23d32e7aa570a9b8970d6b1b4a6ff14c", "score": "0.7519827", "text": "def expired?() true end", "title": "" }, { "docid": "87b94f45b155f08b33d9702e1cb8e768", "score": "0.7497764", "text": "def expire; end", "title": "" }, { "docid": "f71caf5df19ac2de6179347b237e1c81", "score": "0.7471281", "text": "def mark_expired!\n Rails.cache.write(MEMORY_CACHE_KEY, DateTime.now)\n end", "title": "" }, { "docid": "d773d7112ff716d9258ffcef52b56af2", "score": "0.74211824", "text": "def expired\n end", "title": "" }, { "docid": "f22f8ff502ed22d63b0d856401ae7b89", "score": "0.7418973", "text": "def expire!; end", "title": "" }, { "docid": "f22f8ff502ed22d63b0d856401ae7b89", "score": "0.7418973", "text": "def expire!; end", "title": "" }, { "docid": "fc564175c49b676d261f83d254aaf153", "score": "0.741227", "text": "def expire_cache\n update_all ['parsed_content_cache = ?', {}] rescue nil\n end", "title": "" }, { "docid": "42dd106036ddbc014dac39652229a806", "score": "0.7378425", "text": "def expire_cache\r\n Rails.cache.delete self.name\r\n end", "title": "" }, { "docid": "29483bad0a1b7fc87bb7e882043ae040", "score": "0.7358408", "text": "def expire_cache\n Moebooru::CacheHelper.increment_version\n end", "title": "" }, { "docid": "1d3d2ca46ff8a639324f8290b9f1636d", "score": "0.7351009", "text": "def expired?(key)\n return true unless @hash_storage[key] != nil\n exp_time = @hash_storage[key].exp_time\n return false if exp_time == 0 # when zero, cache never expires\n expired = !exp_time.nil? && @hash_storage[key].exp_time <= Time.now.to_i\n end", "title": "" }, { "docid": "e4b844a19258d4f6820740a197569b80", "score": "0.73446584", "text": "def expire_all\n CacheModel.expire_all\n Merb.logger.info(\"cache: expired all\")\n true\n end", "title": "" }, { "docid": "0c03cf0b57d91750d0e0ced00e7dfb25", "score": "0.734305", "text": "def isCacheExpired\n if(File.exist?(@cache_file_name))\n file_create_time = File.mtime(@cache_file_name)\n current_time = Time.now\n #Find out time difference in minutes\n time_difference = (current_time-file_create_time)/60\n #puts time_difference \n #Expiry is 25 minutes\n return true if(time_difference > CACHE_EXPIRY)\n end\n return false\n end", "title": "" }, { "docid": "8bcd1970f6b7107678d3d94a079ecf3e", "score": "0.734238", "text": "def expire_cache!\n raise NotImplementedError\n end", "title": "" }, { "docid": "b933fd6e7e48489ab13997798c13c04b", "score": "0.7328759", "text": "def expired?\r\n self.expires_at < Time.now\r\n end", "title": "" }, { "docid": "5548621d2cdd8315e9e991a070c34c23", "score": "0.72999465", "text": "def expired?\n Time.now.to_i >= @expires_at - 60\n end", "title": "" }, { "docid": "1f27f764e378a8d749a17d1c2860c92e", "score": "0.7290878", "text": "def cache_expiry\n\t\t\t@cache_expiry || 60 * 10\n \tend", "title": "" }, { "docid": "aa410b22c29f3dcc44409fa7a8646630", "score": "0.7282907", "text": "def expired?\r\n Time.now.to_i > expires\r\n end", "title": "" }, { "docid": "d746ee5621006828046bdd5abaca6673", "score": "0.724708", "text": "def expired?\n self.expire_at < Time.now\n end", "title": "" }, { "docid": "ae313f193fa1679f322e0fcfa5048af0", "score": "0.7243643", "text": "def expire_cache!\n @snapshot = nil\n end", "title": "" }, { "docid": "d139b44f036218a6b78d0fd3f68db585", "score": "0.72392476", "text": "def list_cache_expired?\n @list_cached_at.nil? || (Time.now >= @list_cached_at + @cache_expiry_list)\n rescue StandardError\n true\n end", "title": "" }, { "docid": "377ca17d336a3d8a9f3367c4b9b95bd4", "score": "0.7239115", "text": "def expired?\n @expires >= Time.now\n end", "title": "" }, { "docid": "d1805954c81dd4889f9a32a4ef36e8b6", "score": "0.72284555", "text": "def is_cache_expired?(name, is_key = false)\n key = is_key ? fragment_cache_key(name) : name\n return (!@@cache_timeout_values.has_key?(key)) || (@@cache_timeout_values[key] < Time.now)\n end", "title": "" }, { "docid": "e1b9c9161b67462634636cd0cc614ff4", "score": "0.72171926", "text": "def expired?\n\t\texpires_at < Time.now\n\tend", "title": "" }, { "docid": "87772f1d8265b9166c7b61ca27ef7ff0", "score": "0.7208113", "text": "def expired?\n self.expire_at < Time.now\n end", "title": "" }, { "docid": "87772f1d8265b9166c7b61ca27ef7ff0", "score": "0.7208113", "text": "def expired?\n self.expire_at < Time.now\n end", "title": "" }, { "docid": "aca46ed7b597705441223b6c39a906f1", "score": "0.72039545", "text": "def invalidated?\n cache.cache_version != cache_version\n end", "title": "" }, { "docid": "89d345bcbf49d3e39472c4adaac56b64", "score": "0.7200987", "text": "def expired?\n Time.now > self.expires_on\n end", "title": "" }, { "docid": "3fdccb3bb6d0cb858a19c4ec17d4e8d9", "score": "0.71747005", "text": "def expired?\n false\n end", "title": "" }, { "docid": "09fd689adac7d31bcadb488de6f3c052", "score": "0.71532655", "text": "def expired?\n end", "title": "" }, { "docid": "8dd5db44312de53feb7645da0b1e20b2", "score": "0.7153071", "text": "def expired?\n @expires_at < now\n end", "title": "" }, { "docid": "eb32056ffb317116cc06f1e4bfb90046", "score": "0.7120873", "text": "def expired?\n true\n end", "title": "" }, { "docid": "2ce9bdbb52770345e455ae5cdd7b1fba", "score": "0.71098924", "text": "def expiration; end", "title": "" }, { "docid": "48adfe7b2afc34a4d03f5681c2578dfe", "score": "0.710982", "text": "def manage_cache_expires_at\n self.set_cache_expires_at if self.cache_expires_at && self.cache_expires_at < Time.now\n end", "title": "" }, { "docid": "ede1fc3326fa331e481e0dca216e6cec", "score": "0.7104448", "text": "def expired?\n DateTime.now > @expires\n end", "title": "" }, { "docid": "88164881611f13e23b8f9c90fbc6a016", "score": "0.7102951", "text": "def evict_expired\n # Since data_expires_at keys are ordered by the age of the cache entry, we can bail out of the\n # loop as soon as we find the first unexpired key.\n @data_expires_at.each do |key, expiration|\n (expiration < Time.now.to_f) ? evict(key) : return\n end\n end", "title": "" }, { "docid": "45b86e0c833ae768cfb41390b9078709", "score": "0.7099749", "text": "def expired?\n self.expires_at.to_datetime < DateTime.now\n end", "title": "" }, { "docid": "89c7d14bac392d3bf77c9aa397390d56", "score": "0.70989627", "text": "def expired?\n\n end", "title": "" }, { "docid": "89c7d14bac392d3bf77c9aa397390d56", "score": "0.70989627", "text": "def expired?\n\n end", "title": "" }, { "docid": "89c7d14bac392d3bf77c9aa397390d56", "score": "0.70989627", "text": "def expired?\n\n end", "title": "" }, { "docid": "89c7d14bac392d3bf77c9aa397390d56", "score": "0.70989627", "text": "def expired?\n\n end", "title": "" }, { "docid": "89c7d14bac392d3bf77c9aa397390d56", "score": "0.70989627", "text": "def expired?\n\n end", "title": "" }, { "docid": "9c689a66b68edd5b369427847d55130e", "score": "0.70829475", "text": "def expired?\n expires && Time.current > expires || false\n end", "title": "" }, { "docid": "1a340e2d6a2eae2d13507fc079038ca3", "score": "0.70773596", "text": "def expire\n\t\tself.log.debug \"looking for expired entries in %s\" % [self.name]\n\t\tsuper\n\tend", "title": "" }, { "docid": "f96a6c10ce0fd1602032c24398c910d8", "score": "0.70771945", "text": "def cache_expiry_period\n nil\n end", "title": "" }, { "docid": "556692be65e8a5999fab31f5549dfa3b", "score": "0.70672286", "text": "def expired?\n expired\n end", "title": "" }, { "docid": "c6eca90aa8a771b260767922be14e3b6", "score": "0.7065233", "text": "def expired?\n Time.now > @created + ttl\n end", "title": "" }, { "docid": "c6eca90aa8a771b260767922be14e3b6", "score": "0.7065233", "text": "def expired?\n Time.now > @created + ttl\n end", "title": "" }, { "docid": "40f32d6fa8fb02b962a942650dc7a92d", "score": "0.7062522", "text": "def expired?\n if header.cache_control and m_age_str = header.cache_control.find{|cc| /^max-age=/ === cc}\n return current_age > m_age_str[/\\d+/].to_i\n elsif header.expires\n return Time.httpdate(header.expires) < Time.now\n end\n\n false\n end", "title": "" }, { "docid": "a9d422b178e71a38e6eedfa17d0916f7", "score": "0.7062457", "text": "def is_expired?\n return self.expires_at <= Time.now\n end", "title": "" }, { "docid": "3447fb1e68b9e4a5c3a7c08bcd5933a9", "score": "0.7059221", "text": "def expired?\n Time.now > expires_at\n end", "title": "" }, { "docid": "cdd38f1edd16b21ce8396a2dbc3aac78", "score": "0.7045775", "text": "def expired?\n if Time.now.utc>expires_at\n deactivate!\n return true \n end\n false\n end", "title": "" }, { "docid": "46a9191d16822872724489d82a75659d", "score": "0.7030953", "text": "def expired!\n self.expires_at = Time.now.utc\n self.save!\n end", "title": "" }, { "docid": "46a9191d16822872724489d82a75659d", "score": "0.7030953", "text": "def expired!\n self.expires_at = Time.now.utc\n self.save!\n end", "title": "" }, { "docid": "46a9191d16822872724489d82a75659d", "score": "0.7030953", "text": "def expired!\n self.expires_at = Time.now.utc\n self.save!\n end", "title": "" }, { "docid": "73c5eb504f94fdf284a29907171834e8", "score": "0.70274436", "text": "def invalidate\n @cache = {}\n end", "title": "" }, { "docid": "3530a3a4f49757cfe984eb6988a800f8", "score": "0.7013316", "text": "def get_cache_expiry\n fail 'sub class to implement'\n end", "title": "" }, { "docid": "42b5d93d84b4c5bff91049bba1d3cfba", "score": "0.7009261", "text": "def expired?\n self.expires_on? and self.expires_on < Time.now\n end", "title": "" }, { "docid": "30e3f1a26e0647879f67dedc0f385cc3", "score": "0.70010483", "text": "def never_cache\n expires_now\n end", "title": "" }, { "docid": "26be3543fd4e1700d900f20b565a36ef", "score": "0.70008665", "text": "def expired?\n Time.now > self.created_at+self.ttl\n end", "title": "" }, { "docid": "58783a0af50adb87a8b1648315996640", "score": "0.7000428", "text": "def expired?\n expires? and Time.zone.now >= self.expires_at\n end", "title": "" }, { "docid": "f90f1eadeb080749a39057cdb84b18a6", "score": "0.6998071", "text": "def expired?\n Time.zone.now >= expires_at\n end", "title": "" }, { "docid": "f90f1eadeb080749a39057cdb84b18a6", "score": "0.6998071", "text": "def expired?\n Time.zone.now >= expires_at\n end", "title": "" }, { "docid": "1126aa04b60a00701f748dfb577520e9", "score": "0.6993911", "text": "def expired?\n Time.now > expiration if expiration\n end", "title": "" }, { "docid": "f6ac1a638d2c9bf78aab05de4ae08f3f", "score": "0.6991724", "text": "def expired?\n expires_at < Time.now\n end", "title": "" }, { "docid": "a542f582d9ca7ac2b29c23eddcea6a4d", "score": "0.69888455", "text": "def expired?\n @expires_in && @expires_in < Time.now\n end", "title": "" }, { "docid": "d1410afa3c96dfa877f36caf9b3f58d2", "score": "0.69887066", "text": "def expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "title": "" }, { "docid": "987174ba0d83f6feec89bf4520370cba", "score": "0.69863707", "text": "def dont_cache\n expires_now\n end", "title": "" }, { "docid": "79ac1d5c70c134ab94c3b4291561a8e4", "score": "0.69821805", "text": "def expired?\n expires_in <= 0\n end", "title": "" }, { "docid": "5f772c05ca4abf60a02c021d439a5bb9", "score": "0.69820607", "text": "def expired?\n recycle = @entry.storage.directory.configuration[:recycle]\n if recycle.kind_of? FalseClass\n result = false\n else\n recycle = recycle.to_sym\n end\n \n if recycle and (recycle == :remove) or (recycle == :mail)\n result = self.expiration_at < Time::now\n end\n \n return result\n end", "title": "" }, { "docid": "24f249a6531bd1511c7205e03d71ee3d", "score": "0.69689", "text": "def expires; end", "title": "" }, { "docid": "24f249a6531bd1511c7205e03d71ee3d", "score": "0.69689", "text": "def expires; end", "title": "" }, { "docid": "24f249a6531bd1511c7205e03d71ee3d", "score": "0.69689", "text": "def expires; end", "title": "" }, { "docid": "24f249a6531bd1511c7205e03d71ee3d", "score": "0.69689", "text": "def expires; end", "title": "" }, { "docid": "a9403556699746743ce4c9da232e8718", "score": "0.69667315", "text": "def expired?\n Time.now.to_i > expire_at\n end", "title": "" }, { "docid": "06a9860a00052cf704e94cc4dd685155", "score": "0.6951613", "text": "def invalidate\n __cache__.delete\n end", "title": "" }, { "docid": "83e2b7ffa5de88aa7033512c7721fa2b", "score": "0.69440544", "text": "def flush_expired \n if gc_last && gc_time && gc_last+gc_time <= Time.now \n flush_expired!\n end\n end", "title": "" }, { "docid": "9e005aba8c70ed415be5f41fdf83b88d", "score": "0.6942487", "text": "def expired?\n @expires_at && @expires_at < Time.now\n end", "title": "" }, { "docid": "bb4abd1f7562248016f29ea7e5401cc0", "score": "0.6941887", "text": "def invalidate_garner_caches\n _invalidate\n true\n end", "title": "" }, { "docid": "bb4abd1f7562248016f29ea7e5401cc0", "score": "0.6941887", "text": "def invalidate_garner_caches\n _invalidate\n true\n end", "title": "" }, { "docid": "25221476ab0440d07a608a4d8323443d", "score": "0.69379", "text": "def expire\n Rails.cache.delete(self.namespace)\n end", "title": "" }, { "docid": "b9c2dea561647ff20928aa8cd512d659", "score": "0.6937644", "text": "def expired?(options = {})\n self.class.expired?(test_cache_url(options))\n end", "title": "" }, { "docid": "b9c2dea561647ff20928aa8cd512d659", "score": "0.6937644", "text": "def expired?(options = {})\n self.class.expired?(test_cache_url(options))\n end", "title": "" }, { "docid": "d4a13f2fa38cbbf1f9cbb067250587a0", "score": "0.69373417", "text": "def refresh\n return false unless cache_expired?\n\n fetch\n true\n end", "title": "" }, { "docid": "3002bf33d2cd45f55155e3c13a352b36", "score": "0.69322795", "text": "def invalidate\n @cache_version = -1\n end", "title": "" }, { "docid": "f1af163beaa538304aa555cb5e693de2", "score": "0.6914343", "text": "def remove_expired_cache\n while @cleaning_cache\n sleep(1) # default 5 seconds\n # --- Searching Expired Cache ---\n @hash_storage.each do |key, cache|\n if expired?(key)\n remove_entry(key)\n puts \"Removing #{cache} with key: #{key}\"\n end\n end\n @cleaning_cache = false\n # puts 'Cache Cleaned'\n end\n end", "title": "" }, { "docid": "80f9152ee305595a22bd5e6c925c336e", "score": "0.69141465", "text": "def expire_match(key)\n CacheModel.expire_match(key)\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "title": "" }, { "docid": "e098825289251e17c542563168fc1d44", "score": "0.691295", "text": "def invalidate\n @cache = {}\n end", "title": "" }, { "docid": "c1376836fc2a636c99eb162ee9e11ddc", "score": "0.69052386", "text": "def has_expired\n return Time.now > @expires_at\n end", "title": "" }, { "docid": "2ddb79024c76f71074d4b42eaaa29f3b", "score": "0.6898167", "text": "def expire!\n @monitor.synchronize do\n check_expired(Time.now.to_f)\n self\n end\n end", "title": "" }, { "docid": "98a294781bb96e4264e68bc4cf23438e", "score": "0.68938816", "text": "def expired?\n return false if @expiry == NEVER_EXPIRES \n @expiry < Time.now.to_i\n end", "title": "" }, { "docid": "b811c0e070d3092187fbce75a0ab6c61", "score": "0.6884062", "text": "def get_cache_expiry\n memcache_key_object.expiry\n end", "title": "" } ]
77199746fe481289a07a05728c4be404
GET /word_srcs/1 GET /word_srcs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "38320436e342f366d053f05f7a95ad6a", "score": "0.71973705", "text": "def index\n @word_srcs = WordSrc.all\n end", "title": "" }, { "docid": "477fc772461dce29090df58215c03ce0", "score": "0.6183881", "text": "def show\n curWord = Word.find_by_word(params[:id])\n respond_to do |format|\n format.json { render json: curWord }\n end\n end", "title": "" }, { "docid": "a72e2832b35e1bcae1c38bf4bdb06fd2", "score": "0.60341626", "text": "def get_wordle_data(uri)\n filename = \"#{Rails.root}/tmp/vivo/wordle/#{uuid_from_uri(uri)}.json\"\n file = File.read(filename)\n data = JSON.parse(file)\n data[\"results\"][\"bindings\"]\n end", "title": "" }, { "docid": "72844c36db8032a674e1a4c5a29fcd95", "score": "0.5890699", "text": "def create\n @word_src = WordSrc.new(word_src_params)\n\n respond_to do |format|\n if @word_src.save\n format.html { redirect_to @word_src, notice: 'Word src was successfully created.' }\n format.json { render :show, status: :created, location: @word_src }\n else\n format.html { render :new }\n format.json { render json: @word_src.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d36536a84efe23d014fd7d8fdcd156bc", "score": "0.5868236", "text": "def show\n respond_to do |format|\n format.html\n format.json { render json: @base_word}\n end\n end", "title": "" }, { "docid": "e1e8043b9b258ce3befe105022e268cd", "score": "0.5821503", "text": "def set_word_src\n @word_src = WordSrc.find(params[:id])\n end", "title": "" }, { "docid": "ee678c9243f91e52ab4e8209cc796843", "score": "0.57858884", "text": "def show\n @words = @word_list.words\n respond_to do |format|\n format.html {}\n format.json {\n @words_collection = @words.map{|w| {english_word: w.english_word, value: w.value}}\n render json: {words: @words_collection}\n }\n end\n end", "title": "" }, { "docid": "0b110383ae1431d61e73944168f01de7", "score": "0.57738197", "text": "def show\n @word_core = WordCore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_core }\n end\n end", "title": "" }, { "docid": "be1d47793e80db1a474360bbcf6c06cd", "score": "0.5758592", "text": "def call(word)\n url = \"https://wagon-dictionary.herokuapp.com/#{word}\"\n res = open(url).read\n check = JSON.parse(res)\n check[\"found\"]\n end", "title": "" }, { "docid": "8e8d2a8afb4957927a0116a645b97308", "score": "0.57427937", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "8e8d2a8afb4957927a0116a645b97308", "score": "0.57427937", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "8e8d2a8afb4957927a0116a645b97308", "score": "0.57427937", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "8e8d2a8afb4957927a0116a645b97308", "score": "0.57427937", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "bc784ff783fbcda753195eec355c4daf", "score": "0.5740591", "text": "def show\n @word_count = WordCount.where(:word => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_count }\n end\n end", "title": "" }, { "docid": "7edc635dd4dc704aa166c6692d17ccf7", "score": "0.57180446", "text": "def show\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_list }\n end\n end", "title": "" }, { "docid": "cf3d7e91f91a461422c12ca60fb7f510", "score": "0.571577", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @word }\n end\n end", "title": "" }, { "docid": "cebb7bfc627776e5864a20c111c893c7", "score": "0.570639", "text": "def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @related_words = RelatedWord.where(word_id: word_id.ids)\n render json:{\n id: @related_words\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end", "title": "" }, { "docid": "b9b4961591c518be04a7b54d453b51d9", "score": "0.5694777", "text": "def show\n @crossword_solution = CrosswordSolution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crossword_solution }\n end\n end", "title": "" }, { "docid": "93d6904714a17e514e740b9cc085f6a6", "score": "0.56895477", "text": "def word_library \n target_lang = params[:target_lang]\n data = Hash.new\n for tl in target_lang\n db = Import.select(\"word_id, source_word, target_lang, target_word, target_shortname\").where(:target_lang => tl)\n data[tl] = db\n end\n render :json => data\n return\n end", "title": "" }, { "docid": "03b669bbe55173aa2747f9e2b34bd3b1", "score": "0.5669764", "text": "def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "df27a4aad6423c1c48fe1c07fde1acd7", "score": "0.56680167", "text": "def show\n @word_set = WordSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_set }\n end\n end", "title": "" }, { "docid": "27a5827ca27166d1baa0715f378e95bd", "score": "0.5651533", "text": "def study\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # study.html.erb\n format.json { render json: @word_list }\n end\n end", "title": "" }, { "docid": "6ef27a3b5b3eb564a61fbac721ab6c12", "score": "0.5633483", "text": "def words\n response = Wordnik.get(\"/wordList.json/#{self.permalink_id}/words\", {:headers=>self.client.api_headers})\n return response\n end", "title": "" }, { "docid": "52fae7d58689ac2eb08f1ead296df964", "score": "0.5631101", "text": "def show\n @wordy = Wordy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wordy }\n end\n end", "title": "" }, { "docid": "a7749153a5fbd736e35d65a56001b745", "score": "0.55909115", "text": "def get_word_list\n\n text_id = params[:text_id]\n \n # => If text id is not given in the parameter of the url, then\n # => return null\n if text_id != nil && text_id.numeric?\n \n text = Text.find(text_id.to_i)\n \n @words = text.words\n \n else\n \n # @text = nil\n # @words = Word.find(:all)\n @words = nil\n \n end\n \n respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @texts }\n # format.json { render json: @words }\n format.html { render json: @words }\n end\n \n end", "title": "" }, { "docid": "67d936208fdaf16dcf7f860f8324929b", "score": "0.55907756", "text": "def index\n @entries = SourceGlossaryEntry.eager_load(:locale_glossary_entries).sort_by { |e| e.source_copy.downcase }\n\n respond_with @entries do |format|\n format.json { render json: decorate(@entries).to_json }\n end\n end", "title": "" }, { "docid": "bb5fd01f5fcdf57732750629c247db3c", "score": "0.55445814", "text": "def get_word_vi()\n @data = Vietnamese.find(params[:id]);\n @data.word_vietnamese [email protected]_vietnamese.force_encoding(\"UTF-8\")\n @data.word_japanese [email protected]_japanese.force_encoding(\"UTF-8\")\n @arr_translate = @data.word_japanese.split(';')\n @example =encode(Example.searchVi(@data.word_vietnamese))\n @arr = [@data,@arr_translate,@example]\n respond_to do |format|\n format.json { render json: @arr}\n end\n end", "title": "" }, { "docid": "eb0fa0d4b4098fd781ba259ffef721ac", "score": "0.5539682", "text": "def show\n @my_word = MyWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_word }\n end\n end", "title": "" }, { "docid": "a865ae8fbc7be576806e98138f5c2151", "score": "0.55181503", "text": "def index\n if params[:word] and !params[:word][:name].blank?\n @words = Word.where [\"name LIKE :name\", { :name => \"%#{params[:word][:name]}%\"}]\n else\n @words = Word.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @words }\n end\n end", "title": "" }, { "docid": "e023c5a315f28c7604563d242c1984b1", "score": "0.55112946", "text": "def show\n word=UserWord.find(params[:id])\n render :json => word\n end", "title": "" }, { "docid": "0c1934c34b8e33530ca4ca8e07025848", "score": "0.5504035", "text": "def lookup_word\n word = params[\"word\"].to_s.downcase\n include_pronounce = params[\"include_pronounce\"]\n\n json = Wordnik.word.get_definitions(\"#{word}\", :use_canonical => true)\n\n # if we also want to include the pronounciation of that word we can do so this way\n if include_pronounce\n\n # lookup pronounciation as a separate call to wordnik\n pronounce = Wordnik.word.get_text_pronunciations(word)\n\n # merge the response into the existing json document if json isn't empty, meaning the word wasn't found\n json[0][:pronounciation] = pronounce[0][\"raw\"] unless json.empty?\n\n end\n\n #Rails.logger.debug json.inspect\n\n # send the definitions back to the caller as json\n respond_to do |format|\n format.json { render :json => json }\n end\n end", "title": "" }, { "docid": "3da7603bb2ba07408508e661b70648ff", "score": "0.5491126", "text": "def update\n respond_to do |format|\n if @word_src.update(word_src_params)\n format.html { redirect_to @word_src, notice: 'Word src was successfully updated.' }\n format.json { render :show, status: :ok, location: @word_src }\n else\n format.html { render :edit }\n format.json { render json: @word_src.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6089458e78f06c9844869e24015931b", "score": "0.54890054", "text": "def show\n @text = Text.find(params[:id])\n\n @words = @text.words\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text }\n # format.json { render :json => @text.to_json()}\n end\n end", "title": "" }, { "docid": "23315683a9715a3238b97eaf3ded7db6", "score": "0.5481849", "text": "def index\n @words = Word.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_meanings }\n end\n end", "title": "" }, { "docid": "aefc3a860043e26600da1b4259de3a35", "score": "0.54798716", "text": "def index\n firt_letter = params[:firt_letter] ? params[:firt_letter] : 'a'\n @words = Word.starting_with(firt_letter)\n @json = @words.map{ |word| word.name }\n end", "title": "" }, { "docid": "595df1f0d15bb28a83d9ff8e0669299c", "score": "0.54713136", "text": "def search\n @words = Word.find_with params\n\n if @words.nil?\n render :json => {}\n else\n @words.each do |word|\n self.addConnectionDetailsTo word\n end\n render :json => @words, :include => [:language, :translations]\n end\n end", "title": "" }, { "docid": "e16e1c18a005f452f11f3ccef6b8302b", "score": "0.5456722", "text": "def show\n @wordup = Wordup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wordup }\n end\n end", "title": "" }, { "docid": "f5c4d23f5a5c331ce5ffb2c0303c10bf", "score": "0.54558736", "text": "def get_word(input)\n\n url = URI(\"https://wordsapiv1.p.rapidapi.com/words/#{input}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url) \n request[\"x-rapidapi-host\"] = 'wordsapiv1.p.rapidapi.com'\n request[\"x-rapidapi-key\"] = ENV['PROJECT_API_KEY'] #api key\n \n response = http.request(request) #save req to repsonse\n # puts response.body.class\n my_resp = JSON.parse(response.body) #parse json response to hash\n\n if my_resp[\"word\"] == input #return true if word exist\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "cd41ccd5729681a21d62372cc25fd837", "score": "0.54556966", "text": "def show\n @lsa_word = LsaWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_word }\n end\n end", "title": "" }, { "docid": "5b7e64b156a4fe80ae21a3da8e8be63f", "score": "0.54493433", "text": "def get_english(json_file, client, word, misspelled_word)\n list = []\n json_file = json_file['results']\n json_file.each do |status|\n if status['text'][0..1] == \"RT\"\n next\n elsif status['text'].include?(\" #{misspelled_word} \")\n post_correction(status['from_user'] ,word, client)\n end\n end\n mark_end_point(json_file, @start_point, misspelled_word)\n return list\nend", "title": "" }, { "docid": "51ad864a8626d6d37f1a8de5f2520ad7", "score": "0.53837335", "text": "def wordle_data\n if params[:id]\n file = \"#{Rails.root}/tmp/vivo/wordle_data/#{params[:id]}.json\"\n end\n respond_to do |format|\n format.json { send_file file, :type => 'text/json', :disposition => 'inline' }\n format.js { send_file file, :type => 'text/json', :disposition => 'inline' }\n end\n end", "title": "" }, { "docid": "7bdf1adb11c46014392cae8481269214", "score": "0.53826326", "text": "def show\n @sphinx = Sphinx.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sphinx }\n end\n end", "title": "" }, { "docid": "9bfff622a8b85db1042c92de07cb7583", "score": "0.5376958", "text": "def show\n @word = Word.find(params[:id])\n \n if @word != nil && @word.text_id > 0\n \n @text = Text.find(@word.text_id)\n \n else\n \n @text = nil\n \n end\n \n \n \n # @text = Text.find(@word.text_id)\n \n # => B13-CHANGE-5\n \n \n # msg = \"(\" + __FILE__ + \":\" + __LINE__.to_s + \") \" \n # # \"Socket.gethostname=\" + Socket.gethostname +\n # # \"/\" + \"requset.protocol=\" + requset.protocol\n# \n # ENV.each { |key, value|\n # msg += \"#{key} - #{value} <br/> \"\n # }\n# \n # logout(msg)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "24715a8a413abeb802d66705678d7b56", "score": "0.5368136", "text": "def get_word(difficulty)\n url = \"https://hangmanwords.herokuapp.com/api/words?difficulty=#{difficulty}&wordLength=10\"\n @response = HTTParty.get(url).shuffle.sample\n return @response['word']\n end", "title": "" }, { "docid": "58e23778e2195e7502915dba41bfb135", "score": "0.5358585", "text": "def index\n @api_docs_json_file = API_DOC_FILE\n end", "title": "" }, { "docid": "bf7e24f0693a963f41a3f666d0b1287a", "score": "0.53486574", "text": "def show\n render json: @spell\n end", "title": "" }, { "docid": "91774373cbb6f7542475ca6b4028223e", "score": "0.5333695", "text": "def english_word(word)\n response = URI.open(\"https://wagon-dictionary.herokuapp.com/#{word}\")\n json = JSON.parse(response.read)\n json['found']\n end", "title": "" }, { "docid": "3eccda93ca9dad759640e2fc6113b055", "score": "0.53153074", "text": "def define(word) \n\n\t\t# Requirements\n\t\tinclude HTTParty\n\n\t\t# Local scope varibale\n\t\tdata = []\n\t\t # Set variables\n\t\t base_url = \"https://www.googleapis.com/scribe/v1/research?key=AIzaSyDqVYORLCUXxSv7zneerIgC2UYMnxvPeqQ&dataset=dictionary&dictionaryLanguage=en&query=\"\n\t\t # Get the payload\n\t\t response = HTTParty.get(\"#{base_url}\" + \"#{word}\")\n\t\t \n\t\t # Catch response errors\n\t\t if response[\"data\"] == nil\n\t\t error = { error: true, word: word }\n\t\t data.push(error) \n\t\t else\n\t\t # Push response to data array\n\t\t data.push(response)\n\t\t end\n\t\treturn data\n\tend", "title": "" }, { "docid": "684ebcf51dd9e310c3a9d6a583148f8b", "score": "0.5312734", "text": "def destroy\n @word_src.destroy\n respond_to do |format|\n format.html { redirect_to word_srcs_url, notice: 'Word src was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4573029e7640ec8c3173945e0b175f30", "score": "0.5312265", "text": "def index\n @words = Word.all\n respond_to do |format|\n format.html\n format.json\n format.xml { render :xml => @words, location: @word }\n format.text\n format.any { render :text => \"Invalid format\", :status => :not_acceptable }\n end\n end", "title": "" }, { "docid": "47aa238b94a2fa0b50636358e59924be", "score": "0.52893794", "text": "def new\n @objective = Objective.find(params[:id])\n @word = @objective.words.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "6e488cdaeda2c621e8b5fe756ab1d58a", "score": "0.52882385", "text": "def word_browser\n @sentence = Sentence.find(params[:id])\n\n render(:partial => 'word_browser', :locals => {:words => @sentence.words})\n end", "title": "" }, { "docid": "8bb9eb30ea0df487749e350783c00e58", "score": "0.52859104", "text": "def show\n @stopword = Stopword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stopword }\n end\n end", "title": "" }, { "docid": "609409c16f794eae1b8eea5d774632e3", "score": "0.52793324", "text": "def show\n @word = Word.find(params[:id])\n self.addConnectionDetailsTo @word\n respond_with @word, :include => [:language, :translations]\n end", "title": "" }, { "docid": "d6d71ce8e2543b0d108c146bbe09d32f", "score": "0.5270874", "text": "def index\n @word_banks = WordBank.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_banks }\n end\n \n end", "title": "" }, { "docid": "9d182ab17b994d54b5972ffb7de8e25b", "score": "0.52583474", "text": "def wordle\n set_title('Word cloud (Wordle) display of abstracts')\n set_json_callback(\"../d3/#{params[:id]}/wordle_data.js\")\n respond_to do |format|\n format.html { render layout: 'vivo' }\n format.json { render layout: false, text: '' }\n end\n end", "title": "" }, { "docid": "52b1839821bad930d92fb1f41ff6d36d", "score": "0.52506185", "text": "def get_random_words url, params\n uri = URI.parse url\n uri.query = URI.encode_www_form params\n body = Net::HTTP.get uri\n json = JSON.parse body\n words = json.map { |x| x['word'] }\n words.shuffle\n end", "title": "" }, { "docid": "ee0798591b8de44f097f999dd0bd9be3", "score": "0.52342325", "text": "def show\n @key_word = KeyWord.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_word }\n end\n end", "title": "" }, { "docid": "d2fcefbc88fc47e8851235087e76fa1f", "score": "0.52332383", "text": "def show\n @wword = Wword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wword }\n end\n end", "title": "" }, { "docid": "3fac9b89fb45845892b6014263e2c29c", "score": "0.5232785", "text": "def show\n @sentence = Sentence.find(params[:id])\n render json: @sentence\n end", "title": "" }, { "docid": "e6fe89e3f783c1686414a73299a8fb97", "score": "0.522541", "text": "def search\n #filtrage pour la page d'accueil\n @words = Word.all(:order => 'created_at DESC', :limit => 20)\n @title = \"Last words\"\n \n respond_to do |format|\n format.html { render :action => :index } \n format.json { render :json => @words }\n end\n end", "title": "" }, { "docid": "926667dab1fb07bbd042f8964ceee60b", "score": "0.52242315", "text": "def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word.id = rand(127...168)\n @word = Word.find(word_id)\n render json: {\n id: @word\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end", "title": "" }, { "docid": "829c535f98ecd90f17582d6290f5247b", "score": "0.52048355", "text": "def monolingual_definition(word_to_define)\n uri = \"http://en.wiktionary.org/w/api.php?action=parse&prop=wikitext&page=#{word_to_define}&format=json\"\n encoded_uri = URI::encode(uri)\n response = HTTParty.get(encoded_uri)\n binding.pry\n\n \n\n # decode_response = ActiveSupport::JSON.decode(response)\n return response[\"parse\"][\"wikitext\"][\"*\"].split(\"\\n\")\nend", "title": "" }, { "docid": "987f8aa5856e3476c5f7e5d32e05f252", "score": "0.5204695", "text": "def index\n @allUrls = UrlShorten.all\n json_response(@allUrls)\n\n end", "title": "" }, { "docid": "91e8341e7222bfe9178734ee162bc476", "score": "0.52035594", "text": "def index\n @verbs = @language.verbs.includes(:coding_frame, :meanings).all\n @orig_script = @verbs.any?{|v| v.original_script}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbs }\n end\n end", "title": "" }, { "docid": "e4e75a9aff2209868155f27cdbe4da08", "score": "0.519224", "text": "def get_word_ja()\n @data = Japanese.find(params[:id]);\n @data.word_vietnamese [email protected]_vietnamese.force_encoding(\"UTF-8\")\n @data.word_japanese [email protected]_japanese.force_encoding(\"UTF-8\")\n @arr_translate = @data.word_vietnamese.split(';')\n @example =encode(Example.searchJa(@data.word_japanese))\n @arr = [@data,@arr_translate,@example]\n respond_to do |format|\n format.json { render json: @arr}\n end\n end", "title": "" }, { "docid": "ae013404b7d5d804ce3d9bd8a70e5b11", "score": "0.51883364", "text": "def index\n @dictionaries = (params[:dictionaries].present? \\\n ? Dictionary.where(id: params[:dictionaries])\n : Dictionary).includes([:language, :source_language, :target_language]).all.sort_by {|d| d.title }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dictionaries }\n format.json { \n case params[:data] \n when \"langs\" \n hsh = Dictionary.langs_hash_for(@dictionaries)\n hsh = hsh.collect do |categ, langs| \n [categ, langs.collect {|lang| { tab: lang.to_s, code: lang.iso_639_code, underscore_code: lang.iso_639_code.underscore }}]\n end\n \n render json: Hash[hsh]\n else render nothing: true, status: 403\n end\n }\n end\n end", "title": "" }, { "docid": "c33b11842bb157bb14e8e788e16051d8", "score": "0.5166424", "text": "def index\n @dictionaries = (if params[:dictionaries].present?\n Dictionary.where(id: params[:dictionaries])\n else\n Dictionary\n end).includes(%i[language source_language target_language]).sort_by(&:title)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @dictionaries }\n format.json do\n case params[:data]\n when 'langs'\n hsh = Dictionary.langs_hash_for(@dictionaries)\n hsh = hsh.collect do |categ, langs|\n [categ, langs.collect do |lang|\n { tab: lang.to_s, code: lang.iso_639_code, underscore_code: lang.iso_639_code.underscore }\n end]\n end\n\n render json: Hash[hsh]\n else render nothing: true, status: 403\n end\n end\n end\n end", "title": "" }, { "docid": "0da58524f4c6753360d79dc8c08c5746", "score": "0.51576215", "text": "def index\n @word_properties = WordProperty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_properties }\n end\n end", "title": "" }, { "docid": "5dcabb1a341271411c59aa287f3bc05c", "score": "0.5153492", "text": "def index\n @img_words = ImgWord.all\n end", "title": "" }, { "docid": "6b138e3948293d3c565f4b175221ea53", "score": "0.51490414", "text": "def new\n @word = Word.new\n @wh = @word.word_histories.build\n @word.definitions.build\n @word.usages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end", "title": "" }, { "docid": "5fef5570401d74a26abc3d934b5f07af", "score": "0.5147576", "text": "def index\n @sentences = Sentence.all\n render json: @sentences\n end", "title": "" }, { "docid": "1a46d0f86bc3f695a8ac7eb182ccd8a0", "score": "0.51442534", "text": "def index\n @words = Word.all.order(id: :desc)\n render json: @words\n # functions, but still returns extra info\n # render json: { message: \"Words successfully returned.\", success: true, data: @words, each_serializer: WordSerializer }, status: 200\n\n # render json: { message: \"Words successfully returned.\", success: true, data: @words }, status: 200\n # render json: { message: \"Words successfully returned.\", success: true, data: @words, each_serializer: WordSerializer.new(@words) }, status: 200\n\n # render json: { message: \"Words successfully returned.\", success: true, data: WordSerializer.new(@words), each_serializer: WordSerializer }, status: 200\n end", "title": "" }, { "docid": "1a0f27b84e7b99a5abe00caeb810cfb1", "score": "0.51395935", "text": "def show\n @corpus = Corpus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus }\n end\n end", "title": "" }, { "docid": "b95026b181ca593756d9fbe8cdf560ac", "score": "0.5127265", "text": "def load_synonyms\n project_id = params[:project_id].to_i\n @project = Project.find(project_id)\n keyword = params[:word]\n keyword_object = Keyword.find_by_name(keyword)\n @keyword_synonyms = []\n if keyword_object\n @keyword_synonyms = Synonym.where(keyword_id: keyword_object.id)\n end\n render \"load_synonyms.js.erb\"\n end", "title": "" }, { "docid": "58bc16f0256bc989a4bd929c3fed9319", "score": "0.51251596", "text": "def show\n @word = Word.find(params[:id])\n end", "title": "" }, { "docid": "6930ecc347787ead9cf75ed34a5f345a", "score": "0.5124169", "text": "def show\n @tmp_word = TmpWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tmp_word }\n end\n end", "title": "" }, { "docid": "cc75de759a147e4fefb07426d2fa91dd", "score": "0.51117545", "text": "def index\n @words = Word.all\n @words.each do |word|\n self.addConnectionDetailsTo word\n end\n respond_with @words, :include => [:language, :translations]\n end", "title": "" }, { "docid": "7fe05965fc060bc12320d3bd2336c309", "score": "0.5107255", "text": "def show\n @word_meaning = WordMeaning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_meaning }\n end\n end", "title": "" }, { "docid": "59467a773391620da9da9bf2d3360b40", "score": "0.5107022", "text": "def lesson\n GitHubApi.parsed_file_contents(lesson_json_api_path)\n end", "title": "" }, { "docid": "c741e15e3be89434190fc3707827beaa", "score": "0.51041055", "text": "def index\n @docs = Doc.all\n\n render json: @docs\n end", "title": "" }, { "docid": "df3705145336c6d0e80dc95de719b7b6", "score": "0.5101636", "text": "def show\n @lower_phrase = LowerPhrase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lower_phrase }\n end\n end", "title": "" }, { "docid": "8e34721194f8a05aa097d34ef24a9ba5", "score": "0.50865614", "text": "def check(word)\n english_word = open(\"https://wagon-dictionary.herokuapp.com/#{word}\").read\n result = JSON.parse(english_word)\n result['found']\n end", "title": "" }, { "docid": "7197ba5352558f631fd8dea97ac54191", "score": "0.5085497", "text": "def index\n @wordnet_definitions = if params[:entry]\n Word.find_by_entry(params[:entry]).wordnet_definitions\n else\n WordnetDefinition.find(:all, :include => :word)\n end\n\n \n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "f9fc5c307b41d744e74b054331ae8e9e", "score": "0.5076555", "text": "def index\n @words = Word.all\n end", "title": "" }, { "docid": "bd4e2592ad301eae8c7dd34e7fee10ff", "score": "0.50744444", "text": "def get_random_word url, params\n @config['wordnik']['max_attempts'].times do\n words = get_random_words url, params\n\n word = words.detect { |w| !is_used(w) } # Get first unused word\n\n return word if !word.nil?\n end\n\n fail 'Exceeded max wordnik API attempts'\n end", "title": "" }, { "docid": "77d9ca888c73062797564c902049df87", "score": "0.5070134", "text": "def show\n @text_source = TextSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_source }\n end\n end", "title": "" }, { "docid": "7266739c0f27077c52da723f04feb2a4", "score": "0.50697124", "text": "def word_src_params\n params.require(:word_src).permit(:name, :create_person)\n end", "title": "" }, { "docid": "8eabb9f94b64e577100683a458ffd1d8", "score": "0.506528", "text": "def show\n if params[:id] == \"2\"\n @words = Word.all(:order => 'random()', :conditions => {:kind => 0}, :limit => 5)\n @words2 = Word.all(:order => 'random()', :conditions => {:kind => 1}, :limit => 5)\n @words = @words + @words2\n @words.shuffle!\n else\n @words = Word.all(:order => 'random()', :conditions => {:kind => params[:id]}, :limit => 10)\n end\n render :json => @words.to_json\n end", "title": "" }, { "docid": "f5591a0c3a19c56ebaf16c40227675ea", "score": "0.5059595", "text": "def word_of_the_day\n wotd = Wordnik.get(\"/wordoftheday.json\", {:headers=>self.api_headers})\n return wotd\n end", "title": "" }, { "docid": "0cfb83420cbe1b4a6bc33bb7616a8b2f", "score": "0.50594765", "text": "def fetch(w)\n ret = get_html(word_url(w))\n ret if definition_page? ret\n end", "title": "" }, { "docid": "e13bfaf56fac445ce7a3f28bdd63ed44", "score": "0.50589156", "text": "def index\n @stopwords = Stopword.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopwords }\n end\n end", "title": "" }, { "docid": "05ee2da9f01e3c7daf8856e2abd6739c", "score": "0.5054893", "text": "def show\n @word_property = WordProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_property }\n end\n end", "title": "" }, { "docid": "c8a07b9551d24416a1d7f55245f844b9", "score": "0.50537276", "text": "def show\n @metaword = Metaword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metaword }\n end\n end", "title": "" }, { "docid": "f6824fb6446ec4ef9d43105ffb258b42", "score": "0.5053474", "text": "def show\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vocab }\n end\n end", "title": "" }, { "docid": "21f2bbc0a61d027bc46d2e5d84d1e480", "score": "0.5053372", "text": "def index\n @user_words = Player.find(params[:player_id]).user_words\n p 'd'*90\n p @user_words\n render :json => @user_words\n end", "title": "" } ]
ef91e7660efdd196d0b556b60207219c
DELETE /comments/1 DELETE /comments/1.xml
[ { "docid": "9a443b1f001b7846b27c437bdd12b464", "score": "0.0", "text": "def destroy\n @comment = @computer.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(computer_comments_url) }\n format.xml { head :ok }\n format.js\n end\n end", "title": "" } ]
[ { "docid": "b44ce28afcd584c4b9966829c6ff230b", "score": "0.70702124", "text": "def delete_comments\n end", "title": "" }, { "docid": "34124a60af3035f72f2c565669a4e3a4", "score": "0.7065266", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "title": "" }, { "docid": "e9f69d76cdfe8367b56ee03b7d9aa9f5", "score": "0.69843125", "text": "def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end", "title": "" }, { "docid": "5e01851c0de2958aef3486b438962374", "score": "0.6935191", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b7f1aa27b7c85a8ca5905c0cca08a30e", "score": "0.6934264", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6914566", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "10dd86a5190d4ccc5fed0e9f6eb85671", "score": "0.68816155", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "909f4b2893c9ed7b5f458465fd6ca38e", "score": "0.68749785", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b4b1aac33f366cca92b51959bf93a339", "score": "0.6872061", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c1644208b4f0edcd3af3ff6525e3290f", "score": "0.6859431", "text": "def test_delete_comment\n\n comments = Comment.getAll()\n\n for comment in comments\n\n result = Comment.deleteComment(comment.commentId)\n\n assert_equal true, result\n \n end\n\n end", "title": "" }, { "docid": "a077c6c3a081ec60f21380420ea70681", "score": "0.6843346", "text": "def destroy\n @comment.destroy\n head :no_content\n end", "title": "" }, { "docid": "a077c6c3a081ec60f21380420ea70681", "score": "0.6843346", "text": "def destroy\n @comment.destroy\n head :no_content\n end", "title": "" }, { "docid": "6e6194bd3795ec644c2ea00787106c38", "score": "0.6832378", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3399906252c4a5bce0cb536054f53bf4", "score": "0.6798191", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to_commentable(@comment, false) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "29ddd808a4d00c3a741351a9987f5488", "score": "0.6784038", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(backdrafts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8ab046fe6743ad5032dfdf7671050a92", "score": "0.67768", "text": "def destroy\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(comments_url) }\n wants.xml { head :ok }\n end\n end", "title": "" }, { "docid": "34a4d5e466a3c1cd094effe32b9e2a31", "score": "0.67756766", "text": "def destroy\n @comment.destroy!\n head :no_content\n end", "title": "" }, { "docid": "4fe7bf44d9924c94134d3b6c7290a4cb", "score": "0.6770311", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ac13134bc07ae4e389449157afff58cc", "score": "0.67136323", "text": "def destroy\n @comment = @network.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n flash[:notice] = 'Comment destroyed.'\n format.html { redirect_to([:admin, @network,:comments]) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4470ad19bbe1749b793a9349351d3469", "score": "0.66871864", "text": "def destroy\n puts \">>>> Destroying a comment <<<<\"\n @comment = Comment.find(params[:id])\n puts \"found comment>>> #{@comment}\"\n @article = @comment.article\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_path(@article)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5cb914b674e71211c4efdb503e924d65", "score": "0.65924114", "text": "def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f96ff1bd14d06ad6ad98644e2dd89513", "score": "0.6588507", "text": "def destroy\n @article_comment = ArticleComment.find(params[:id])\n @article_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "36c3a1bec81703939f7e11d8b4f93650", "score": "0.65855384", "text": "def destroy\n @subcomment = Subcomment.find(params[:id])\n @subcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to(subcomments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "41149e37c3eda8cc58fbc0912fdb91fd", "score": "0.6579988", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n flash[:notice] = \"Comment destroyed\"\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2d5598be657a9ca0f2c4e319243ec15f", "score": "0.65778637", "text": "def destroy\n @comment = Comment.find(params[:id])\n\t\tpost = @comment.post\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to pretty_post_url(post) + '#comments' }\n wants.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b1dcd490d79b47ab0d4f5eddbb736c56", "score": "0.6557958", "text": "def destroy\n @comment = Comment.destroy(params[:id])\n end", "title": "" }, { "docid": "b1dcd490d79b47ab0d4f5eddbb736c56", "score": "0.6557958", "text": "def destroy\n @comment = Comment.destroy(params[:id])\n end", "title": "" }, { "docid": "e4c7188f3e5d9facece14365bc0d265f", "score": "0.6557708", "text": "def destroy_comment\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n flash[:notice] = 'Comment was successfully deleted.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "744d5525b4858116b05c8facff537753", "score": "0.65316665", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n end", "title": "" }, { "docid": "684a5aa02bdc3aed5e4d2920efef786b", "score": "0.6524956", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blog_post_comments_url(@comment.post.blog, @comment.post)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "1e48dbd8c22331185a951583957e8f34", "score": "0.65238863", "text": "def destroy\n @comment = @task.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(sprint_task_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3f2fa333833c695baba7f698866d0500", "score": "0.65212834", "text": "def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end", "title": "" }, { "docid": "3f47e087a1208b381cb2082bf931f2be", "score": "0.65183264", "text": "def delete_comment\n @comment=Comment.find(params[:comment_id])\n @comment.destroy\n end", "title": "" }, { "docid": "61add452a34638dfcdab8c70a07ee3d5", "score": "0.6513281", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"posts\", :action => \"show\", :id => @comment.post_id, :notice => 'Comment deleted.') }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fe5073213c5c383c975ad94aad4c861e", "score": "0.64971346", "text": "def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e1d6f603cb5ea1e475ea71422432aeae", "score": "0.64811826", "text": "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "title": "" }, { "docid": "6546ab88ba95633fb243d7bd3eb71d4b", "score": "0.64800423", "text": "def destroy\n @comment2 = Comment2.find(params[:id])\n @comment2.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment2s_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f20fc42c3c8acfbb4342d7827b794d5a", "score": "0.6472014", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_url(@post), :notice => \"Comment was removed\") }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "76122a2be400201c0fb682d5e286605e", "score": "0.6468329", "text": "def destroy\n if super_user?\n @comment = Comment.find(params[:id])\n @comment.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2d0439b718f31fbe9e9618c61e7fba13", "score": "0.6460881", "text": "def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "0b43ca31530d90471e1c6c08e1403309", "score": "0.6453574", "text": "def destroy\n @comment = Comment.find(params[:id])\n blog = @comment.blog\n @comment.destroy\n flash[:notice] = \"Comment was successfully deleted.\"\n\n respond_to do |format|\n format.html { redirect_to(blog, :method => :get) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8b2fbf67cfa4daf2d43b15ed9038234b", "score": "0.644938", "text": "def destroy\n @system_comment = SystemComment.find(params[:id])\n @system_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(system_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c3662dbb7377845a3d898bc18d954780", "score": "0.6448577", "text": "def destroy\r\n @comment = Comment.find(params[:id])\r\n @comment.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(@comment.wall) }\r\n format.xml { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "fd26e74a216ac7cd7036bd9bbe8437e9", "score": "0.6446908", "text": "def destroy\n @comment.destroy\n end", "title": "" }, { "docid": "c403781dc5c96f74860ed2aee09902d1", "score": "0.6445911", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_comments_path(@comment.site_id)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4817b05dc3418bb6db5b837db4b9ffce", "score": "0.64315933", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n redirect_to request_path(@comment.request)\n end", "title": "" }, { "docid": "6b9ee7b4f4359596eaf3038eb3222190", "score": "0.6431107", "text": "def destroy\n @comment = Comment.find(params[:id])\n \n \n if @comment.has_children?\n @comment.children.each do |child|\n child.destroy\n end\n end\n @comment.destroy\n\n respond_with do |format|\n flash.now[:notice] = 'Comment was successfully deleted.'\n end\n end", "title": "" }, { "docid": "6913fde3c6115fdd366ee264083d2b10", "score": "0.6425743", "text": "def destroy\n\n @comment = @post.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html {redirect_to comments_and_forum_path }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.6396842", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" }, { "docid": "69b205c158f7212cc750ed38fc878f1c", "score": "0.63964593", "text": "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", "title": "" }, { "docid": "752ed216e7d9e361230d41d00e4c06d8", "score": "0.6387322", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "01e5c24116cf23a3896a30600cdc88bf", "score": "0.63824266", "text": "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", "title": "" }, { "docid": "0504c180e76eccd194d1baf0b7dd812d", "score": "0.63566196", "text": "def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end", "title": "" }, { "docid": "83bcf404b76cbc9a0c2c8d950108b502", "score": "0.6356252", "text": "def deleteComments(delete_ids, cookies)\n delete_ids.each do |delete_id|\n hmac = getHMACFromDeleteConfirmationPage(delete_id, cookies)\n payloadString = \"id=\" + delete_id + \"&hmac=\" + hmac + \"&d=Yes&goto=\"\n response = RestClient::Request.new({\n method: :post,\n url: 'https://news.ycombinator.com/xdelete',\n cookies: cookies,\n payload: payloadString,\n }).execute do |response, request, result|\n case response.code\n when 401..500\n raise \"UNABLE TO DELETE COMMENTS\"\n else\n puts \"Deleting comment: \" + delete_id\n end\n end\n end\nend", "title": "" }, { "docid": "3d40345218a4fc17a81502f965d31611", "score": "0.6355306", "text": "def destroy\n @topic_comment = TopicComment.find(params[:id])\n @topic_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(topic_comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c1592c9a7c989d01a99d8c2f4e789eab", "score": "0.6349962", "text": "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "title": "" }, { "docid": "bcdc27b28a66e0d79d3bc4a34b4768ce", "score": "0.6346173", "text": "def delete_comment\n comment = Comment.find_by_id(params[:id])\n if !comment.nil?\n comment.destroy\n end\n end", "title": "" }, { "docid": "952e1aab849d6ddc6982cec383d9a05d", "score": "0.6341622", "text": "def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb3e14995faf2086fd7aec232f171872", "score": "0.6337178", "text": "def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "48b251f6feb27299ea5545f707b052e7", "score": "0.63318926", "text": "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(post_path(@post)) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "title": "" }, { "docid": "05008db4e2d3831d83430c8c7d033560", "score": "0.6320398", "text": "def destroy\n @visit_comment.destroy\n respond_to do |format|\n format.html { redirect_to visit_comments_url, notice: 'Comentario eliminado con exito' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc67d69ba846ddf9f0f521ba08a68fe1", "score": "0.631897", "text": "def destroy\n @comment = Comment.find(params[:id])\n bid = @comment.blog_id\n\n @comment.deleted_parent = true\n @comment.save\n @comment = Comment.find(params[:id])\n @comment.content = '<-deleted->'\n @comment.save\n c1 = @comment\n while !c1.nil? and c1.leaf? do\n cp = c1.parent if !c1.parent.nil?\n cp = cp.nil? ? nil : cp.deleted_parent ? cp : nil\n c1.destroy\n c1 = (cp.nil?)? nil : Comment.find_by_id(cp.id)\n end\n #end while @com_par.deleted_parent == false and @com_par.leaf?\n\n respond_to do |format|\n format.html { redirect_to(Blog.find_by_id(bid)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "155156e1bf1a9729ed62d4e75813d45b", "score": "0.6305597", "text": "def destroy\n Comment.transaction do\n post = @object.post\n id = @object.id\n @object.destroy\n create_change_log_entry(id)\n respond_to do |format|\n format.html { redirect_to post }\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "f26ca4b8f19e49090c0ff3badcbe70d6", "score": "0.6304959", "text": "def destroy\n @fbcomment.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "2d8764b1f2f25110816a17f73f497f0e", "score": "0.62944055", "text": "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", "title": "" }, { "docid": "ab290a6ec9f8f7409ae56eb993a4e598", "score": "0.62924635", "text": "def destroy\n @catalogs_comment_type = Catalogs::CommentType.find(params[:id])\n @catalogs_comment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_comment_types_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ddbcc9c34f784cbaf6807c56697c78eb", "score": "0.6275566", "text": "def delete(comment)\n comment.gsub!(\"\\n\", \" \")\n self.div(:text=>comment).parent.button(:text=>\"Delete\").click\n wait_for_ajax(2) #wait_until { self.button(:text=>\"Undelete\").present? }\n end", "title": "" }, { "docid": "95922eb6f157b84d325ce7161da8ea85", "score": "0.6274243", "text": "def destroy\n return false unless authorize(permissions = [\"delete_comment\"])\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_comments_path(:patient_id => params[:patient_id]) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e65aa0514bb0646e34826c790d140223", "score": "0.6253084", "text": "def comment_delete(ids=[], options={})\n post(\"wrike.comment.delete\", options.merge(:ids => ids.join(',')))\n end", "title": "" }, { "docid": "bf09bcfc628d77e0be8a7338ea574f07", "score": "0.62528694", "text": "def delete_comment\n Jhead.call(\"-dc\", @match, @pattern)\n end", "title": "" }, { "docid": "522e787502895f0a05c9b2c6ca4e5ced", "score": "0.6250422", "text": "def delete\n request(:delete)\n end", "title": "" }, { "docid": "f1b603295c9bc1bf1fc133102d96a63d", "score": "0.62493896", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b2f7c1cd1ed0cc966a3377de474ff1b2", "score": "0.62464696", "text": "def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.62408197", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.62408197", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.62408197", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "77a5ac633411c20c7e94752966bc9f58", "score": "0.623475", "text": "def destroy\n @comment = @article.comments.find(params[:id])\n @comment.destroy\n redirect_to article_path @article\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62329537", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.62321156", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
1c426200987e7a082c1e16fd1ced5563
only archive if there are no related plan stages or environments
[ { "docid": "6cda8410f8bfad203a4276121a9684fa", "score": "0.72523457", "text": "def can_be_archived?\n self.environments.blank? && self.plan_stages.blank?\n end", "title": "" } ]
[ { "docid": "625fcc6f8f56645b59f77fc36c0e87d1", "score": "0.6587175", "text": "def can_be_archived?\n # prevent archiving with a running plan and not the default\n self.active_plans.empty? && !default?\n end", "title": "" }, { "docid": "5e31f705d37f12bc86ba1f311b9c849b", "score": "0.6430993", "text": "def can_be_archived?\n return self.plans.running.count == 0\n end", "title": "" }, { "docid": "8b0f14a6764ec356fc35b9b30379da79", "score": "0.64071155", "text": "def archive\n # Check that there is no issue of a non descendant project that is assigned\n # to one of the project or descendant versions\n v_ids = self_and_descendants.collect {|p| p.version_ids}.flatten\n if v_ids.any? &&\n Issue.\n includes(:project).\n where(\"#{Project.table_name}.lft < ? OR #{Project.table_name}.rgt > ?\", lft, rgt).\n where(\"#{Issue.table_name}.fixed_version_id IN (?)\", v_ids).\n exists?\n return false\n end\n Project.transaction do\n archive!\n end\n true\n end", "title": "" }, { "docid": "4d1788079128775ce458aa65faed9f54", "score": "0.5913488", "text": "def verify_archive\n # from https://github.com/fastlane/fastlane/issues/3179\n if (Dir[BuildCommandGenerator.archive_path + \"/*\"]).count == 0\n ErrorHandler.handle_empty_archive\n end\n end", "title": "" }, { "docid": "078568f3287059917eb9ef1e5ebc02c9", "score": "0.5875134", "text": "def prune_archive\n end", "title": "" }, { "docid": "0760a83d06182e8f821a6217b429b219", "score": "0.5820948", "text": "def dump_archive\n jobclass = Redcap::CaptureProjectArchiveJob\n jobs = self.class.existing_jobs(jobclass, self)\n return if jobs.count > 0\n\n jobclass.perform_later(self, current_admin)\n record_job_request('setup job: project_xml')\n end", "title": "" }, { "docid": "e5348d15ff13619deb3a49a4c20130b2", "score": "0.5739296", "text": "def should_archive_file?\n @should_archive || false\n end", "title": "" }, { "docid": "d2c2b2ae394e7938e13e164100f7aedd", "score": "0.56757694", "text": "def unfinished\n yield unless (Rails.env == 'production' || Rails.env == 'staging')\n end", "title": "" }, { "docid": "9182eceacd3d54afbb6387acb80e832f", "score": "0.5632516", "text": "def archive_build_if_necessary\n unless build_archive_dir.nil?\n local_build_config = FilePath.new(@basedir, \"build-config.local\")\n if local_build_config.exist?\n @ant.copy(:todir => @build_results.build_dir, :file => local_build_config.to_s)\n end\n\n @build_results.archive_to(ant, full_build_archive_path)\n else\n STDERR.puts \"build_archive_dir is nil\"\n end\n end", "title": "" }, { "docid": "7102c1989fac7ed3660d18beb7edf097", "score": "0.54684156", "text": "def has_no_plan_stage_instances_when_becoming_strict\n # only test if strict has changed and is true\n if self.strict_changed? && self.strict && !self.can_be_made_strict?\n self.errors.add(:strict, \"cannot be set to true at this time because plan stage instances already exist for this environment type\")\n end\n end", "title": "" }, { "docid": "aba2dc22886b4effb9851c948759cc91", "score": "0.5458893", "text": "def archive?\n @archive\n end", "title": "" }, { "docid": "2b5133ffc9fdccf5f1aadab6cb6bb14c", "score": "0.545129", "text": "def archive\n self.snapshot_action = \"archive\"\n self.discard\n end", "title": "" }, { "docid": "f7a7f43753ad2de0a3262584c345e9de", "score": "0.54447544", "text": "def check_for_archive_blockers\n unless self.can_be_archived?\n raise ActiveRecord::Rollback\n else\n return true\n end\n end", "title": "" }, { "docid": "d78781fef1e2332ff254cb89cd343f4e", "score": "0.54203826", "text": "def archive\n if (@maintenance = MAINTENANCE) && request.post?\n # dump db\n db = PRODUCTION ? 'photocracy' : 'photocracy_stage'\n %x(~/mysqldump_script.sh #{db} VL1nd33er #{db} '#{Constants::SHARED_ROOT}db')\n # archive attachments and delete data\n path_to_attachments = \"#{RAILS_ROOT}/public/system/\"\n %x(~/tar_dump.sh 0000 #{path_to_attachments} && rm -rf #{path_to_attachments}0000)\n Attachment.delete_all\n Item.delete_all\n ItemsQuestion.delete_all\n Prompt.delete_all\n ActiveRecord::Base.connection.execute(\"DELETE FROM `items_prompts`\")\n Response.delete_all\n ActiveRecord::Base.connection.execute(\"DELETE FROM `items_responses`\")\n Comment.delete_all\n Flag.delete_all\n Visit.delete_all\n Tracking.delete_all\n session[:last_prompt_id] = nil\n session[:question_prompts_shown] = nil\n session[:prompts_shown] = nil\n session[:active_prompt] = nil\n session[:next_prompt_id] = nil\n session[:question] = nil\n session[:next_question] = nil\n session[:question_responses] = nil\n session[:visit] = nil\n current_visit!\n flash[:notice] = 'Deleted and archived'\n end\n redirect_to admin_path\n end", "title": "" }, { "docid": "be90985ab4b102f80cdb7beeadfcd7e9", "score": "0.5400845", "text": "def stage\n return true if filelist.empty?\n\n filelist.each do |file|\n next if file_in_staging?(file)\n\n # If they preserved the file in a previous version, but didn't shelve it, we can copy it to staging.\n # We infer that the file is unchanged if was not also added to preservation in this version.\n next if file_deltas[:added].include?(file) && file_previously_in_preservation?(file) && copy_file_from_preservation(file)\n\n raise FileNotFound, \"Unable to find #{file} in the content directory\"\n end\n\n true\n end", "title": "" }, { "docid": "01916fe06ee9db1d86c12a2891ba5356", "score": "0.53997225", "text": "def build_source_archive\n # scope object for the processing in the block\n me = self\n run_locally do\n info I18n.t('tasks.copy.archive.generate', scope: :dkdeploy)\n\n # generate an exclude.txt file with the patterns to be excluded\n File.open(me.local_exclude_path, 'w+') do |file|\n me.copy_exclude.each do |pattern|\n file.puts pattern\n end\n end\n\n # build the tar archive excluding the patterns from exclude.txt\n within me.copy_source do\n execute :tar, '-X ' + me.local_exclude_path, '-cpzf', me.local_archive_path, '.'\n end\n end\n end", "title": "" }, { "docid": "f9d588b79ffd5d555110419f7bbf7ae2", "score": "0.53667617", "text": "def archived\n !!paranoia_destroyed?\n end", "title": "" }, { "docid": "6fb21d10e38448320ce5064050bdf44e", "score": "0.5366618", "text": "def pending_archivation?\n pending_archivation_folder.vms.any? { |vm| vm.equal? self }\n end", "title": "" }, { "docid": "7380a2654da259e7981132ac49020f07", "score": "0.53393835", "text": "def should_archive_model? model\n (model != nil)\n end", "title": "" }, { "docid": "56e36a95c21aee1b218406aa0ea73356", "score": "0.53359723", "text": "def verify_not_part_of_pipeline\n project.stages.each do |s|\n if s.next_stage_ids.include?(id)\n errors[:base] << \"Stage #{name} is in a pipeline from #{s.name} and cannot be deleted\"\n return false\n end\n end\n end", "title": "" }, { "docid": "31757bdaa330db74746e752115bfdba3", "score": "0.5331737", "text": "def create_plans\n dmptemplate.phases.each do |phase|\n latest_published_version = phase.latest_published_version\n unless latest_published_version.nil?\n new_plan = Plan.new\n new_plan.version = latest_published_version\n plans << new_plan\n end\n end\n end", "title": "" }, { "docid": "62a12be8556fb52b9e5548d4284f5c80", "score": "0.5331182", "text": "def stage_exists?\n end", "title": "" }, { "docid": "6e7bb4188f78dbaadd72bfed1cb01d07", "score": "0.53244007", "text": "def export\n if !File.directory?(\"#{Rails.root}/tmp/zips/\") \n Dir.mkdir(Rails.root.join('tmp/zips'))\n end\n\n archive_file = \"#{Rails.root}/tmp/zips/#{self.id}-#{self.title.delete(' ')}.zip\"\n \n Zip::OutputStream.open(archive_file) do |zipfile|\n # add project description\n zipfile.put_next_entry(\"project_description.txt\")\n zipfile.print(self.description)\n\n step_num = 0\n step_increment = false\n\n self.steps.not_labels.order(\"published_on\").each do |step|\n logger.debug(\"on step #{step.name} with step_num #{step_num}\")\n if step.description.present?\n # add step description\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/description.txt\")\n step_increment = true\n zipfile.print(HTMLEntities.new.decode ActionView::Base.full_sanitizer.sanitize(step.description))\n end\n\n # add media\n step.images.each do |image|\n if image.is_remix_image?\n image = Image.find(image.original_id)\n end\n\n if !image.has_video?\n # add images\n if image.image_path.present?\n # add uploaded image\n img_path = image.image_path_url\n step_increment = true\n elsif image.s3_filepath.present?\n # add direct upload image\n img_path = image.s3_filepath\n step_increment = true\n else\n img_path = nil\n end\n\n if img_path != nil\n filename = File.basename(URI.parse(img_path).path)\n logger.debug(\"image filename: #{filename}\")\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n zipfile.print(URI.parse(img_path).read)\n end\n \n elsif !image.video.embedded?\n # add no embedded video\n filename = File.basename(URI.parse(image.video.video_path_url).path)\n logger.debug(\"video filename: #{filename}\")\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n begin\n zipfile.print(URI.parse(image.video.video_path_url).read)\n step_increment = true\n rescue OpenURI::HTTPError\n # don't export videos with these errors\n end\n end\n end # end step.images.each do |image|\n\n step.design_files.each do |design_file|\n filename = File.basename(URI.parse(design_file.design_file_path_url).path)\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n zipfile.print(URI.parse(design_file.design_file_path_url).read)\n step_increment = true\n end\n\n if step_increment\n step_increment = false\n step_num = step_num+1\n end\n \n end\n end\n end", "title": "" }, { "docid": "76dc859d4191d380669be3524747e69c", "score": "0.5320814", "text": "def archiver; end", "title": "" }, { "docid": "55be4ea6e918809ff3ab264a36306777", "score": "0.5311187", "text": "def perform!\n Logger.info \"#{ self.class } has started archiving:\\n\" +\n paths.map {|path| \" #{path}\" }.join(\"\\n\")\n\n archive_path = File.join(Config.tmp_path, @model.trigger, 'archives')\n FileUtils.mkdir_p(archive_path)\n\n archive_ext = 'tar'\n pipeline = Pipeline.new\n\n pipeline << \"#{ utility(:tar) } #{ tar_args } -cPf - \" +\n \"#{ paths_to_exclude } #{ paths_to_package }\"\n\n if @model.compressor\n @model.compressor.compress_with do |command, ext|\n pipeline << command\n archive_ext << ext\n end\n end\n\n pipeline << \"cat > '#{ File.join(archive_path, \"#{name}.#{archive_ext}\") }'\"\n pipeline.run\n if pipeline.success?\n Logger.info \"#{ self.class } Complete!\"\n else\n raise Errors::Archive::PipelineError,\n \"Failed to Create Backup Archive\\n\" +\n pipeline.error_messages\n end\n end", "title": "" }, { "docid": "227e2405b4b33292d92daf22b7900068", "score": "0.5294036", "text": "def generate_archive\n return if @cfg.archive\n @cfg.rgroup['archive'] = Array.new\n @cfg.save\n @cfg.load(@group)\n end", "title": "" }, { "docid": "fd8e68a2b87e9e62da3a30eef5e692a8", "score": "0.52845776", "text": "def export_all_to_archive_file(opts)\n opts = check_params(opts,[:archive_location,:archive_name])\n super(opts)\n end", "title": "" }, { "docid": "810d37acb5843cb97efb9e8572a65e2a", "score": "0.5280455", "text": "def archive_mass_project\n begin\n if params[:project_ids_to_archive].present?\n projects = @current_organization.projects.where(\"id IN (?)\", params[:project_ids_to_archive].split(\",\"))\n projects.update_all :is_archive=>true\n end\n render json: {:status => \"success\"}\n rescue\n render json: {:status => \"error\"}\n end\n end", "title": "" }, { "docid": "cac0d2117a2f3ef8a8e5dee773141235", "score": "0.5275324", "text": "def enabled_release_stages; end", "title": "" }, { "docid": "7f2d76d38261601f796515caf91d7952", "score": "0.5273906", "text": "def archiveable?\n self.status?(:active) || self.status?(:archived)\n end", "title": "" }, { "docid": "ff3e6d029f0fa500c6b541513c91033b", "score": "0.5271979", "text": "def copy\n if fetch(:archive_workflow)\n unless fetch(:archive_workflow_next).to_s.strip.empty?\n backend.execute(:cp, release_path_filename, \"#{fetch(:archive_releases_path)}/#{fetch(:archive_workflow_next)}/\")\n end\n end\n end", "title": "" }, { "docid": "6d3b8ba90e08b586419631b6b0125604", "score": "0.52558327", "text": "def staging?\n false\n end", "title": "" }, { "docid": "742775f44bfe2f0afba6b5e28617451a", "score": "0.523988", "text": "def archivable?\n self.too_big? or self.too_old?\n end", "title": "" }, { "docid": "eea0dde51b438e9bd27afcd825e31ba2", "score": "0.52388024", "text": "def check_writing_has_been_archived(src_dir)\n elsewhere = YAML.load_file(\n \"#{src_dir}/_data/elsewhere.yml\",\n permitted_classes: [Date]\n )\n\n no_archive_writing = elsewhere['writing']\n .filter { |w| !w.key? 'archived_paths' }\n\n return if no_archive_writing.empty?\n\n puts \"The following writing entries in 'elsewhere' have not been archived:\"\n no_archive_writing\n .each { |w| puts w['url'] }\n puts \"Please run 'python3 scripts/archive_elsewhere.py'\"\n exit!\n end", "title": "" }, { "docid": "7812e0c06e6087227e851b3979ca26da", "score": "0.5238396", "text": "def push_to_acunote!\n return false unless prepare_project_sprints!\n result = @sprints.all? do |sprint|\n upload_csv_to_sprint(acunote_csv_headers + sprint_to_csv(sprint), sprint.taskID)\n end\n if result\n @sprints.all? do |sprint|\n CSV.parse(export_csv_from_sprint(sprint.taskID)).each_with_index do |task_line,index|\n #Scared that i will have stale objects curse my total understanding of ruby object storage\n #I'm thinking i will have to do this though, good thing non of these are in anyway computationally hard :p\n sprint_task_list = flat_task_list(sprint)\n #Skip the header\n if index == 0\n next\n end\n sprint_task_list[index].update_task_with_id(task_line[1])\n end\n end\n end\n save_omni_plan_file(true)\n end", "title": "" }, { "docid": "fdf3e4a2fff7cb98db1d018078012c89", "score": "0.52343065", "text": "def archive\n \n end", "title": "" }, { "docid": "8ddb21d6fa63e134febd2017c0973db3", "score": "0.5231148", "text": "def deploy_pending?\n self.grid_service_deploys.pending.count > 0\n end", "title": "" }, { "docid": "6ce1f89233e0120560e31d6dedd43ac8", "score": "0.5229167", "text": "def prep_phases(phases)\n phases.reverse!\n phases.select! { |p| p['name'] != 'Archive' }\n end", "title": "" }, { "docid": "a70720c5e8e87802e06f2f00824f6cc5", "score": "0.5228812", "text": "def has_plan_files\n plan_files File.join(File.dirname(@filename), 'plans')\n end", "title": "" }, { "docid": "613c4a9be3956088de37ef8f8d30d59e", "score": "0.52255756", "text": "def check_for_archive\n Dir.mkdir('archive') if !Dir.exist?('archive')\nend", "title": "" }, { "docid": "c7e2dea72401d2b6ef18d4735cb331f8", "score": "0.5220916", "text": "def has_plan_stage?\n true if plan_member && plan_member.plan_id && plan_member.plan_stage_id\n end", "title": "" }, { "docid": "00b4c16ddcbe7230cd585f105a7b9e50", "score": "0.52076215", "text": "def can_be_archived?\n true\n end", "title": "" }, { "docid": "0e9251563ce3a9f28ff0e92317365a20", "score": "0.5204976", "text": "def can_be_archived?\n !self.required?\n end", "title": "" }, { "docid": "7c4a05165290b719f0434a8f41a2a7db", "score": "0.5184175", "text": "def staging?\n false\nend", "title": "" }, { "docid": "280578ce5f4ef3750674d1ba55d7c099", "score": "0.5171122", "text": "def can_be_archived?\n my_req_count = 0\n if self.categorized_type == 'request'\n my_req_count = self.requests.functional.count\n elsif self.categorized_type == 'step'\n my_req_count = count_of_existing_requests_through_step || 0\n end\n return my_req_count.to_i == 0\n end", "title": "" }, { "docid": "fde413b184d96759b34fd842e4685b06", "score": "0.51529443", "text": "def finalized?\n !plan\n end", "title": "" }, { "docid": "49466154d5576c55d3ca7ac25fa4ad70", "score": "0.51523584", "text": "def set_archive(params)\n if params[\"state\"]\n if votable? && !votable?(params[\"state\"])\n params.merge!({\"archive_date\"=>Date.today})\n end\n if !votable? && votable?(params[\"state\"])\n params.merge!({\"archive_date\"=>nil})\n end\n end\n params\n end", "title": "" }, { "docid": "812883d484be62908abf03be1e2a72ca", "score": "0.5151477", "text": "def deployable?\n deployments.none? { |d| d.queued? }\n end", "title": "" }, { "docid": "ae858d6b3f7bcb61bf4b04bacfd98241", "score": "0.5138197", "text": "def can_be_archived?\n return true\n end", "title": "" }, { "docid": "6be39bf3831e7d97fbc2b8d06e49acbc", "score": "0.5127361", "text": "def merge_stage(stage)\n template_stage = stage.template_stage\n\n return \"has no template stage to merge into\" unless template_stage\n return \"is a template stage\" if stage.is_template\n return \"has no deploy groups\" if stage.deploy_groups.count.zero?\n return \"has more than one deploy group\" if stage.deploy_groups.count > 1\n return \"commands in template stage differ\" if stage.commands.to_a != template_stage.commands.to_a\n\n unless template_stage.deploy_groups.include?(stage.deploy_groups.first)\n template_stage.deploy_groups += stage.deploy_groups\n template_stage.save!\n end\n\n stage.project.stages.reload # need to reload to make verify_not_part_of_pipeline have current data and not fail\n stage.soft_delete!\n\n nil\n end", "title": "" }, { "docid": "dd2fca4e4abe989c59c2740859b75b5d", "score": "0.5118269", "text": "def write_to_archive(files)\n\n EneBuildings.compress files, full_path\n\n nil\n\n end", "title": "" }, { "docid": "1add68258673332035bfa4bc1b8e5bef", "score": "0.51104796", "text": "def archived?\n revision != nil && revision.archived?\n end", "title": "" }, { "docid": "4cff845d7c7d804245865da61d866d8c", "score": "0.51051766", "text": "def unfinished_plan\n self.treatment_plans.each do |plan|\n if !plan.complete?\n return plan\n end\n end\n \n nil \n end", "title": "" }, { "docid": "67a83c1f583171d8920ede0d47d0e137", "score": "0.5104826", "text": "def guarded_archive?\n\t\treturn ( self.listdir + 'subgetonly' ).exist?\n\tend", "title": "" }, { "docid": "aec49be5820aaac84e155d76392406e9", "score": "0.51040065", "text": "def compact!\n unless inside_repository?\n log_error 'not currently in a git repository'\n return false\n end\n\n directories_to_compact.each do |dir|\n compress_directory dir\n FileUtils.rm_rf builds_dir(dir)\n\n log_info \"Compacted #{archive_path(dir)}\"\n end\n end", "title": "" }, { "docid": "874f26f68cecd21509a762173443202a", "score": "0.5096889", "text": "def archive\n @user = User.find(params[:id])\n authorize @user\n @departments = @user.org.departments.order(:name)\n @plans = Plan.active(@user).page(1)\n if @user.archive\n flash.now[:notice] = success_message(@user, _('archived'))\n else\n flash.now[:alert] = failure_message(@user, _('archive'))\n end\n render :edit\n end", "title": "" }, { "docid": "501dce7a6ce9ca8e1056ae7938a2cb87", "score": "0.5090858", "text": "def archived?\n archived == true\n end", "title": "" }, { "docid": "0805db82f6004d5752d7a15089c000b6", "score": "0.5090333", "text": "def archive_on_missing?\n @has_checked_archive_on_missing ||= begin\n @archive_on_missing = fetch(:net_storage_archive_on_missing, true)\n true\n end\n @archive_on_missing\n end", "title": "" }, { "docid": "c91dec6632cf036d0aef9f44102fdaa0", "score": "0.508158", "text": "def deployed_at_least_once?\n self.deployments.exists?\n end", "title": "" }, { "docid": "d904c873a6166a1a00cf64a7ffec9b80", "score": "0.50805426", "text": "def finalize_production( employee, finalization_date ) \n return nil if finalization_date.nil? \n if not employee.has_role?(:account_executive) or\n not employee.has_project_role?( self, ProjectRole.find_by_name( PROJECT_ROLE[:account_executive] ) )\n return nil\n end\n \n if finalization_date < self.project_start_date\n return nil\n end\n \n if self.drafts.where(:is_finished => false).count != 0\n return nil\n end\n \n self.is_production_finished = true \n self.production_finish_date = finalization_date\n self.production_finisher_id = employee.id\n self.save \n \n end", "title": "" }, { "docid": "6a403a53a34021627775c57043106f45", "score": "0.5079647", "text": "def archive\n self.archived = true\n reportable_survey_response = ReportableSurveyResponse.where(survey_response_id: id).first.try(:delete)\n self.save!\n resp = ReportableSurveyResponse.unscoped.where(survey_response_id: self.id).first\n if resp\n resp.archived = true\n resp.save!\n end \n end", "title": "" }, { "docid": "b84647f96e32882f0d4364ba705f5a36", "score": "0.50763816", "text": "def release_stage?\n Array(release_stages).include?(stage)\n end", "title": "" }, { "docid": "fd0bcfbd5e72cfb738104ef79e342b2b", "score": "0.5069936", "text": "def archived_and_status\n if archived then\n errors.add( :archived, I18n.t( 'pcp_subjects.msg.bad_status' )) \\\n unless current_steps[ 0 ].status_closed?\n end\n end", "title": "" }, { "docid": "55235ac4313384e2399d022ccc805653", "score": "0.50585425", "text": "def manifestable_state?\n if ephemera_box.nil? || !ephemera_box.manifestable_state?\n super\n else\n # box is in production; we should publish\n true\n end\n end", "title": "" }, { "docid": "8c5d40eb3644ce7c3b78c226e5daf883", "score": "0.5057342", "text": "def archived?\n archived == 1\n end", "title": "" }, { "docid": "41b85c427f21211514edf2f5545b2839", "score": "0.50485027", "text": "def deploying?\n self.grid_service_deploys.deploying.count > 0\n end", "title": "" }, { "docid": "eb46977924e1552510b0bfc1405fd7f5", "score": "0.5044221", "text": "def archive\n '--archive'\n end", "title": "" }, { "docid": "eb46977924e1552510b0bfc1405fd7f5", "score": "0.5044221", "text": "def archive\n '--archive'\n end", "title": "" }, { "docid": "803f972103da53049043d400887ffaab", "score": "0.5043739", "text": "def babysit\n display_github_shas!\n display_deployed_shas!\n deploy_to_outdated_envs! unless options.no_deploy\n clear_memoized_values!\n end", "title": "" }, { "docid": "6f32d807c0d11e997a5d755b3ab51038", "score": "0.5042526", "text": "def stage_files_by_manifest(project, all_tasks, logs_dir, concurrency = GSUTIL_TASK_CONCURRENCY)\n # For now, we support pulling specifically from a ct preprod workspace project as a source.\n # This scenario is special-cased, since it's where we're doing operational prep of CDR assets.\n # For publishing in lower environments, i.e. from an arbitrary bucket, just use a normal curationSource.\n deploy_account = must_get_env_value(project, :publisher_account)\n preprod_deploy_account = must_get_env_value(\"all-of-us-rw-preprod\", :publisher_account)\n\n _process_files_by_manifest(\n all_tasks,\n File.join([logs_dir, \"stage\"]),\n \"Staged\",\n concurrency\n ) do |task, wout, werr|\n ingest_path = task[\"ingest_path\"]\n\n unless task[\"preprod_source_project\"].to_s.empty?\n # preprod workspace -> (cp) -> preprod ingest -> (mv) -> prod ingest\n unless system(\n \"gsutil\",\n \"-i\",\n preprod_deploy_account,\n \"-m\",\n \"cp\",\n \"-r\",\n task[\"source_path\"],\n task[\"preprod_source_cdr_path\"],\n :out => wout,\n :err => werr)\n # Note: we use next here because this is inside a block; this yields the value up\n # to the caller which is yielding to this block, i.e. _process_files_by_manifest.\n next [ingest_path, false]\n end\n unless system(\n \"gsutil\",\n \"-i\",\n preprod_deploy_account,\n \"-m\",\n \"cp\",\n \"-r\",\n task[\"preprod_source_cdr_path\"],\n task[\"preprod_source_ingest_path\"],\n :out => wout,\n :err => werr)\n next [ingest_path, false]\n end\n next [ingest_path, system(\n \"gsutil\",\n \"-i\",\n deploy_account,\n \"-m\",\n \"mv\",\n task[\"preprod_source_ingest_path\"],\n ingest_path,\n :out => wout,\n :err => werr)]\n end\n next [ingest_path, system(\n \"gsutil\",\n \"-i\",\n deploy_account,\n \"-m\",\n \"cp\",\n \"-r\",\n task[\"source_path\"],\n ingest_path,\n :out => wout,\n :err => werr)]\n end\nend", "title": "" }, { "docid": "59cf13716dbf9e83c6e303d168d2711f", "score": "0.50420725", "text": "def archive?\n item_type == 'archive'\n end", "title": "" }, { "docid": "8bf73eb3570fedda85a6944504f12bee", "score": "0.5037271", "text": "def make_archive(archivename, archive_comment, sdrf)\n project_dir = ExpandController.path_to_project_dir(command_object.project)\n extracted_dir = File.join(project_dir, \"extracted\")\n relative_sdrf = sdrf.sub(extracted_dir, \"\")\n relative_sdrf.gsub!(/^\\/*/, '') # remove leading /s\n \n # Find existing active archives made for sdrf storage\n old_archives = command_object.project.project_archives.find_all{|pa| \n (pa.status == ProjectArchive::Status::EXPANDED) && (pa.is_active) &&\n (pa.file_name.include? archivename)\n }\n # Deactivate them and remove any of their project files\n old_archives.each{|pa| \n pa.status = ProjectArchive::Status::NOT_EXPANDED\n pa.is_active = false\n pa.save\n pa.project_files.each{|pf|\n pf.destroy\n }\n }\n # If there are still any matching ProjectFiles, eg from original archive\n old_sdrf_files = []\n command_object.project.project_archives.each{|pa|\n found = pa.project_files.find_by_file_name(relative_sdrf) \n old_sdrf_files << found unless found.nil?\n }\n # Mark them as overwritten\n old_sdrf_files.each{|os|\n os.is_overwritten = true\n os.save\n }\n # Then make the new archive\n (archive = command_object.project.project_archives.new).save\n tarname = \"#{\"%03d\" % archive.attributes[archive.position_column]}_#{archivename}.tar\"\n archive.file_name = \"#{tarname}.gz\"\n archive.file_date = Time.now\n archive.is_active = true\n archive.comment = archive_comment \n archive.save\n\n # And tar it up\n absolute_desttgz = File.join(project_dir, archive.file_name)\n cmd = \"tar -czvf #{Shellwords.escape(absolute_desttgz)} -C #{Shellwords.escape(extracted_dir)} #{Shellwords.escape(relative_sdrf)}\"\n \n begin\n result = `#{cmd} 2>&1`\n command_object.stdout = \"#{command_object.stdout}\\nCompressed #{result} to #{File.basename(absolute_desttgz)}\"\n command_object.save\n\n # Finish updating the archive\n archive.file_size = File.size(absolute_desttgz)\n archive.signature = PipelineController.new.generate_file_signature(absolute_desttgz)\n archive.status = ProjectArchive::Status::EXPANDED\n archive.save\n\n # Then make the new ProjectFile for the sdrf\n (project_file = archive.project_files.new(\n :file_name => relative_sdrf,\n :file_size => File.size(sdrf),\n :file_date => File.ctime(sdrf),\n :signature => PipelineController.new.generate_file_signature(sdrf)\n )).save\n rescue Exception => e\n logger.error \"Error making ProjectArchive of SDRF with GeoIDs: #{e.class}: #{e.to_s}\"\n logger.error e.backtrace.join \"\\n\"\n archive.destroy\n command_object.stdout = \"#{command_object.stdout}\\nERROR: Couldn't make archive of updated SDRF: #{e.to_s}!}\"\n command_object.stderr = \"ERROR: Couldn't make archive of updated SDRF: #{e.to_s}!}\"\n command_object.save\n return false\n end\n true\n end", "title": "" }, { "docid": "1902d277043e3758cd01038fdd851043", "score": "0.50370103", "text": "def archive_file(activity)\n # feature flag is set in environment files\n return unless Rails.application.feature_archive_file_enabled\n name = deliverable.asq.get_processed_filename\n content = deliverable.asq.to_csv\n activity.archive_file(name, content)\n end", "title": "" }, { "docid": "bf28466eb4d5940cd964c945fe542be4", "score": "0.5035739", "text": "def no_edits_if_archive\n uneditable = changes.keys & UNEDITABLE_IF_ARCHIVED\n return unless persisted?\n return unless archived_records?\n return if uneditable.empty?\n\n uneditable.each do |k|\n msg = \"#{description} has #{archived_requests.count} in the archive. Editing #{k} is not allowed.\"\n errors.add(k.intern, msg)\n end\n end", "title": "" }, { "docid": "657c08fb6af76b2b02a370c1f645122e", "score": "0.50290436", "text": "def filter_existing(files)\n files.reject { |file| has_archive?(file) }\n end", "title": "" }, { "docid": "e7f4a83d6ca67272657ed4d841d13719", "score": "0.50276357", "text": "def archive\n project_id = self.project_id\n if self.next_action\n all_chores = Chore.where(:project_id => project_id)\n if all_chores.where(:next_action => true).length == 1\n all_chores.update_all(:next_action => true)\n end\n end\n self.update_attribute(:archived, true)\n #self.save!\nend", "title": "" }, { "docid": "b2fbed65aa9961e9cdbb8a0b76d3b7da", "score": "0.5019146", "text": "def finalize\n # unless load_status['destinations_map_status'].eql? 'eff_days_filtered'\n # stash_log \"#{msg_id} #{id}: #{report_key_code} -> waiting for destinations filter\"\n # ScheduleImportWorker.delay_for(1.minute).perform_async(id)\n # halt\n # else\n finalize_attachment('processed')\n report_key.cycle_schedules(self)\n report_key.confirm_schedule_load!\n report_key.save\n save\n\n report_key.brands.each do |brand|\n if brand.active? and AppSwitch.on?('autogenerate_routemaps')\n BrandRouteMapsSyncWorker.perform_async({'brand_key': brand.brand_key, 'schedule_set_id': self.id, 'report_key': report_key.code})\n # export_report = brand.active_export_report\n # export_report = brand.next_export_report unless export_report\n # Rails.logger.info \"Setting Report Key #{report_key.code} state to ready, brand.export_state => #{ brand.export_state.current_state}\"\n # Rails.logger.info \"Setting Report Key #{report_key.code} export_report.current_state => #{ export_report.current_state}\"\n #\n # export_report.schedule_report_keys[report_key.code] = {'status': 'ready', 'seq': report_key.current_seq}\n # export_report.save\n # # Don't kick off a new worker if one is running.\n # if brand.export_state.idle?\n # r = Oag::Report.new\n # r.auto_export_route_maps(brand, export_report)\n # end\n end\n end\n\n # end\n end", "title": "" }, { "docid": "208cef39d8481d1d7b53712a2d32cbc8", "score": "0.501713", "text": "def plan_exists?(plan_name)\n versions_dir = File.join(@plan_store_dir, plan_name, 'versions')\n Dir[versions_dir + '/*.yaml'].any?\n end", "title": "" }, { "docid": "98b886d46a5c4ab5d6b79cd11882f8e0", "score": "0.50162345", "text": "def can_be_deleted?\n self.archived? && self.plans.empty? && !default?\n end", "title": "" }, { "docid": "cac8c364af03e2ea2162acc9d01e8a8b", "score": "0.5010726", "text": "def cleanup\n action = false\n\n @repository.categories.each do |category|\n next if category.eql?(\"stage\")\n Architecture.dataset(category).each do |entry|\n directory = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n if directory.is_unused?(entry[:fullpath])\n action = true\n directory.destroy\n end\n end\n Component.dataset(category).each do |entry|\n directory = Component.new(entry[:component], entry[:suitename], category)\n if directory.is_unused?(entry[:fullpath])\n action = true\n directory.destroy\n end\n end\n Suite.dataset(category).each do |entry|\n directory = Suite.new(entry[:suitename], category)\n if directory.is_unused?(entry[:fullpath])\n action = true\n directory.destroy\n end\n end\n end\n \n @metafile.create if action\n end", "title": "" }, { "docid": "28a44fe274ed68317f5ac855a0164ac6", "score": "0.5007083", "text": "def no_productions?\n self.productions == []\n end", "title": "" }, { "docid": "a94310a7ff8b015a088fb9ef4a1dc90e", "score": "0.5000844", "text": "def archive?\n\n\t\t\treturn false if @file_stat.nil?\n\n\t\t\t@file_stat.archive?\n\t\tend", "title": "" }, { "docid": "4bb8f638c783444d8526fd916ff83638", "score": "0.4994189", "text": "def archive!\n update!(archived: true)\n end", "title": "" }, { "docid": "fbe2e02874491ba70a331483700a3ae2", "score": "0.4980819", "text": "def archive_scenarios(zip)\n @package_info.scenarios.each do |scenario|\n info = ScenarioInfo.read((@location + scenario + \"pione-scenario.json\").read)\n\n # make the scenario directory\n mkdir_with_time(zip, scenario, (@location + scenario).mtime)\n\n # archive scenario contents\n archive_scenario_document(zip, scenario)\n archive_scenario_info(zip, scenario)\n archive_scenario_inputs(zip, scenario, info)\n archive_scenario_outputs(zip, scenario, info)\n end\n end", "title": "" }, { "docid": "e90f1100751e5e992e6bea4924f94426", "score": "0.49780557", "text": "def archived?\n if current_status.complete? && (Time.now > (current_status.created_at + 180.days))\n true\n else\n false\n end\n end", "title": "" }, { "docid": "bbda52eaea5124d680e14676c5885091", "score": "0.49669015", "text": "def archive_all\n all.update_all(archived: true)\n end", "title": "" }, { "docid": "0ba9ba3ffad0401edccc1b0dd53f0b48", "score": "0.49631", "text": "def prepare_for_copy!\n archive_dir = PEBuild.archive_directory(@env)\n\n if not File.directory? archive_dir\n FileUtils.mkdir_p archive_dir\n end\n end", "title": "" }, { "docid": "a92eec09394629bdedd348661031c3ea", "score": "0.49612445", "text": "def archive(environment, path, opts = {})\n archive_with_http_info(environment, path, opts)\n nil\n end", "title": "" }, { "docid": "caab4fe2c1e3b55977d4ecd621287411", "score": "0.4957239", "text": "def staging_deployment?\n application_deployed? && (application_deployment == :staging)\nend", "title": "" }, { "docid": "d98a10ef062466e339f4d4304fcaaa75", "score": "0.495578", "text": "def write_build\n if AIPP.options.section\n super\n else\n info(\"writing build\")\n builds_dir.mkpath\n build_file = builds_dir.join(\"#{AIPP.options.airac.date.xmlschema}.zip\")\n Dir.mktmpdir do |tmp_dir|\n tmp_dir = Pathname(tmp_dir)\n # AIXM/OFMX file\n AIXM.config.mid = true\n File.write(tmp_dir.join(output_file), aixm.to_xml)\n # Build details\n File.write(\n tmp_dir.join('build.yaml'), {\n version: AIPP::VERSION,\n config: AIPP.config,\n options: AIPP.options,\n }.to_yaml\n )\n # Manifest\n manifest = ['AIP','Feature', 'Comment', 'Short Uid Hash', 'Short Feature Hash'].to_csv\n manifest += aixm.features.map do |feature|\n xml = feature.to_xml\n element = xml.first_match(/<(\\w{3})\\s/)\n [\n feature.source.split('|')[2],\n element,\n xml.match(/<!-- (.*?) -->/)[1],\n AIXM::PayloadHash.new(xml.match(%r(<#{element}Uid\\s.*?</#{element}Uid>)m).to_s).to_uuid[0,8],\n AIXM::PayloadHash.new(xml).to_uuid[0,8]\n ].to_csv\n end.sort.join\n File.write(tmp_dir.join('manifest.csv'), manifest)\n # Zip it\n build_file.delete if build_file.exist?\n Zip::File.open(build_file, Zip::File::CREATE) do |zip|\n tmp_dir.children.each do |entry|\n zip.add(entry.basename.to_s, entry) unless entry.basename.to_s[0] == '.'\n end\n end\n end\n end\n end", "title": "" }, { "docid": "e23da9867dc3b81830127056bdcdee22", "score": "0.4954084", "text": "def deletable?\n stage == \"initial\" || stage == \"ready\"\n end", "title": "" }, { "docid": "72753ff71b0917a24fe6a88b76b2d833", "score": "0.49487555", "text": "def archives\n @parent.cleanup_archives\n end", "title": "" }, { "docid": "0a657017ec3d82cb1ac9e250522c1004", "score": "0.4947616", "text": "def completed_files export\n ssh = export.ssh_to_source\n done_files = ssh.exec!(done_files_cmd(export))\n if done_files.blank?\n return []\n else\n files = done_files.split(\"\\n\")\n jobs = Export.where(\"active = 1 and source_schema = '#{export.source_schema}'\")\n result = []\n files.each do |file|\n flag = nil\n jobs.each do |job|\n if file.include?(job.table_name)\n flag = job\n #job.update_attributes!({:state => 'transporting'})\n end\n end\n if flag\n result << {:file => file, :export => flag}\n end\n end # end files.each\n return result\n end# end else\n end", "title": "" }, { "docid": "479e9af66a3210ce6efd25ffbb7cc54a", "score": "0.49438345", "text": "def compress?\n environments.include?(RAILS_ENV)\n end", "title": "" }, { "docid": "1d8241f7de5f124fc9a23bb960624bd8", "score": "0.4941378", "text": "def archived?\n sys[:archivedAt] ? true : false\n end", "title": "" }, { "docid": "e164b771fb8f51be20a36181641e8871", "score": "0.4935452", "text": "def archive_closed_only\n if archived and status_open? then\n errors.add( :archived, I18n.t( 'tia_items.msg.bad_archive' )) \n end\n end", "title": "" }, { "docid": "d1572c1531405e693bf084b0d6f57e2e", "score": "0.49275225", "text": "def with_deploy(dir, options = {}, &block)\n # verbose = options[:verbose] || false\n GoodData.with_project(options[:project_id] || options[:project]) do |project|\n params = options[:params].nil? ? [] : [options[:params]]\n if block\n begin\n res = GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))\n block.call(res)\n ensure\n res.delete if res\n end\n else\n GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))\n end\n end\n end", "title": "" }, { "docid": "e4415cebbc2d13ff54cc30d8caa850a1", "score": "0.49242046", "text": "def destroyable?\n return self.archived? && self.requests.functional.blank? && self.steps.blank?\n end", "title": "" }, { "docid": "0c0778062c41e6595093854f2be8aea2", "score": "0.49221963", "text": "def export\n report_exporter_version\n check_version!\n\n repo_paths = repo_paths_from_options(options)\n export_repositories(repo_paths)\n\n team_builder.write! if models_to_export.include?(\"teams\")\n raise \"Nothing was exported!\" unless archiver.used?\n archiver.create_tar(options[:output_path])\n rescue *RESCUED_EXCEPTIONS => exception\n output_logger.error(exception.message)\n\n backtrace = exception.backtrace.join(\"\\n\")\n output_logger.error(\"Backtrace:\\n#{backtrace}\")\n\n return false\n end", "title": "" }, { "docid": "a70dec2fbc59e0b0b5f63f9c6d7dca1d", "score": "0.49203745", "text": "def cleanup_uncommitted_builds\n @project.builds.where(temporary: true).where('updated_at < ?', 4.hours.ago).order('id DESC').destroy_all\n redirect_back(fallback_location: project_path(@project))\n end", "title": "" } ]
9c7f4d4ff7089e074c1fe1a9085b4831
Makes the current thread join the engine's scheduler thread You can thus make an engine standalone with something like : require 'openwfe/engine/engine' the_engine = OpenWFE::Engine.new the_engine.join And you'll have to hit CTRLC to make it stop.
[ { "docid": "acfcd04f9ee78bc90a2a60a11b5ce073", "score": "0.6870944", "text": "def join\n\n get_scheduler.join\n end", "title": "" } ]
[ { "docid": "71d314c5d751d39a5c77740caa5ea4ba", "score": "0.7049494", "text": "def join\n\n @scheduler_thread.join\n end", "title": "" }, { "docid": "7bab64eb83db14066c24b40face3739f", "score": "0.69238555", "text": "def join\n scheduler.join\n end", "title": "" }, { "docid": "62c1f3e4944d811356019a3489602b59", "score": "0.6847005", "text": "def join\n\n @run_thread.join rescue nil\n end", "title": "" }, { "docid": "a86fa0a52f355c467551826f4afc26e5", "score": "0.6840962", "text": "def join\n @run_thread.join if @run_thread\n end", "title": "" }, { "docid": "1c8a64d49b092e4fad24552b815bbcbd", "score": "0.683248", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "1c8a64d49b092e4fad24552b815bbcbd", "score": "0.683248", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "d6b51ea391502b9dd38517200aa06b5f", "score": "0.68237126", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "d6b51ea391502b9dd38517200aa06b5f", "score": "0.68237126", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "d6b51ea391502b9dd38517200aa06b5f", "score": "0.68237126", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "7086ab7fb5009660122afa2f2f9dbbdc", "score": "0.6703487", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "c2c7742d3d2a4b722e590b311a04c817", "score": "0.6694326", "text": "def join\n @thread.join\n end", "title": "" }, { "docid": "5472e6569f147637ee48625c99ea301c", "score": "0.6659947", "text": "def run_with_threads; end", "title": "" }, { "docid": "a51259145c39feae15e62ba1a97325d4", "score": "0.65604705", "text": "def join\n unless stopped?\n @thread.join\n @thread = nil\n end\n end", "title": "" }, { "docid": "1af8af62d19cb3e51c98b74deec3c7be", "score": "0.6542722", "text": "def join\n ThreadPool2Manager.join\n EMAdapter.join\n end", "title": "" }, { "docid": "2f4ba30b280636cb806fbfec73d86bf0", "score": "0.6537871", "text": "def join\n thread.join\n end", "title": "" }, { "docid": "75f7ff97642d149b4c337a0c6d981641", "score": "0.6511465", "text": "def join\n @thread.join if @thread.is_a?(Thread)\n end", "title": "" }, { "docid": "f5e11865acb020c0f43c5c3b32bce1ee", "score": "0.6487131", "text": "def join_thread\n @thread.join unless @thread.nil?\n end", "title": "" }, { "docid": "d9469ec9862df058e2408fc0679f6058", "score": "0.64860535", "text": "def join()\n go_to_termination(true)\n end", "title": "" }, { "docid": "5433e5c2171f89edc8abff7662acd5b7", "score": "0.64829874", "text": "def join\n threads.each { |t| t.join }\n end", "title": "" }, { "docid": "6472723364d12f0d5823179ed96a2182", "score": "0.6447083", "text": "def join\n @thread_lock.synchronize {\n @thread.join unless @thread.nil?\n }\n end", "title": "" }, { "docid": "fb8d49da828e32528898476b7e157532", "score": "0.6429991", "text": "def join\n @@em_thread.join if @@em_thread\n @@em_thread = nil\n @thread_pool.join if @thread_pool\n @thread_pool = nil\n end", "title": "" }, { "docid": "4ffd4b77ca0c1e8a1f514b035fca6172", "score": "0.63935614", "text": "def join; self; end", "title": "" }, { "docid": "14cc00b8dd85a683479c2549dae8c3f6", "score": "0.6327098", "text": "def join\n @joined = true\n runner.join\n end", "title": "" }, { "docid": "44f9db72632915c37dd16145ae053073", "score": "0.6313877", "text": "def join_thread\n @thread.join if @thread\n @thread = nil\n end", "title": "" }, { "docid": "e296737a6c0b90fcf9b475c81c5f2fc4", "score": "0.6308149", "text": "def join\n @threads.each { |t| t.join }\n @threads.clear\n end", "title": "" }, { "docid": "faec824045ad1e2f5277e75b4c72bc0b", "score": "0.6304201", "text": "def join\n @threads.each { |x| x.join }\n end", "title": "" }, { "docid": "ad00257e1676edf40e69aca31e19fab3", "score": "0.62969774", "text": "def run\n DaemonKit.logger.info \"Starting rufus-scheduler\"\n\n if instance.is_a?( Rufus::Scheduler::PlainScheduler )\n instance.scheduler.join\n else\n Thread.stop\n end\n end", "title": "" }, { "docid": "ad00257e1676edf40e69aca31e19fab3", "score": "0.62969774", "text": "def run\n DaemonKit.logger.info \"Starting rufus-scheduler\"\n\n if instance.is_a?( Rufus::Scheduler::PlainScheduler )\n instance.scheduler.join\n else\n Thread.stop\n end\n end", "title": "" }, { "docid": "a0ad6fcc403b01f5107dca1082c074e5", "score": "0.6289557", "text": "def join\n\n worker.join if worker\n end", "title": "" }, { "docid": "a0ad6fcc403b01f5107dca1082c074e5", "score": "0.6289557", "text": "def join\n\n worker.join if worker\n end", "title": "" }, { "docid": "a0ad6fcc403b01f5107dca1082c074e5", "score": "0.6289557", "text": "def join\n\n worker.join if worker\n end", "title": "" }, { "docid": "0423066866ae42efc11c5d8dcf32bf69", "score": "0.62708336", "text": "def join\n sleep 0.01 while busy?\n end", "title": "" }, { "docid": "935349c5b945b1a777dc5d2b7cb51727", "score": "0.62178093", "text": "def join\n @em_lock.synchronize{\n @reactor_thread.join unless @reactor_thread.nil?\n }\n end", "title": "" }, { "docid": "4a9a8d062c13f1df00855ba905077b63", "score": "0.61928046", "text": "def join\n threads.list.each {|t| t.join if t.alive? }\n end", "title": "" }, { "docid": "ca8ec02ac72631ab220ab6693891fbfe", "score": "0.6177206", "text": "def join\r\n sleep 0.01 until @queue.empty? && @executors.all?{|e| !e.active}\r\n end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.6158066", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.6158066", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.6158066", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.6158066", "text": "def thread; end", "title": "" }, { "docid": "7441d329540ecb9014d0edcf5cb6c622", "score": "0.6147234", "text": "def run_engine(&block)\n NEAT::controller.end_run_add &block\n NEAT::controller.run\n end", "title": "" }, { "docid": "01af2c957b556deb740f98adbc3b04e0", "score": "0.6139108", "text": "def join\n if !@done\n @args[:thread_starts] << Thread.current\n \n begin\n Thread.stop\n rescue Exception\n sleep 0.1 while !@done\n end\n end\n \n return self\n end", "title": "" }, { "docid": "c93485ab8fae3008a9db1cd7622f6e16", "score": "0.6116152", "text": "def join( limit = nil )\n return unless running?\n @thread.join limit\n end", "title": "" }, { "docid": "7f212bf2738fc8f8bdcc982700f55f70", "score": "0.6107485", "text": "def run\n start\n begin\n @thread.join\n rescue Interrupt\n stop\n end\n end", "title": "" }, { "docid": "7f212bf2738fc8f8bdcc982700f55f70", "score": "0.6107485", "text": "def run\n start\n begin\n @thread.join\n rescue Interrupt\n stop\n end\n end", "title": "" }, { "docid": "7f212bf2738fc8f8bdcc982700f55f70", "score": "0.6107485", "text": "def run\n start\n begin\n @thread.join\n rescue Interrupt\n stop\n end\n end", "title": "" }, { "docid": "7d6d86adfdc561b0906763f897ecb607", "score": "0.60795915", "text": "def start!\n # TODO: @jbodah 2016-08-02: put the thread to sleep when there is no more work\n @thread = Thread.new do\n loop { tick }\n end\n end", "title": "" }, { "docid": "c6bdb4f79232607a96a6091ca8377969", "score": "0.60762984", "text": "def start_engine\n puts \"Engine started\"\nend", "title": "" }, { "docid": "ce529622d11e93b4bc6bc7931cb53a44", "score": "0.6075274", "text": "def join\n sleep 0.01 until @queue.empty? && @executors.all?{|e| !e.active}\n end", "title": "" }, { "docid": "de9ca835e300d02ac9620b3cdd82259b", "score": "0.6053794", "text": "def start_engine\n\t\t@engine_started = true\n\tend", "title": "" }, { "docid": "623e53d87b2cde8d4ffdbc96f91896c7", "score": "0.6034574", "text": "def join\n\t\tuntil @set\n\t\t\[email protected]_once\n\t\tend\n\t\tself\n\tend", "title": "" }, { "docid": "2958f640c43c9fd19dcba164fc4d7e04", "score": "0.60318756", "text": "def join\n sleep 0.01 until @queue.empty? and @executors.all?{|e| !e.active}\n end", "title": "" }, { "docid": "c66a309131852e2e4d8c69128b228476", "score": "0.60255474", "text": "def join\n @worker.join(5)\n end", "title": "" }, { "docid": "243556a88ef41c2534e57d0e79bee2ab", "score": "0.6023177", "text": "def quit!\n\n puts \"\\nstopping engine\"\n RuoteKit.engine.shutdown\n RuoteKit.engine.join\n puts \"engine stopped\"\n\n super\n end", "title": "" }, { "docid": "abe836c03521d3a4bcefe50383026a2f", "score": "0.6016013", "text": "def start!\n self.start\n self.join\n end", "title": "" }, { "docid": "abe836c03521d3a4bcefe50383026a2f", "score": "0.6016013", "text": "def start!\n self.start\n self.join\n end", "title": "" }, { "docid": "09c818d0dc02d64d04bd40d5af6b7f7f", "score": "0.600476", "text": "def start_engine\n @engine_started = true\n end", "title": "" }, { "docid": "5e6ec9b893d6facfb6a047cf80970439", "score": "0.59988755", "text": "def start_engine\n \"starting engine now\"\n end", "title": "" }, { "docid": "9b7a6f1f35bb56701ac3b439ca35c863", "score": "0.5985841", "text": "def em_run(&bl)\n @@em_jobs ||= 0\n @@em_jobs += 1\n\n @@em_thread ||= nil\n\n unless !@thread_pool.nil? && @thread_pool.running?\n # threads pool to handle incoming requests\n @thread_pool = ThreadPool.new(@num_threads, :timeout => @timeout)\n end\n\n if @@em_thread.nil?\n @@em_thread =\n Thread.new{\n begin\n EventMachine.run\n rescue Exception => e\n puts \"Critical exception #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n ensure\n end\n }\n#sleep 0.5 until EventMachine.reactor_running? # XXX hacky way to do this\n end\n EventMachine.schedule bl\n end", "title": "" }, { "docid": "1bcbcf20e5aab50322f2311dc3fc2b67", "score": "0.59840685", "text": "def join\n while (not (@queue.empty? and @executors.all?{|e| !e.active}))\n sleep 0.01\n end\n end", "title": "" }, { "docid": "a9daf0db2b60575baef609c845dbc01d", "score": "0.59804624", "text": "def join\n @handler_thread.join\n end", "title": "" }, { "docid": "6677bca2dad5877bb041865c7874f2c7", "score": "0.5978662", "text": "def join\n th = @em_lock.synchronize{ @reactor_thread }\n th.join unless th.nil?\n self\n end", "title": "" }, { "docid": "861e46265d7229af6dad615ddcb44248", "score": "0.5974669", "text": "def join\n while @threads.any?\n sweep\n @threads.each{|t| t.join rescue nil }\n end\n self\n end", "title": "" }, { "docid": "83f63d2715f1a69f3029918996a13045", "score": "0.59618163", "text": "def em_run(&bl)\n # Nodes use shared thread pool to handle requests and free\n # up the eventmachine reactor to continue processing requests\n # @see ThreadPool2, ThreadPool2Manager\n ThreadPool2Manager.init @num_threads, :timeout => @timeout\n\n # Nodes make use of an EM helper interface to schedule operations\n EMAdapter.init :keep_alive => @keep_alive\n\n EMAdapter.schedule &bl\n end", "title": "" }, { "docid": "770e725905bdaa84fd61cae8b370c32f", "score": "0.5956167", "text": "def start\n @thread = Thread.new(&method(:run))\n end", "title": "" }, { "docid": "4a1fc3f32ae485a7812b0156cecd2ca5", "score": "0.59529835", "text": "def load\n start_thread.join\n end", "title": "" }, { "docid": "325eccdec902b3596ac94e3e8daac59f", "score": "0.59386003", "text": "def engage\n threads = []\n threads << LisaToolbox.run_in_new_thread(:engage_by_elite_tweets) {engage_by_elite_tweets}\n threads << LisaToolbox.run_in_new_thread(:engage_by_search) {engage_by_search}\n #threads << LisaToolbox.run_in_new_thread(:engage_by_realtime) {engage_by_realtime}\n threads.each { |thread| thread.join }\nend", "title": "" }, { "docid": "325eccdec902b3596ac94e3e8daac59f", "score": "0.59374106", "text": "def engage\n threads = []\n threads << LisaToolbox.run_in_new_thread(:engage_by_elite_tweets) {engage_by_elite_tweets}\n threads << LisaToolbox.run_in_new_thread(:engage_by_search) {engage_by_search}\n #threads << LisaToolbox.run_in_new_thread(:engage_by_realtime) {engage_by_realtime}\n threads.each { |thread| thread.join }\nend", "title": "" }, { "docid": "00b660dec3c6c8083f90135aa6d17e9f", "score": "0.59143883", "text": "def join\n @thread.join if @thread\n @err_thread.join if @err_thread\n end", "title": "" }, { "docid": "24658b76df83d20709a8d04e8f217be5", "score": "0.58898073", "text": "def join\n @thread.join if @thread\n rescue Interrupt\n # don't care\n end", "title": "" }, { "docid": "e343c78b1ce7d8dbd58a2f843641fd32", "score": "0.58783686", "text": "def join\n @job_runners_lock.synchronize { @job_runners.each { |jr| jr.join } }\n end", "title": "" }, { "docid": "00953327335263e706e1c619709b1ab5", "score": "0.5870533", "text": "def join\n sleep(0.1) while busy?\n self.raise Error::WorkerStop\n super\n end", "title": "" }, { "docid": "4edd0e04c2f1c3d5a9a50d3c53c38dfd", "score": "0.5863622", "text": "def start(engine)\n end", "title": "" }, { "docid": "530b771c86bb4a76741f2c56e13ab150", "score": "0.5862666", "text": "def twake_twaction\n # threads = []\n searches.all.each{|search| \n # threads << Thread.new do\n puts \"running:#{search.query}\"\n search.execute_when_ready\n # end\n }\n # threads.each{|thread|thread.join}\n end", "title": "" }, { "docid": "c16a7fc65dd242611b6edb7d6754204a", "score": "0.5845593", "text": "def engage\n threads = []\n threads << LisaToolbox.run_in_new_thread(:engage_by_elite_tweets) {engage_by_elite_tweets}\n threads << LisaToolbox.run_in_new_thread(:engage_by_search) {engage_by_search}\n threads << LisaToolbox.run_in_new_thread(:engage_by_realtime) {engage_by_realtime}\n #threads << LisaToolbox.run_in_new_thread(:engage_by_realtime_on_my_timeline) {engage_by_realtime_on_my_timeline}\n threads.each { |thread| thread.join }\nend", "title": "" }, { "docid": "0777bfbcf7556e5dac6b5b3841cec501", "score": "0.5843756", "text": "def join\n if @thread\n @thread.join\n else\n raise \"Can't join on a node that isn't yet started\"\n end\n end", "title": "" }, { "docid": "0777bfbcf7556e5dac6b5b3841cec501", "score": "0.5843756", "text": "def join\n if @thread\n @thread.join\n else\n raise \"Can't join on a node that isn't yet started\"\n end\n end", "title": "" }, { "docid": "ded89c5a97c9e3dd945cdba78fb763fc", "score": "0.5843155", "text": "def join_all\r\n \r\n main = Thread.main\r\n current = Thread.current\r\n all = Thread.list\r\n all.each {|t| t.join unless t == current or t == main }\r\n t.abort_on_exception = true\r\nend", "title": "" }, { "docid": "b02c241ea0e5a9203d831d2aac92a755", "score": "0.58131415", "text": "def run_clockwork\n return unless self.class.const_defined?('Clockwork')\n\n th = Thread.new do\n ::Clockwork.run\n end\n th[:name] = 'Clockwork'\n end", "title": "" }, { "docid": "e46a4f414a18ec5ddf76bb05fa9822e0", "score": "0.57984704", "text": "def engage\n threads = []\n threads << LisaToolbox.run_in_new_thread(:engage_by_elite_tweets) {engage_by_elite_tweets}\n threads << LisaToolbox.run_in_new_thread(:engage_by_search) {engage_by_search}\n threads << LisaToolbox.run_in_new_thread(:engage_by_realtime) {engage_by_realtime}\n threads.each { |thread| thread.join }\nend", "title": "" }, { "docid": "c19edae3b855316844f1ffaa30109e4f", "score": "0.5788901", "text": "def sstart\n\n @scheduler_thread = Thread.new do\n while true\n break if @stopped\n step\n sleep(@precision)\n end\n end\n end", "title": "" }, { "docid": "7cf01af79b0928f3bb5e820a151bc65e", "score": "0.57836115", "text": "def start_worker!\n @engine = ::Ruote::Dashboard.new(\n ::Ruote::Worker.new(\n storage\n )\n )\n @engine.join\n end", "title": "" }, { "docid": "108c481e0255bae0a7b3f287868b6604", "score": "0.576743", "text": "def join()\n @watchThread.join() if @watchThread\n end", "title": "" }, { "docid": "a73535efb2849d2151ffbb1ab3845bad", "score": "0.5763259", "text": "def run_thread\n #\n # Good to go.\n #\n @thread = Thread.current\n self.state = :starting\n\n while self.state != :stopping do\n self.state = :started\n @last_polled_at = Time.now\n\n yield\n\n #\n # This is a little sleep to stop cpu hogging.\n #\n Kernel.sleep 0.001 \n end\n\n self.state = :stopped\n end", "title": "" }, { "docid": "e764bd5c2d5623a335934eac6f063f50", "score": "0.5752218", "text": "def new_thread\n thread = Thread.new(&method(:thread_main))\n thread.abort_on_exception = true\n thread\n end", "title": "" }, { "docid": "ffe2b17e0fe70086ae2cf18f1153f29b", "score": "0.5749629", "text": "def run_new_thread\n Thread.new do\n yield if block_given?\n end.join\n end", "title": "" }, { "docid": "3a7b856f9f328b05e05d2a3527847295", "score": "0.5748915", "text": "def run_engine!\n\n return unless configuration.run_engine\n\n storage = configuration.storage_instance\n self.engine = Ruote::Engine.new( storage )\n\n @storage_participant = nil\n\n run_worker!( true ) if configuration.run_worker\n end", "title": "" }, { "docid": "272f3673bc1a852cf99fb1d4b8ec8ad4", "score": "0.5736042", "text": "def join\n @worker.join(SHUTDOWN_TIMEOUT)\n end", "title": "" }, { "docid": "1d7232561b19e0a2661a6b56835de1f7", "score": "0.57254446", "text": "def scheduled(engine)\n @engine = engine\n end", "title": "" }, { "docid": "24884d87407a60738c6245c0da81de0e", "score": "0.572408", "text": "def run\n Thread.new do\n loop do\n @timeleft -= 1\n if @timeleft <= 0\n @bathroom.im_done(@this)\n #Stop the thread\n self.exit\n else\n sleep 1 #Wait for 1 sec\n end\n end\n end\n end", "title": "" }, { "docid": "a1c6331c95be9aeff77b28ccab5d3063", "score": "0.5708791", "text": "def thread\n @thread\n end", "title": "" }, { "docid": "a1c6331c95be9aeff77b28ccab5d3063", "score": "0.5708791", "text": "def thread\n @thread\n end", "title": "" }, { "docid": "a1c6331c95be9aeff77b28ccab5d3063", "score": "0.5708791", "text": "def thread\n @thread\n end", "title": "" }, { "docid": "15b5017241af459c2556d8128ec405b7", "score": "0.5703559", "text": "def join\n tp.join\n em.join\n self\n end", "title": "" }, { "docid": "7584b60db6ad7505d6ee64d12076a407", "score": "0.5701483", "text": "def join\n @sleeper.join\n end", "title": "" }, { "docid": "8919d9e47a53107f1772a9112bfb4837", "score": "0.5694802", "text": "def join\n @threads.each(&:join)\n @threads.select!(&:alive?)\n end", "title": "" }, { "docid": "d6aff33f4362bff19302d7d9ab25abce", "score": "0.5694417", "text": "def join_threads\n @@threads.each { |thread| thread.join unless thread.nil? }\n end", "title": "" }, { "docid": "0e998edf1e64ab8b2835daeab77dc1f4", "score": "0.56942004", "text": "def in_new_thread; end", "title": "" }, { "docid": "fe574b6a8f9055bad7539d32c463169f", "score": "0.5689245", "text": "def employ\n self.start\n self.status = :running\n end", "title": "" }, { "docid": "57b54d538b053651e23f3743b70a95b0", "score": "0.56827074", "text": "def run_in_thread\n @run_thread = Thread.new { run }\n end", "title": "" }, { "docid": "202f989680c32449d7e4cc7cab627752", "score": "0.56824034", "text": "def stop\n @thread.kill\n @thread.join\n end", "title": "" } ]
eb27727eac051c418e4e8b6dddcebffb
GET /map_layers/1 GET /map_layers/1.xml
[ { "docid": "95f502366e2b6f903754723313fedda3", "score": "0.7328853", "text": "def show\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show', :layout => false}\n format.xml { render :xml => @map_layer }\n end\n end", "title": "" } ]
[ { "docid": "61d258ed2ba8704e8e3d6cac9205b5b8", "score": "0.7665787", "text": "def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end", "title": "" }, { "docid": "cdaad512dc3d089e34d208342ba6f31e", "score": "0.68174404", "text": "def new\n @map_layer = MapLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_layer }\n end\n end", "title": "" }, { "docid": "1e4ce9485bf96fec63c969b6981351b5", "score": "0.67354006", "text": "def show\n @site = Site.find(params[:id])\n \n @map = MapLayers::Map.new(\"map\") do |map, page|\n # Available layers include\n #GOOGLE_SATELLITE, GOOGLE_HYBRID, GOOGLE_PHYSICAL, VE_ROAD, VE_AERIAL, VE_HYBRID, YAHOO, YAHOO_SATELLITE, YAHOO_HYBRID, \n # MULTIMAP, OPENSTREETMAP, GEOPOLE_OSM, NASA_GLOBAL_MOSAIC, BLUE_MARBLE_NG, WORLDWIND, WORLDWIND_URBAN, WORLDWIND_BATHY\n\n page << map.add_layer(MapLayers::GOOGLE_PHYSICAL)\n page << map.add_layer(MapLayers::GEOPOLE_OSM)\n\n page << map.add_control(Control::LayerSwitcher.new)\n page << map.add_control(Control::Permalink.new('permalink'))\n page << map.add_control(Control::MousePosition.new)\n\n page << map.add_layer(Layer::GeoRSS.new(\"GeoRSS\", \"sites/georss\"))\n #page << map.add_layer(Layer::GML.new(\"Sites KML\", \"/sites/kml\", {:format => JsExpr.new(\"OpenLayers.Format.KML\")}))\n page << map.add_layer(Layer::WFS.new(\"Sites WFS\", \"/sites/wfs\", {:typename => \"places\"}, {:featureClass => \n JsExpr.new(\"OpenLayers.Feature.WFS\")}))\n \n page << map.zoom_to_max_extent()\n\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end", "title": "" }, { "docid": "cd31fb1f1e5ae3795805a8fa2e0bfec3", "score": "0.66334224", "text": "def get_layers\n Geoloqi::Session.new(:access_token => CONFIG[:geoloqi][:app_access_token]).get('layer/list')[:layers]\nend", "title": "" }, { "docid": "2fe2a67a830c9238db72a9e00945f8e2", "score": "0.6617315", "text": "def maps\n paginate_params = {\n :page => params[:page],\n :per_page => 50\n }\n\n show_warped = params[:show_warped]\n unless show_warped == \"0\"\n lmaps = @layer.maps.warped.order(:map_type).paginate(paginate_params)\n else\n lmaps = @layer.maps.order(:map_type).paginate(paginate_params)\n end\n respond_to do |format|\n #format.json {render :json =>lmaps.to_json(:stat => \"ok\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail])}\n format.json {render :json =>{:stat => \"ok\",\n :current_page => lmaps.current_page,\n :per_page => lmaps.per_page,\n :total_entries => lmaps.total_entries,\n :total_pages => lmaps.total_pages,\n :items => lmaps.to_a}.to_json(:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]), :callback => params[:callback] }\n\n format.xml {render :xml => lmaps.to_xml(:root => \"maps\",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id, :map, :thumbnail]) {|xml|\n xml.tag!'total-entries', lmaps.total_entries\n xml.tag!'per-page', lmaps.per_page\n xml.tag!'current-page',lmaps.current_page} }\n end\n end", "title": "" }, { "docid": "af3207b63bd2a2ae1e06625144600ec9", "score": "0.65645283", "text": "def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end", "title": "" }, { "docid": "13afa1710f68570faa19c49153b5c6ad", "score": "0.65599686", "text": "def get_layers\n Geoloqi::Session.new(:access_token => CONFIG['geoloqi']['app_access_token']).get('layer/list')[:layers]\nend", "title": "" }, { "docid": "c7fe52e576c8e18ab037621337ce595e", "score": "0.6550103", "text": "def show\n #TODO\n @map = Map.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end", "title": "" }, { "docid": "5cb36139a0f50b136f2318a8c32da9b1", "score": "0.6453268", "text": "def show\n @layer = Layer.find(params[:id])\n areas_json = @layer.areas.map do |area|\n {area_id: area.id, polygon: area.polygon}\n end\n @result = {id: @layer.id, name: @layer.name, number_of_polygons: @layer.areas.count, areas: areas_json }\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/show', @layer, @tolerance)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:layer => @layer, :data_json => @data_json, :permalink => @permalink} }\n format.topojson { render json: @layer.to_topojson }\n end\n end", "title": "" }, { "docid": "50742e189dd5d33c1fdbf9c03407f873", "score": "0.63969415", "text": "def layers\n @layers ||= GeoIQ.get(\"#{path}/layers.json\")#.parsed_response#.map {|layer| GeoIQ::Layer.new(layer.merge('map_id' => id)) }\n end", "title": "" }, { "docid": "1e7c5e1f30de6a73dd352511c5583821", "score": "0.6374728", "text": "def wms2\n\n @layer_name = params[:LAYERS]\n begin\n ows = Mapscript::OWSRequest.new\n\n ok_params = Hash.new\n # params.each {|k,v| k.upcase! } frozen string error\n\n params.each {|k,v| ok_params[k.upcase] = v }\n\n [:request, :version, :transparency, :service, :srs, :width, :height, :bbox, :format, :srs, :layers].each do |key|\n\n ows.setParameter(key.to_s, ok_params[key.to_s.upcase]) unless ok_params[key.to_s.upcase].nil?\n end\n\n ows.setParameter(\"STYLES\", \"\")\n #ows.setParameter(\"LAYERS\", \"image\")\n\n map = Mapscript::MapObj.new(File.join(RAILS_ROOT, '/db/maptemplates/wms.map'))\n projfile = File.join(RAILS_ROOT, '/lib/proj')\n map.setConfigOption(\"PROJ_LIB\", projfile)\n #map.setProjection(\"init=epsg:900913\")\n map.applyConfigOptions\n\n # logger.info map.getProjection\n map.setMetaData(\"wms_onlineresource\",\n \"http://\" + request.host_with_port + \"/layers/wms2\")\n unless @layer_name\n\n Layer.visible.each do |layer|\n if layer.rectified_maps_count > 0\n raster = Mapscript::LayerObj.new(map)\n #raster.name = \"layer_\"+layer.id.to_s\n raster.name = \"layer_\"+layer.id.to_s\n raster.type = Mapscript::MS_LAYER_RASTER\n raster.tileindex = layer.tileindex_path\n raster.tileitem = \"Location\"\n\n raster.status = Mapscript::MS_ON\n raster.dump = Mapscript::MS_TRUE\n\n raster.metadata.set('wcs_formats', 'GEOTIFF')\n # raster.metadata.set('wms_title', \"layer \"+layer.id.to_s)\n raster.metadata.set('wms_title', layer.id.to_s + \": \"+snippet(layer.name, 15))\n\n raster.metadata.set('wms_abstract', layer.rectified_maps_count.to_s + \"maps. \"+\n layer.rectified_percent.to_i.to_s + \"% Complete\"+\n \"[Depicts:\"+layer.depicts_year.to_s+\"]\")\n\n raster.metadata.set('wms_keywordlist', 'depictsYear:'+layer.depicts_year.to_s +\n ',totalMaps:' + layer.maps.count.to_s +\n ',numberWarpedMaps:'+ layer.rectified_maps_count.to_s +\n ',percentComplete:'+ layer.rectified_percent.to_i.to_s +\n ',lastUpdated:' + layer.updated_at.to_s )\n raster.metadata.set('wms_srs', 'EPSG:4326 EPSG:4269 EPSG:900913')\n raster.debug = Mapscript::MS_TRUE\n end\n end\n\n else\n single_layer = Layer.find(@layer_name.to_s.delete(\"layer_\"))\n raster = Mapscript::LayerObj.new(map)\n raster.name = \"layer_\"+single_layer.id.to_s\n raster.type = Mapscript::MS_LAYER_RASTER\n raster.tileindex = single_layer.tileindex_path\n raster.tileitem = \"Location\"\n\n raster.status = Mapscript::MS_ON\n raster.dump = Mapscript::MS_TRUE\n\n raster.metadata.set('wcs_formats', 'GEOTIFF')\n raster.metadata.set('wms_title', single_layer.name)\n raster.metadata.set('wms_srs', 'EPSG:4326 EPSG:4269 EPSG:900913')\n raster.metadata.set('wms_keywordlist', 'depictsYear:'+layer.depicts_year.to_s +\n ',totalMaps:' + layer.maps.count.to_s +\n ',warpedMaps:'+ layer.rectified_maps_count.to_s +\n ',percentComplete:'+ layer.rectified_percent.to_i.to_s +\n ',lastUpdated:' + layer.updated_at.to_s )\n\n raster.debug = Mapscript::MS_TRUE\n end\n\n Mapscript::msIO_installStdoutToBuffer\n result = map.OWSDispatch(ows)\n content_type = Mapscript::msIO_stripStdoutBufferContentType || \"text/plain\"\n result_data = Mapscript::msIO_getStdoutBufferBytes\n\n send_data result_data, :type => content_type, :disposition => \"inline\"\n Mapscript::msIO_resetHandlers\n rescue RuntimeError => e\n @e = e\n render :action => 'wms',:layout =>'application'\n end\n end", "title": "" }, { "docid": "0d1734efee27ffd949ce989da38841d6", "score": "0.6287727", "text": "def show\n @localmap = Localmap.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "title": "" }, { "docid": "48bb72e610a37c5b3ac0df0b5782edf2", "score": "0.6257512", "text": "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end", "title": "" }, { "docid": "3c53f01d2c9ae47297fb817d48d36f43", "score": "0.6215746", "text": "def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end", "title": "" }, { "docid": "73e3870c5e948b70272a8f29b19eee51", "score": "0.62040186", "text": "def show\n @map = Map.find(params[:id], :include => \"tiles\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end", "title": "" }, { "docid": "386925d20e0fab817fd9ba6effb05a00", "score": "0.61447364", "text": "def wms_layers\n geonetwork_search_results = URI.parse(@geonetwork_url).read\n geonetwork_search_results_xml = Nokogiri::XML(geonetwork_search_results)\n\n layers = []\n geonetwork_search_results_xml.at_xpath(\"/response\").children.each do |metadata|\n next unless metadata.name == 'metadata'\n\n geonetwork_links = GeonetworkMetadataLinks.new(metadata)\n wms_server, wms_layer = geonetwork_links.wms_link\n\n if wms_server == @geoserver_url && wms_layer\n $logger.info \"Probed layer from Geonetwork: '#{wms_layer}' on '#{wms_server}'\"\n layers << wms_layer\n end\n end\n\n return layers\n end", "title": "" }, { "docid": "a2e27a6206dbb85e215012bafd2738d4", "score": "0.60975206", "text": "def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "dea78b99d951c0b5620f654165528a00", "score": "0.6092447", "text": "def index\n @layers = Layer.all\n end", "title": "" }, { "docid": "4e9020764ec82cebf60366813ef81c59", "score": "0.6083845", "text": "def create\n @map_layer = MapLayer.new(params[:map_layer])\n\n respond_to do |format|\n if @map_layer.save\n flash[:notice] = 'Map Layer was successfully created.'\n format.html { redirect_to(@map_layer) }\n format.xml { render :xml => @map_layer, :status => :created, :location => @map_layer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_layer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f39a70ccba72b5f3c2370b50828fba11", "score": "0.6076941", "text": "def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end", "title": "" }, { "docid": "3b14123199456065af37a0c660338501", "score": "0.6076124", "text": "def get_layers options = {}, &block\n response = self.search :layers => nil\n doc = Nokogiri::XML(response)\n workspace_name = Workspace === options[:workspace] ? options[:workspace].name : options[:workspace]\n layer_nodes = doc.xpath(Layer.root_xpath).collect{|l| l.text.to_s }\n layers = list(Layer, layer_nodes, {}, &block)\n layers = layers.find_all { |layer| layer.workspace.name == workspace_name } if options[:workspace]\n layers\n end", "title": "" }, { "docid": "4f3a8756654ba8c41b9319c39c44e2dd", "score": "0.6047408", "text": "def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end", "title": "" }, { "docid": "1ea606e3757e93cf7171efc0496d9959", "score": "0.6028483", "text": "def get_overlay\n uri = \"http://gisrevprxy.seattle.gov/ArcGIS/rest/services/SDOT_EXT/sdot_parking/MapServer/export\"\n query = self.request_params_to_query\n self.query = \"#{uri}?#{query}\"\n self.remote_overlay_url = self.query\n end", "title": "" }, { "docid": "0b7dd10c5a01d83b5ac5bf0763c7579b", "score": "0.60049653", "text": "def show\n @map_image = MapImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_image }\n end\n end", "title": "" }, { "docid": "bfdc2462c3c7c30ef630682ed352fbeb", "score": "0.59942836", "text": "def show\n @layers = Layer.where(:soil_id => params[:id])\n respond_to do |format|\n\t redirect_to @layers\n format.json { render json: @layers }\n end\n end", "title": "" }, { "docid": "0b6af1e810e4c8dd2e28448d9b706026", "score": "0.59932154", "text": "def show\n @google_map = GoogleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @google_map }\n end\n end", "title": "" }, { "docid": "c468c934beb0799be67d809756837d53", "score": "0.5962851", "text": "def show\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n #@ru = params['id']\n @annotation_layer = AnnotationLayer.where(layer_id: @ru).first\n\n # replace @ru with hostUrl environment variable\n host_url_prefix = Rails.application.config.hostUrl\n\n\n #authorize! :show, @annotation_layer\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annotation_layer.to_iiif, content_type: \"application/json\" }\n end\n end", "title": "" }, { "docid": "acf988b2ebb85201324703d1e115c7fb", "score": "0.59569585", "text": "def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end", "title": "" }, { "docid": "acf988b2ebb85201324703d1e115c7fb", "score": "0.59569585", "text": "def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end", "title": "" }, { "docid": "bcb4ae17153474582eba2e0d2cdd53b7", "score": "0.5952219", "text": "def show\n @map = Map.find_by_id(params[:id])\n @saved_locations = @map.points.for_editing.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end", "title": "" }, { "docid": "66173e24f92d49596ec0279f11e116e2", "score": "0.59204465", "text": "def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end", "title": "" }, { "docid": "8ab21e9b995e11375bcbca1b7ad41ec2", "score": "0.59028757", "text": "def get_layer\n @layer = Layer.find(params[:layer_id])\n end", "title": "" }, { "docid": "8ab21e9b995e11375bcbca1b7ad41ec2", "score": "0.59028757", "text": "def get_layer\n @layer = Layer.find(params[:layer_id])\n end", "title": "" }, { "docid": "8ab21e9b995e11375bcbca1b7ad41ec2", "score": "0.59028757", "text": "def get_layer\n @layer = Layer.find(params[:layer_id])\n end", "title": "" }, { "docid": "496ee3fcfb3e8359aeec5c9d94871a11", "score": "0.58572865", "text": "def preview\n @map = Map.new mapParams\n @map.name = \"preview\"\n image = @map.to_wms_query_string(type: 'image/jpeg', ext: '.jpg')\n \n render :json => {success: true, cachedImage: image, width: @map.width, height: @map.height}, :layout => false\n end", "title": "" }, { "docid": "d7e3fe9d5ca7da25a3267db4ec4f9348", "score": "0.58485126", "text": "def new\n @theme_map = ThemeMap.new\n @map_layers = MapLayer.order('name ASC')\n end", "title": "" }, { "docid": "e0c80e2338fe6ec18d5ff58bad8cab8a", "score": "0.5840681", "text": "def show\n @layer_filter = LayerFilter.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end", "title": "" }, { "docid": "0b30339d2e43e23f36c4d026fb5c6a5a", "score": "0.5839505", "text": "def show\n @event = Event.find(params[:id])\n @location = @event.location\n get_flickr_photos(@location)\n \n @map = GMap.new(\"map_div_small\")\n @map.control_init(:small_zoom => true)\n @map.center_zoom_init([@location.lat,@location.lng],13)\n \n @map.overlay_init(GMarker.new([@location.lat,@location.lng],:title => @location.name, :max_width => 100, :info_window => \"<a href='http://maps.google.com/maps?daddr=\" + @location.full_address + \"' target='blank'>get directions</a>\"))\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml {render :action => '../locations/location.xml.builder', :layout => false}\n end\n end", "title": "" }, { "docid": "7ac626fba709b9f27e7fb35468272a7f", "score": "0.58264875", "text": "def base_uri\n \"#{api}/map_type\"\n end", "title": "" }, { "docid": "241090182afd3a802485faf22665534a", "score": "0.58060634", "text": "def show\n @project = Project.find(params[:id])\n # @nodes = Node.where(:project_id => @project)\n @nodes = Node.find(:all)\n @json = @nodes.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end", "title": "" }, { "docid": "60ef9e3ba9a1e80305d006ccf485b6be", "score": "0.5792621", "text": "def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end", "title": "" }, { "docid": "977079af5486bafd98d8e2ab67f46fb0", "score": "0.5784795", "text": "def mapsaveconv( map )\n @wms = map.wms || \"http://wms.alaskamapped.org/bdl\"\n @layers = map.baselayer || \"BestDataAvailableLayer\"\n #@layers = [opts[:baseLayer][:wmsName], opts[:layers]].flatten.compact.join(',')\n @width = map.width || 1024\n @height = map.height || 1024\n @bbox = map.bbox\n @format = map.format\n @name = map.name\n end", "title": "" }, { "docid": "5949b5126940d63f4a8901475f68bb5a", "score": "0.57292837", "text": "def map\n @locations = Gig.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end", "title": "" }, { "docid": "3fbcbf820a2863ea2112a56c5c3b12f5", "score": "0.57217515", "text": "def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end", "title": "" }, { "docid": "ed0ddc8a93a64fb7075613334a71521b", "score": "0.5707", "text": "def map\n @locations = MonzoTransaction.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end", "title": "" }, { "docid": "7b4300c4eec6c2e6b61783df61eebf70", "score": "0.568416", "text": "def layers \n self.layerlist :layersonly=>true\n end", "title": "" }, { "docid": "3d4f9d1137910935d66f92299565c7d3", "score": "0.5670727", "text": "def new\n #TODO\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "title": "" }, { "docid": "8f3ec984290d5199df0eef6c095b2177", "score": "0.56655693", "text": "def update\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n if @map_layer.update_attributes(params[:map_layer])\n flash[:notice] = 'MapLayer was successfully updated.'\n format.html { redirect_to(@map_layer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_layer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "876b4c3bec3dd5de6d2ce05555aa57d9", "score": "0.5655992", "text": "def show\n @openmapa = Openmapa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @openmapa }\n end\n end", "title": "" }, { "docid": "0e87e66711b5d4e8856e1681da8d4996", "score": "0.5649961", "text": "def show\n @provider = Provider.find(params[:id])\n map_type = GMapType::G_HYBRID_MAP\n coords = @provider.locations.first.fetch_coordinates()\n @map = GMap.new(\"map\")\n @map.control_init(:large_map => true, :map_type => true, :street_view_control => true)\n @map.center_zoom_init(coords,14)\n @map.overlay_init(GMarker.new(coords,:title => \"#{@provider.full_name}\", :info_window => \"Provider Location\"))\n @map.set_map_type_init(map_type)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider }\n format.json { }\n end\n end", "title": "" }, { "docid": "d2b31acc81c915db0ae97e4fa796e99e", "score": "0.56484276", "text": "def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @node }\n format.kml { render :xml => @node }\n end\n end", "title": "" }, { "docid": "429a4b1364d9ca1d43b91b54d4eb96b5", "score": "0.5647137", "text": "def index\n @maps = Map.all\n end", "title": "" }, { "docid": "daf40e5b129ad5306e1635213f8425b6", "score": "0.5644007", "text": "def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n\n countries = {\n ru: 'RU',\n cs: 'CZ',\n it: 'IT',\n ko: 'SK',\n }\n\n config = params.permit(:q, :country)\n config[:locale] = I18n.locale unless I18n.locale == :en\n config[:theme] = 'wemeditate'\n config[:country] ||= countries[I18n.locale]\n @atlas_url = \"https://atlas.sydevelopers.com/map/embed.js?key=#{ENV.fetch('ATLAS_KEY')}&#{config.to_query}\"\n @atlas_enabled = ENV['ATLAS_LOCALES'].split(',').include?(I18n.locale.to_s)\n \n render layout: 'minimal'\n end", "title": "" }, { "docid": "683af6ac113f5c3839c4716c596a2bfd", "score": "0.5639096", "text": "def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end", "title": "" }, { "docid": "b8d0feb5817707c3a6c55e4b18384eb2", "score": "0.56369996", "text": "def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end", "title": "" }, { "docid": "46a4410e0eb5d1314142b1a79d015a20", "score": "0.56227845", "text": "def fetch_map_preview(latitude, longitude, zoom)\n tile = get_tile_number(latitude, longitude, zoom)\n api_url = \"http://tile.openstreetmap.org/#{zoom}/#{tile[:x]}/#{tile[:y]}.png\"\n file_name = \"#{latitude}_#{longitude}_#{zoom}.png\"\n File.new(file_name, File::CREAT)\n Down::NetHttp.download(api_url, destination: \"./#{file_name}\")\n\n file_name\nend", "title": "" }, { "docid": "77fe0d77eb4759187223b2ad9e56f9c4", "score": "0.5621837", "text": "def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\n end", "title": "" }, { "docid": "7cccbbfbe7e001037fa73e4e13129730", "score": "0.56126386", "text": "def map\n @locations = CyclingEvent.where(\"lat IS NOT NULL AND lng IS NOT NULL\")\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @locations, callback: params[:callback] }\n format.xml { render xml: @locations }\n end\n end", "title": "" }, { "docid": "e255bc46d65d0bf91cf575795772eba5", "score": "0.5594058", "text": "def show\n @abstractnmap = Abstractnmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abstractnmap }\n end\n end", "title": "" }, { "docid": "705cb6fc502ea4c4ccdc32cae737dff2", "score": "0.5590569", "text": "def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end", "title": "" }, { "docid": "697f01682e71e8caaadb25cdc9b6aefb", "score": "0.5590035", "text": "def edit\n find_map\n respond_with @map, :include => :waypoints\n end", "title": "" }, { "docid": "af433fb7b2c4310f5006d3c12165dbc3", "score": "0.5584901", "text": "def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end", "title": "" }, { "docid": "a9a1f7f51cf3d03dd4a3963a7ba7d9da", "score": "0.55768144", "text": "def show\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n end", "title": "" }, { "docid": "635b8523c61ef1009ffa9d461dbbaddd", "score": "0.55643106", "text": "def index\n @routes = Route.all\n @alt=50\n @kml_name=\"WMATA Bus\"\n @kml_desc=\"WMATA Bus Routes\"\n respond_to do |format|\n format.html \n format.kml { render kml: @routes }\n format.json { render json: @routes }\n end\n end", "title": "" }, { "docid": "b8c31ce546aa914283ca9ab1c65c5646", "score": "0.55637765", "text": "def new\n @map = Map.new\n\n puts @saved_locations\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "title": "" }, { "docid": "2593529c4fa164baa0afbec45a5c3a20", "score": "0.55504686", "text": "def index\n @map = Map.find(params[:map_id])\n # @markers = Marker.all\n @markers = Marker.where(map_id: @map)\n # @map = params[:map_id]\n end", "title": "" }, { "docid": "cb605dac297792b577671b66c857697c", "score": "0.5550368", "text": "def show\n lat = @airport.latitude_deg\n lng = @airport.longitude_deg\n \n @map_markers = Gmaps4rails.build_markers(@airport) do |airport,marker|\n marker.lat lat\n marker.lng lng\n end\n response = RestClient.get \"http://api.openweathermap.org/data/2.5/weather\", :params => {:lat => lat, :lon => lng}\n @weather = Crack::JSON.parse(response.body) \n end", "title": "" }, { "docid": "000e6fb44c8c21297116123d21ac9115", "score": "0.55493516", "text": "def show\n @sessionmap = Sessionmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sessionmap }\n end\n end", "title": "" }, { "docid": "c69c529a0d56741070e8005b63840d8a", "score": "0.55449533", "text": "def show\n @estate = Estate.find(params[:id])\n @json = @estate.to_gmaps4rails\n respond_with(@estate)\n \n end", "title": "" }, { "docid": "e86c023e923b49085bcf0f842f205c4c", "score": "0.55441207", "text": "def index\n authorize :user\n if @localmap=Localmap.get(@user,params[:localID])\n @message=\"Found\"\n else\n @message=\"Not found\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @localmap,:template => 'localmaps/localmap.xml.builder' }\n end\n end", "title": "" }, { "docid": "0f369b17d75585de85595a6fa6047912", "score": "0.55394864", "text": "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "title": "" }, { "docid": "242b08940ddec68d574b08dc4b8f8410", "score": "0.5537574", "text": "def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "title": "" }, { "docid": "9de47bf2dab2983a247d530f3e0631db", "score": "0.5521103", "text": "def show\n @event = Event.find(params[:id])\n setupMap(@event.location.latitude, @event.location.longitude)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @event }\n end\n end", "title": "" }, { "docid": "780832701bb18572118960ba421edf12", "score": "0.551344", "text": "def clients\n @map = Map.find_by_name('Stor-Oslo') \n @gmap = @map.to_gmap\n Client.find(:all).each { |c| @gmap.overlay_init(c.to_gmarker) }\n render :action => :index\n end", "title": "" }, { "docid": "7a8d9cec739f18c9587d236d7c3e311a", "score": "0.5508896", "text": "def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3414cd8e2406895acd75facdaef1fbf", "score": "0.5506223", "text": "def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end", "title": "" }, { "docid": "7ffdd2aa94b4cf6fb52519ac77f15d1e", "score": "0.5504878", "text": "def show\n @route = Route.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.kml {\n @alt=50\n render kml: @route\n }\n format.json { render json: @route }\n end\n end", "title": "" }, { "docid": "cfe1cf409592ad46718b0ae91df7ebd6", "score": "0.5501756", "text": "def new\n @map = Map.find(params[:map_id])\n @control_point = @map.control_points.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_point }\n end\n end", "title": "" }, { "docid": "7f516b7531328c4f6fbcac73e27185c8", "score": "0.5501585", "text": "def show\n @land_use_mapping = LandUseMapping.find(params[:id])\n @title = \"land use mappings\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @land_use_mapping }\n end\n end", "title": "" }, { "docid": "5fbb0fe28cdc2732c0e8033a1cbaceda", "score": "0.54995984", "text": "def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end", "title": "" }, { "docid": "53e548ceb06a0c0cf4db20eda6f7e8ce", "score": "0.549062", "text": "def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end", "title": "" }, { "docid": "6362883b2c53a5c2f9103b91bb812be1", "score": "0.5488661", "text": "def show\n @event = Event.find(params[:id])\n @json = Event.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @event }\n end\n end", "title": "" }, { "docid": "a4d39779ffe358c78bef5c98ce9abe07", "score": "0.5488195", "text": "def set_map\n @map = NetworkMap.find(params[:id])\n end", "title": "" }, { "docid": "af7baf1994d58c11546d4c2b9428b142", "score": "0.5486841", "text": "def geo(id)\n get \"/geo/id/#{id}.json\"\n end", "title": "" }, { "docid": "67e255087a069d0b1c925a1f36806eb1", "score": "0.5478421", "text": "def index\n if !params[:all].nil?\n @all_stops = true\n @stops = Stop.all\n else\n @all_stops = false\n @stops = Stop.enabled\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stops.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.js { render :json => @stops.to_json(\n :include => {\n :routes => {\n :only => [:name, :id]\n }\n }\n ) }\n format.kml\n end\n end", "title": "" }, { "docid": "2518560315c71ca2f31c6225aaf352de", "score": "0.5472318", "text": "def add_kml(url)\n script << \"map.addOverlay(new GGeoXml(#{url.to_js}));\"\n end", "title": "" }, { "docid": "4dae49322f083263267d6f81241125c8", "score": "0.54702574", "text": "def get_port_map\n response = @client.rest_get(@data['uri'] + '/port-map')\n response.body\n end", "title": "" }, { "docid": "5604fc4af72a35dc2e8eabcc67b8cc43", "score": "0.5467984", "text": "def map_view\n respond_to do |format|\n format.html \n format.json \n end\n end", "title": "" }, { "docid": "3383268deb3d83c65d55f23be6a204dd", "score": "0.54570615", "text": "def show\n @requirement_map = RequirementMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requirement_map }\n end\n end", "title": "" }, { "docid": "eacf2987809488334e663f1b14e05ed6", "score": "0.54534286", "text": "def new\n @google_map = GoogleMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @google_map }\n end\n end", "title": "" }, { "docid": "227ce33cbdbd911ddf94203ba8e17eb3", "score": "0.5447392", "text": "def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n format.kml # show.kml.erb\n end\n end", "title": "" }, { "docid": "1b580c9d73652f1dcbf27ba67a06490e", "score": "0.5436608", "text": "def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end", "title": "" }, { "docid": "ef9aff0ab37e518440f4e77af7232e45", "score": "0.5424717", "text": "def getActiveMap\n return @XML\n end", "title": "" }, { "docid": "7df67c993cba0ec5f03c284387f4f3f0", "score": "0.542423", "text": "def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end", "title": "" }, { "docid": "f693c68060d5f4775b1f86440d8e19df", "score": "0.5411072", "text": "def recall_map_view\n get :map_view\n end", "title": "" }, { "docid": "9bbbb2f5a66950af945b5d8ecd7e290d", "score": "0.54107344", "text": "def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end", "title": "" }, { "docid": "76598c32c169b2640c06a427432829e4", "score": "0.53820026", "text": "def show\n @gig = Gig.find(params[:id])\n # Create a new map object, also defining the div (\"map\") \n # where the map will be rendered in the view\n @map = GMap.new(\"map\")\n # Use the larger pan/zoom control but disable the map type\n # selector\n @map.control_init(:large_map => true,:map_type => false)\n # Center the map on specific coordinates and focus in fairly\n # closely\n @map.center_zoom_init([41.023849,-80.682053], 10)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gig }\n end\n end", "title": "" }, { "docid": "25531949efe3448cf2207f220324db8a", "score": "0.5380896", "text": "def show\n @series_description_map = SeriesDescriptionMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series_description_map }\n end\n end", "title": "" }, { "docid": "6d9df19d9fbfdfecb9dcb10e56861d00", "score": "0.5379243", "text": "def new\n @map_image = MapImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_image }\n end\n end", "title": "" }, { "docid": "fbe60d823f437cec0b8c7f96e6edada2", "score": "0.53759956", "text": "def show\n @geoname = Geoname.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "title": "" } ]
5c0ad73295b069df3e2c8b3c152e46e4
PATCH/PUT /musics/1 PATCH/PUT /musics/1.json
[ { "docid": "cdacd28cc1395a9a9eb43803cc23d5c8", "score": "0.0", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n Docsplit.extract_images(@music.slide.path, size: '1000x', format: [:jpg], output: 'public/uploads/music/slide/'+ @music.id.to_s)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "bac7f237227d97c139237a8266e4335b", "score": "0.657478", "text": "def update\n @muscle = Muscle.find(params[:id])\n\n respond_to do |format|\n if @muscle.update_attributes(params[:muscle])\n format.html { redirect_to @muscle, notice: 'Muscle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c346908b0d4df6741ab451b2b9cd21fa", "score": "0.6485561", "text": "def update\n respond_to do |format|\n if @muscle.update(muscle_params)\n format.html { redirect_to @muscle, notice: 'Muscle was successfully updated.' }\n format.json { render :show, status: :ok, location: @muscle }\n else\n format.html { render :edit }\n format.json { render json: @muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04ab9cb1759dbbec42b977f9fa95e737", "score": "0.64656514", "text": "def update\n @music = Music.find(params[:id])\n \n if @music.update(music_params)\n render json: @music\n else\n render json: @music.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9234090afe24c87eaec932094dde825e", "score": "0.62575465", "text": "def updateMusic\n \t\tm = nil\n \t\thttp = :ok\n\n \tif (@u == nil || (@u != nil && [email protected]?))\n \t\tcodeAnswer 500\n \t\tdefineHttp :forbidden\n \t\tsendJson and return\n \tend\n\n \t\tbegin\n\t \t\tif (params.has_key?(:id) && params.has_key?(:music))\n\t \t\t\tm = Music.find_by_id(params[:id])\n\t \t\t\tif (m.user_id != @u.id)\n\t \t\t\t\thttp = :bad_request\n\t \t\t\telse\n\t\t \t\t\tu = false\n\t\t \t\t\tu = m.update(Music.music_params params) if m.user_id == @u.id\n\t\t \t\t\tif (u == false)\n\t\t \t\t\t\thttp = :bad_request\n\t\t \t\t\telse\n\t\t \t\t\t\tif (params.has_key?(:genres))\n\t\t\t \t\t\t\tm.genres = []\n\t\t\t \t\t\t\tparams[:genres].each { |genre|\n\t\t\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\t\t\tg = Genre.find_by_id(genre)\n\t\t\t\t\t\t\t\t\t\tif g != nil\n\t\t\t\t\t\t\t\t\t\t\tg.musics << m\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\trescue\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t \t\t\t\tif (params.has_key?(:ambiances))\n\t\t\t \t\t\t\tm.ambiances = []\n\t\t\t \t\t\t\tparams[:ambiances].each { |ambiance|\n\t\t\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\t\t\tg = Ambiance.find_by_id(ambiance)\n\t\t\t\t\t\t\t\t\t\tif g != nil\n\t\t\t\t\t\t\t\t\t\t\tg.musics << m\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\trescue\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tm.reload\n\t\t \t\t\tend\n\t\t \t\tend\n\t \t\telse\n\t \t\t\thttp = :bad_request\n\t \t\tend\n\t \trescue\n\t \t\thttp = :bad_request\n\t \tend\n\n \t\trender :json => { music: m.as_json(:include => { genres: {}, ambiances: {} }) }, :status => http\n \tend", "title": "" }, { "docid": "51a2aca92572055005de70cc5c6b9539", "score": "0.6250507", "text": "def update\n @musica = Musica.find(params[:id])\n\n respond_to do |format|\n if @musica.update_attributes(params[:musica])\n format.html { redirect_to @musica, notice: 'Musica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b047bbefe8d3f70b87831a58c0aeaca0", "score": "0.6210048", "text": "def update uid\n update_json = JSON.parse(File.read('./data/live_stream/update_example.json'))\n response = call_api method: :patch, id: uid, body: update_json\n ap JSON.parse(response.body)\n return response\n end", "title": "" }, { "docid": "4f475a74f434837f1e7e560523bc3641", "score": "0.6171938", "text": "def update\n respond_to do |format|\n if @resource_music.update(resource_music_params)\n format.html { redirect_to resource_musics_path, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource_music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acef526c68b901861aed5cacbe9f3ec6", "score": "0.6153545", "text": "def update\n\n @setlist.songs.clear\n @setlist.songs = get_song_objects_from_json(params[:songs])\n\n respond_to do |format|\n if @setlist.save\n format.html { redirect_to @setlist, notice: 'Setlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @setlist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66f77a140d4869b3a8bc39cae5bab9ba", "score": "0.6139441", "text": "def update\n respond_to do |format|\n if @muscle_mass.update(muscle_mass_params)\n format.html { redirect_to @muscle_mass, notice: 'Muscle mass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @muscle_mass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e35e1be52ac4a9be296e35fd2c37e7b", "score": "0.6093796", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, :notice => 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f23c790cf224d257935581396a7de66d", "score": "0.60654986", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f23c790cf224d257935581396a7de66d", "score": "0.60654986", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f23c790cf224d257935581396a7de66d", "score": "0.60654986", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f23c790cf224d257935581396a7de66d", "score": "0.60654986", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1508838b62c28d313b36bf2e03abfebf", "score": "0.60596514", "text": "def update\n respond_to do |format|\n if @musique.update(musique_params)\n format.html { redirect_to @musique, notice: 'Musique was successfully updated.' }\n format.json { render :show, status: :ok, location: @musique }\n else\n format.html { render :edit }\n format.json { render json: @musique.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "611999ec9d4d1b804366afb5b95e605c", "score": "0.6003098", "text": "def update\n json_update(topic,topic_params, Topic)\n end", "title": "" }, { "docid": "210dca179873a433f7d73db1c87a7153", "score": "0.5958599", "text": "def update\n if @music.update(music_params)\n render :show, status: :ok, location: @music\n else\n render json: @music.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dd52e00d31b37ded54eece869b01d59b", "score": "0.5947714", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd52e00d31b37ded54eece869b01d59b", "score": "0.5947714", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae88914570f80850bfc7636af71ae5d2", "score": "0.59472716", "text": "def update\n respond_to do |format|\n if @mosaic.update(mosaic_params)\n format.html { redirect_to @mosaic, notice: 'Mosaic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mosaic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd52e00d31b37ded54eece869b01d59b", "score": "0.5947086", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd52e00d31b37ded54eece869b01d59b", "score": "0.5946408", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b1ab44b948e56706b1ca5578070250c", "score": "0.5930844", "text": "def update\n @song.update(song_params)\n respond_with_bip @song\n end", "title": "" }, { "docid": "e4fd14d4e7161f1ddcd3f0dbd1f0169b", "score": "0.59045774", "text": "def update\n respond_to do |format|\n if @targeted_muscle.update(targeted_muscle_params)\n format.html { redirect_to @targeted_muscle, notice: 'Targeted muscle was successfully updated.' }\n format.json { render :show, status: :ok, location: @targeted_muscle }\n else\n format.html { render :edit }\n format.json { render json: @targeted_muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c99bc07df839e3aeea5659eff1eb28ad", "score": "0.59037536", "text": "def update_mutant(m_id, mutant_info)\n mutant_info = {\"mutant\" => mutant_info}\n request = API_URL + \"mutants/#{m_id}\"\n @response = RestClient.patch(request, mutant_info){|response, request, result| response }\n @parsed_response = JSON.parse(@response)\n if @parsed_response[\"status\"]\n @parsed_response.merge(\"code\" => @parsed_response[\"status\"])\n return\n else\n parse_mutant(@parsed_response)\n log_mutant(\"updated\")\n end\n return\nend", "title": "" }, { "docid": "dd561be3bb89c9ad5681e91b1a0dc845", "score": "0.58821684", "text": "def update\n respond_to do |format|\n if @song.update(song_params)\n format.json { respond_with_bip @song }\n else\n format.json { respond_with_bip @song }\n end\n end\n end", "title": "" }, { "docid": "d1994731d3d6818e70c5a5922048225c", "score": "0.58773625", "text": "def update\n @reminder = Reminder.find(params[:id])\n\n if @reminder.update(params[:reminder])\n head :no_content\n else\n render json: @reminder.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8b098827f088e55cbf3c219a13338330", "score": "0.5859714", "text": "def update\n begin\n # Find note\n note = Note.find(params[:id]) \n # Authenticate\n can_access_club?(Paper.find(note.paper_id).club_id)\n \n if note.update_attributes(params[:note])\n render :json => note\n else\n error \"Failed to update the note\" \n end\n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper\"\n end\n end", "title": "" }, { "docid": "bc0d38d5e50d679f72ec939655bf6e74", "score": "0.5847167", "text": "def update\n respond_to do |format|\n if @microposts1.update(microposts1_params)\n format.html { redirect_to @microposts1, notice: 'Microposts1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @microposts1 }\n else\n format.html { render :edit }\n format.json { render json: @microposts1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b66fedf5c216ee02e99678d2f263b4c", "score": "0.58470714", "text": "def update\n respond_to do |format|\n if @musical_order.update(musical_order_params)\n format.html { redirect_to @musical_order, notice: 'Musical order was successfully updated.' }\n format.json { render :show, status: :ok, location: @musical_order }\n else\n format.html { render :edit }\n format.json { render json: @musical_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bbff399e11cf56c146a1c59f8389290", "score": "0.5839916", "text": "def update\n json_update(genre,genre_params)\n end", "title": "" }, { "docid": "be63b900fdde824d3cfa23a86da16d10", "score": "0.5837383", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Music was successfully updated.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2566c7677423be043d3ec66f4ce82d0", "score": "0.58307916", "text": "def set_music\n @music = current_api_user.musics.find(params[:id])\n end", "title": "" }, { "docid": "b2a5db15209e9481d4c28aa626c159ba", "score": "0.5820289", "text": "def update\n subject = Subject.find(params[:id])\n if subject.update(params_subject)\n render json: subject, status: 200\n else\n render json: subject.errors, status: 422\n end\n\n end", "title": "" }, { "docid": "5a5c93d1a0d8eb98f8e6fbd931992ba8", "score": "0.5814842", "text": "def update\n @mosaic = Mosaic.find(params[:id])\n\n respond_to do |format|\n if @mosaic.update_attributes(params[:mosaic])\n format.html { redirect_to @mosaic, notice: 'Mosaic was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mosaic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5e87e1b59b6e5ea2d12f2027a275079", "score": "0.5813332", "text": "def update\n respond_to do |format|\n if @muscle_group.update(muscle_group_params)\n format.html { redirect_to @muscle_group, notice: 'Muscle group was successfully updated.' }\n format.json { render :show, status: :ok, location: @muscle_group }\n else\n format.html { render :edit }\n format.json { render json: @muscle_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ea2a813f7c2ebb0e084ef1747fcb957", "score": "0.58121365", "text": "def update\n respond_to do |format|\n if @microcosm.update(microcosm_params)\n format.html { redirect_to @microcosm, notice: 'Microcosm was successfully updated.' }\n format.json { render :show, status: :ok, location: @microcosm }\n else\n format.html { render :edit }\n format.json { render json: @microcosm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e333dbfcf8116f07f50ebd51247b373", "score": "0.5811057", "text": "def update\n artist = Artist.find(params[:id])\n artist.update_attributes(artist_params)\n render json: artist\n end", "title": "" }, { "docid": "e046f78ecbce37415ebccf5ca79734de", "score": "0.58058304", "text": "def update\n if @v1_song.update(v1_song_params)\n render :show, status: :ok, location: @v1_song\n else\n render json: @v1_song.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "577111a5159102d5f23f6327f937f83c", "score": "0.580346", "text": "def update\n if @audio.update audio: params[:file].tempfile.read\n render :json => @audio\n else\n render json: {error: true}\n end\n end", "title": "" }, { "docid": "fea8a50f6afcddfe19812494c023142a", "score": "0.5794765", "text": "def update\n @mongotest = Mongotest.find(params[:id])\n\n respond_to do |format|\n if @mongotest.update_attributes(params[:mongotest])\n format.html { redirect_to @mongotest, notice: 'Mongotest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mongotest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "446ef6c4dca9f8d38836bac7b60ff8e0", "score": "0.5791484", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @music.update(music_params)\n\t\t\t\tformat.html { redirect_to @music, notice: 'Music 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: @music.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "1d8cb0d6b9a64739ba2090dcdccba24f", "score": "0.5790438", "text": "def update\n @speck = Speck.find(params[:id])\n\n respond_to do |format|\n if @speck.update_attributes(params[:speck])\n format.html { redirect_to @speck, notice: 'Speck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @speck.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.57897747", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "ca3b032ffbc82148ba3bfdd8143f426a", "score": "0.57875425", "text": "def update\n @muscle_group = MuscleGroup.find(params[:id])\n\n respond_to do |format|\n if @muscle_group.update_attributes(params[:muscle_group])\n format.html { redirect_to @muscle_group, notice: 'Muscle group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @muscle_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4f903b33bf191e21d3a422354076ced", "score": "0.5765829", "text": "def update\n respond_to do |format|\n if @musculo.update(musculo_params)\n format.html { redirect_to @musculo, notice: 'Registro criado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @musculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80ef76c0789953efbc00d6bfef06e5db", "score": "0.57652396", "text": "def update\n @music = Music.find(params[:id])\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to music_path, notice: 'Music was successfully updated.' }\n format.js { redirect_to root_path }\n else\n format.html { render action: \"edit\" }\n format.js { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5e0f352d752ad536247ebb75d66226a", "score": "0.57603043", "text": "def update\n @myspec = Myspec.find(params[:id])\n\n respond_to do |format|\n if @myspec.update_attributes(params[:myspec])\n format.html { redirect_to @myspec, notice: 'Myspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myspec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20d20aeb314850bc54b789dc86607b96", "score": "0.5756394", "text": "def update\n @mix = Mix.find(params[:id])\n\n respond_to do |format|\n if @mix.update_attributes(params[:mix])\n format.html { redirect_to @mix, notice: 'Mix was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mix.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20d20aeb314850bc54b789dc86607b96", "score": "0.5756394", "text": "def update\n @mix = Mix.find(params[:id])\n\n respond_to do |format|\n if @mix.update_attributes(params[:mix])\n format.html { redirect_to @mix, notice: 'Mix was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mix.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "063f8d291697187d220782f8bba26c55", "score": "0.57559335", "text": "def update\n authorize @artist\n if @artist.update(artist_params)\n head :no_content\n else\n render json: @artist.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8d722a36714e21ca064f1a95b4c035ae", "score": "0.57547325", "text": "def update\n if @audio.update(audio_params)\n render json: @audio, status: :ok\n else\n render json: @audio.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "246a782dd1a256123667583350daf57d", "score": "0.5753968", "text": "def update\n unless has_required_write_params?\n return render status: 422, json: {\"error\"=>\"Parameters missing\"}\n end\n\n begin\n note = Note.where(id:params[:id], user_id: current_user_id).first\n rescue ActiveRecord::RecordNotFound\n return render status: 422, json:{\"error\"=>\"Invalid note id\"}\n end\n\n labels = Label.where(id:note_params[:labels])\n note.title = note_params[:title]\n note.content = note_params[:content]\n note.labels = labels\n\n return render json: @@EMPTY_JSON_RESPONSE if note.save\n\n render status: 422, json: note.errors.to_hash\n end", "title": "" }, { "docid": "0fd7fd1c6e2598d4f7f86b10b04be5eb", "score": "0.5753813", "text": "def update\n Rails.logger.warn(@mix.methods)\n respond_to do |format|\n if @mix.update(mix_params)\n format.html { redirect_to @mix, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mix.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d65407897e72444134545404fcb18f0f", "score": "0.57508177", "text": "def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Your song was successfully updated.' }\n \t format.json { render json: { :status => :updated, :message => @music}, location: @music }\n else\n format.html { render :edit }\n format.json { render json: { :status => :unprocessable_entity, :message => @music.errors.full_messages } }\n end\n end\n end", "title": "" }, { "docid": "0bdae9a916e0e0d6b8b6e0d48d31ab1f", "score": "0.5748888", "text": "def update\n authorize! :create, @media\n @audio = Audio.find_by_medium_id_and_url(params[:audio][:medium_id], params[:id])\n\n respond_to do |format|\n if @audio.update_attributes(params[:audio])\n format.html { redirect_to medium_audio_path(@audio.medium, @audio), notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d231dfa7126239ae646c1c0c6fc71a64", "score": "0.5738906", "text": "def update\n respond_to do |format|\n if @micropsot.update(micropsot_params)\n format.html { redirect_to @micropsot, notice: 'Micropsot was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropsot }\n else\n format.html { render :edit }\n format.json { render json: @micropsot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3726630682ab3fdd59970bb3ffdda5d", "score": "0.57358766", "text": "def update\n @specoffer = Specoffer.find(params[:id])\n\n respond_to do |format|\n if @specoffer.update_attributes(params[:specoffer])\n format.html { redirect_to @specoffer, notice: 'Specoffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specoffer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcb5e8f10c7e22aefbaf4b6665c4cb0a", "score": "0.5734203", "text": "def update\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcb5e8f10c7e22aefbaf4b6665c4cb0a", "score": "0.5734203", "text": "def update\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b06a0fdc8ce07f59cd23992e130b6fb", "score": "0.57273084", "text": "def update\n respond_to do |format|\n if @mooch.update(mooch_params)\n format.html { redirect_to mooches_url, notice: 'We got that mooch on updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mooch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d9be9a5a0c375f659d7a20e7a873149", "score": "0.57219", "text": "def update\n @song = Song.friendly.find(params[:id])\n @song.artist_id = params[:artist_id]\n @song.genre_id = params[:genre_id]\n\n\n respond_to do |format|\n if @song.update(song_params)\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", "title": "" }, { "docid": "a9ace45d862d3fdea966ae6335147f24", "score": "0.57093525", "text": "def update\n @speaker = Speaker.find(params[:id])\n\n respond_to do |format|\n if @speaker.update_attributes(params[:speaker])\n format.html { redirect_to @speaker, notice: \"Speaker #{@speaker.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @speaker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae460a85fc3b7198f64bf9c3a806bc97", "score": "0.57037544", "text": "def update\n if @thing.update(thing_params)\n head :no_content\n else\n render json: { errors: @thing.errors.messages },\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "926097139b98f0bde10050baa01e504b", "score": "0.57035446", "text": "def update\n @artist = Artist.find(params[:id])\n @artist.update!(artist_params)\n\n render json: {\n artist: @artist\n }\n end", "title": "" }, { "docid": "03598bf4f8373a215a5d526acf33c7be", "score": "0.57034355", "text": "def update\n respond_to do |format|\n if @move_muscle.update(move_muscle_params)\n format.html { redirect_to @move_muscle, notice: 'Move muscle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @move_muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.5702949", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101277e6aff1281fb94de81685b397c7", "score": "0.5696618", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b56ae801ce75c5236fee64c88e09d0d7", "score": "0.56935704", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to(@song, :notice => 'Song was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @song.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e81e415c0537a06ef6f9cbccbb658c4e", "score": "0.56863993", "text": "def update\n respond_to do |format|\n if @musician.update(musician_params)\n format.html { redirect_to @musician, notice: 'Musician was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @musician.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7daec36697116fde9b632eca9463e28d", "score": "0.56757957", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7daec36697116fde9b632eca9463e28d", "score": "0.56757957", "text": "def update\n @song = Song.find(params[:id])\n\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83701d0357fd8f5f33dfc35f60734bb1", "score": "0.5665723", "text": "def update\n @medium = Media.find(params[:id])\n\n if @medium.update_attributes(params[:media])\n head :no_content\n else\n render json: @medium.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9ff39bd6af9cd2e7035bc5aa14cb101d", "score": "0.56653756", "text": "def update\n artist = Artist.update(artist_params)\n render json: artist, status: :created\n end", "title": "" }, { "docid": "38e4fd72e1e5392662a26d04cbe2aa1a", "score": "0.5651544", "text": "def update\n respond_to do |format|\n if @meta.update(meta_params)\n format.html { redirect_to @meta, notice: 'Metas was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38e4fd72e1e5392662a26d04cbe2aa1a", "score": "0.5651544", "text": "def update\n respond_to do |format|\n if @meta.update(meta_params)\n format.html { redirect_to @meta, notice: 'Metas was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dae37b1226edaa22ed219d5bfbca4794", "score": "0.56442976", "text": "def update\n respond_to do |format|\n if @new_music.update(new_music_params)\n format.html { redirect_to @new_music, notice: 'New music was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_music }\n else\n format.html { render :edit }\n format.json { render json: @new_music.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "768551b9da9f81e8323fb282843c3c6f", "score": "0.5643201", "text": "def update\n @json = Json.find(params[:id])\n\n if @json.update(json_params)\n head :no_content\n else\n render json: @json.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f8707a4eb5ea866878dc3b4b9c2dab9f", "score": "0.56409544", "text": "def update\n @song = Song.find(params[:id])\n\n if @song.update(song_params)\n head :no_content\n else\n render json: @song.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "21fd586f1b510d69a48c8a8068665a07", "score": "0.56396437", "text": "def update\n @artist.slug = nil\n respond_to do |format|\n if @artist.update(artist_params)\n format.json { render json: {artist: @artist.friendly_id, notice: 'Artist was successfully updated.'}, status: :ok, location: @artist }\n else\n format.json { render json: { errors: @artist.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69d832de0fd8af98dc49fac264cd7ed2", "score": "0.5638294", "text": "def update\n authorize! :manage, Rhythm\n respond_to do |format|\n if @rhythm.update(rhythm_params.merge({ modality: Modality.find(rhythm_params[:modality]) }))\n format.html { redirect_to @rhythm, notice: t('action.update.succeed', entity: Rhythm.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rhythm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b1a64575fbbe98a094e4e86ef1fda38", "score": "0.56311935", "text": "def update\n @audio_event = AudioEvent.find(params[:id])\n\n respond_to do |format|\n if @audio_event.update_attributes(params[:audio_event])\n format.json { head :no_content }\n else\n format.json { render json: @audio_event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f3623b55a6650ca7e184405cee71492", "score": "0.56310266", "text": "def update\n respond_to do |format|\n if @microcommand.update(microcommand_params)\n format.html { redirect_to @microcommand, notice: 'Microcommand was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @microcommand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b7de30f7d9e4bda7b40e5f41b4aad93", "score": "0.5628832", "text": "def update\n @mumble = Mumble.find(params[:id])\n\n respond_to do |format|\n if @mumble.update_attributes(params[:mumble])\n format.html { redirect_to @mumble, notice: 'Mumble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mumble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7684282b38c73e8d0018199d70e8040c", "score": "0.56275123", "text": "def update\n @meta = Meta.find(params[:id])\n\n respond_to do |format|\n if @meta.update_attributes(params[:meta])\n format.html { redirect_to @meta, notice: 'Meta was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efebc62733176b89cbcd2b905bd163cb", "score": "0.56270134", "text": "def update\n params[:target_muscle][:existing_exercise_attributes] ||= {}\n\n @target_muscle = TargetMuscle.find(params[:id])\n\n respond_to do |format|\n if @target_muscle.update_attributes(params[:target_muscle])\n flash[:notice] = 'TargetMuscle and Exercises where successfully updated.'\n format.html { redirect_to(@target_muscle) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @target_muscle.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efd93af8ef40b06dc7ee0bb40e0610dc", "score": "0.56244785", "text": "def update\n @microposter = Microposter.find(params[:id])\n\n respond_to do |format|\n if @microposter.update_attributes(params[:microposter])\n format.html { redirect_to @microposter, notice: 'Microposter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce13de0dfab70b1759321b7929cfc496", "score": "0.56225985", "text": "def update\n update_params = params.permit! # FIX-ME: This is highly unsafe\n\n observation = Observation.find(params[:id])\n if observation.update(update_params)\n render json: observation, status: :created\n else\n render json: observation.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "ce13de0dfab70b1759321b7929cfc496", "score": "0.56225985", "text": "def update\n update_params = params.permit! # FIX-ME: This is highly unsafe\n\n observation = Observation.find(params[:id])\n if observation.update(update_params)\n render json: observation, status: :created\n else\n render json: observation.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "9382daa481604bf2970507a91f082971", "score": "0.56209487", "text": "def update\n @music_box = MusicBox.find(params[:id])\n\n respond_to do |format|\n if @music_box.update_attributes(params[:music_box])\n format.html { redirect_to @music_box, notice: I18n.t('app.views.music_boxes.messages.update.success') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music_box.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af7719f97ba2ad8d45c5f03bb6e9b41f", "score": "0.5620594", "text": "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note } \n $redis.publish('notes.update', @note.to_json)\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
b9d9405a91a8be1f57d22cc89ed5b44c
It is possible not to call Twitter API in this method only when accessing from crawlers, but since the same Twitter API is called in other places, it's a bit meaningless.
[ { "docid": "13b45ee9ccb49521123cdc920392e74e", "score": "0.0", "text": "def not_found_user?(screen_name)\n SearchRequestValidator.new(current_user).not_found_user?(screen_name)\n end", "title": "" } ]
[ { "docid": "ac6e96a3513a5220967d255fc4f834ce", "score": "0.6938172", "text": "def twitter\n end", "title": "" }, { "docid": "cfe7cdef439fa7455b111c58ac605afe", "score": "0.6852652", "text": "def twitter ; callback end", "title": "" }, { "docid": "61fb6e2ecd7f281aac6ab278d30002ea", "score": "0.67670256", "text": "def twitter\n process_login\n end", "title": "" }, { "docid": "47b4e0e481b0e67a44dabb256e1cbf3f", "score": "0.672965", "text": "def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com/didmsuwin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmsuwin.com\"\nend", "title": "" }, { "docid": "2640d52b05e02ca6b6c1610171392814", "score": "0.6718859", "text": "def index\n @twitter_client = get_twitter_client\n\n end", "title": "" }, { "docid": "48ac91bd3a0d918ff01a6d3f629ebfc8", "score": "0.66906786", "text": "def twitter\n handle_auth \"Twitter\"\n end", "title": "" }, { "docid": "018608b201680b6f05c218c958e28025", "score": "0.6682697", "text": "def fetch_details_from_twitter\n\n\tend", "title": "" }, { "docid": "4a93e5139409c2666027f97f9dbea77a", "score": "0.6657199", "text": "def twitter_request(url, method=:get, auth=false, parse=true)\n ApplicationController.do_twitter_request(url, method, auth, parse)\n end", "title": "" }, { "docid": "0ce616cd0fe53ed8359953799f8ab086", "score": "0.6627366", "text": "def tweetCity(city)\n # quelques lignes qui enregistrent les clés d'APIs\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ''\n config.consumer_secret = ''\n config.access_token = ''\n config.access_token_secret = ''\n end\n # liste des journalistes\n @city = '@{city}'\n # on spam à la fraîche\n def tweetCity\n @city.each { |city| @client.update(\"Hello #{city},vous connaissez https://putaclic.aixit.fr ?\") }\n # sleep\n sleep 120\n end\n tweetCity\n\n # initialisation des identifiants\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = 'JSON'\n config.consumer_secret = 'JSON'\n config.access_token = 'JSON'\n config.access_token_secret = 'JSON'\n end\n\n # FAIL malheureusement nous n'avons pas reussi ...\n info = client.user_search(city)\n puts city\n info.follow(city)\nend", "title": "" }, { "docid": "e99ca727fca66eb82e46a07627dec0dc", "score": "0.6606009", "text": "def init_twitter\n TWEETER\n end", "title": "" }, { "docid": "49bd923c1b974cf15783ded9292e001e", "score": "0.66046953", "text": "def twitter\n @user = User.find_by_domain(params[:domain].downcase) # Get our correct user depending on the URL \n if @user.nil?\n redirect_to notfound_path # Generate 404 error\n end\n \n # TWITTER\n twitter_token = @user.user_content.twitter_token\n twitter_secret = @user.user_content.twitter_secret\n Twitter.configure do |c|\n c.oauth_token = twitter_token\n c.oauth_token_secret = twitter_secret\n end\n @timeline_all = []\n Twitter.user_timeline(:count => 10).each do |tweet|\n d = tweet.created_at.scan(/.{19}/)[0]\n dp = DateTime.parse(d)\n date_tweet = time_ago_in_words(dp)\n @timeline_all.push(date_tweet)\n @timeline_all.push(tweet.text.html_safe)\n end\n @twitter_id = Twitter.user.screen_name\n \n \n respond_to do |format|\n if [email protected]?\n format.html { render :layout => \"social_networks\" } \n else\n format.html { redirect_to notfound_path } # Generate 404 error\n end\n end\n end", "title": "" }, { "docid": "6ed0acec296b3b9d85e6be5a29e36add", "score": "0.6602133", "text": "def twitter\n if (not params[:oauth_token].blank?)\n if NetworkOAuth.exists?({ :req_token => params[:oauth_token] }) \n\n consumer = OAuth::Consumer.new(WEBSITE_CONFIG['twitter_key'], WEBSITE_CONFIG['twitter_secret'], { :site => \"http://twitter.com\" })\n request_token = OAuth::RequestToken.new(consumer, session[:oauth_reqtoken_token], session[:oauth_reqtoken_secret])\n access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n ## request_token = consumer.get_request_token(:oauth_callback => WEBSITE_CONFIG['twitter_callback'])\n\n ## logger.info \"ACCESS TOKEN: #{access_token.token}\"\n ## logger.info \"ACCESS SECRET: #{access_token.secret}\"\n\n response = consumer.request(:get, '/account/verify_credentials.json', access_token, { :scheme => :query_string })\n case response\n when Net::HTTPSuccess\n creds = JSON.parse(response.body)\n ## logger.info \"JSON Result -- #{creds.inspect}\"\n else\n logger.info \"TWITTER OAUTH Failed to VERIFY.\"\n redirect_to WEBSITE_CONFIG['website_url'] \n end\n\n NetworkOAuth.all(:conditions => { :website_id => WEBSITE_CONFIG['website_id'],\n :network_id => Network::TWITTER,\n :user_id => creds[\"id\"].to_i,\n :status => NetworkOAuth::STATUS_DONE }).each {|oauth| NetworkOAuth.destroy(oauth.id) }\n\n oauth = NetworkOAuth.first(:conditions => { :req_token => params[:oauth_token] })\n oauth[:username] = creds[\"screen_name\"]\n oauth[:user_id] = creds[\"id\"].to_i\n oauth[:acs_token] = access_token.token\n oauth[:acs_secret] = access_token.secret\n oauth[:status] = NetworkOAuth::STATUS_DONE\n oauth.save!\n \n ## We had a tr.im claimant record to turn this feature ON which is the desired default for all network authorized\n ## accounts, when logged in.\n\n if has_session?\n trim_claimant = TrimClaimant.new do |tc|\n tc[:user_id] = @user.id\n tc[:oauth_id] = oauth.id\n end\n trim_claimant.save\n end\n\n ## Confirmation for the token to ensure it will work from scratch with a fresh request. This is also the basis for\n ## any OAuth based API calls.\n\n # logger.info \"TEST FRESH OAuth Request [#{oauth.inspect}]\"\n # testcons = OAuth::Consumer.new(WEBSITE_CONFIG['twitter_key'], WEBSITE_CONFIG['twitter_secret'], { :site => \"http://twitter.com\" })\n # testtokn = OAuth::AccessToken.new(testcons, oauth.acs_token, oauth.acs_secret)\n # response = testcons.request(:get, '/favorites.json', testtokn, { :scheme => :query_string })\n # logger.info response.inspect\n # logger.info response.body.inspect\n\n ## FINISH UP ...\n \n flash[:oauth_just_done] = true\n session[:oauth_reqtoken_token] = nil\n session[:oauth_reqtoken_secret] = nil\n redirect_to session[:oauth_return_url]\n \n else redirect_to WEBSITE_CONFIG['website_url'] end\n else redirect_to WEBSITE_CONFIG['website_url'] end\n end", "title": "" }, { "docid": "281f1ea2ccf9dd5c3b1bfdf004c6ad5e", "score": "0.65769947", "text": "def twitter\n # config = {\n # :consumer_key => \"\",\n # :consumer_secret => \"\",\n # }\n\n # client = Twitter::REST::Client.new(config)\n\n # tweets = collect_with_max_id do |max_id|\n # options = {:count => 200, :include_rts => true}\n # options[:max_id] = max_id unless max_id.nil?\n # client.user_timeline(\"_zapper320\", options)\n # end\n\n render nothing: true\n end", "title": "" }, { "docid": "4df35993cf8c3ff3875fe0ddccbfd241", "score": "0.6570204", "text": "def twitter_api\n httpauth = Twitter::HTTPAuth.new(twitter_username, twitter_password)\n Twitter::Base.new(httpauth)\n end", "title": "" }, { "docid": "82ef706d296e9d9693798349ec032fe2", "score": "0.65205115", "text": "def twitter_check\n twitter_legit = false\n begin\n RestClient.get \"twitter.com/#{params[:member][:twitter]}\"\n twitter_legit = true\n rescue\n # 404\n twitter_legit = false\n end\n \n respond_with(twitter_legit)\n end", "title": "" }, { "docid": "dca5f108d5eea8610988c43d6eec20db", "score": "0.65154", "text": "def fetch_tweets!\n $twitter_client.access_token = self.access_token\n $twitter_client.access_token_secret = self.access_token_secret\n \t@tweets = $twitter_client.user_timeline(self.username)\n if self.tweets.count == 0\n\t \[email protected] do |tweet|\n\t \t\tself.tweets.create(text: tweet.text, text_created_at: tweet.created_at)\n \t\tend\n \telsif tweets_stale? && not_ancient_tweeter?\n \t\tself.tweets.delete_all\n \t\[email protected] do |tweet|\n \t \t\tself.tweets.create(text: tweet.text, text_created_at: tweet.created_at)\n \t\tend\n \tend\n @tweets = self.tweets\n end", "title": "" }, { "docid": "f6730a5fc296a50e521e2c006ef7ae4c", "score": "0.64912504", "text": "def twitter_post\n \n end", "title": "" }, { "docid": "5d7bd71dd35c3a3c0f1fda74187cf3c8", "score": "0.64907527", "text": "def getTrumpTweets\n stories = []\n\n twitter = Twitter::REST::Client.new do |config|\n config.consumer_key = TWITTER_CONSUMER_KEY\n config.consumer_secret = TWITTER_CONSUMER_SECRET\n end\n\n twitter.user_timeline(\"realDonaldTrump\", {count: 25}).each do |tweet|\n stories << {title: tweet.full_text,\n link: tweet.uri,\n body: tweet.full_text}\n end\n stories\nend", "title": "" }, { "docid": "701bbe6e80c01ae77a36a839d08d71a8", "score": "0.64469683", "text": "def twitter\n process_omniauth_callback('twitter')\n end", "title": "" }, { "docid": "fab9040f383044ba84f27e18091e363a", "score": "0.6441255", "text": "def print_tweets(array_of_usernames,how_many_tweets_do_you_want,akey,asecret,ckey,csecret)\r\n\tif how_many_tweets_do_you_want > 200\r\n\t\tputs \"Error: Twitter will only give <200 tweets at a time\"\r\n\tend\r\n\tarray_of_usernames.each {\r\n\t\t|k| #note k is a reference to the username elements\r\n\t\t\r\n\t\t#Exchange our oauth_token and oauth_token secret for the AccessToken instance.\r\n\t\taccess_token = prepare_access_token(akey, asecret, ckey, csecret)\r\n\t\t# use the access token to get a url\r\n\t\tresponse = access_token.request(:get,\r\n\t\t\"https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=#{k}&count=#{how_many_tweets_do_you_want}\")\r\n\t\r\n\t\tputs \"the first #{how_many_tweets_do_you_want} tweets of #{k} are:\"\r\n\t\tputs response\r\n\t}\r\nend", "title": "" }, { "docid": "9f88058b180c2eefc75c28db8bb3512f", "score": "0.643855", "text": "def get_tweets(location) \n # Enter Oauth consumer key, consumer secret, access token and access token secret in .env\n consumer_key = OAuth::Consumer.new(ENV['consumer_key'],ENV['consumer_scret'])\n access_token = OAuth::Token.new(ENV['access_token'], ENV['access_token_secret'])\n\n baseurl = \"https://api.twitter.com\"\n path = \"/1.1/search/tweets.json\"\n query = URI.encode_www_form(\"query\" => \"\", \"geocode\" => \"#{location.lat},#{location.lon},1mi\",\"count\" =>100)\n address = URI(\"#{baseurl}#{path}?#{query}\")\n request = Net::HTTP::Get.new address.request_uri\n\n # Set up HTTP.\n http = Net::HTTP.new address.host, address.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n # Issue the request.\n request.oauth! http, consumer_key, access_token\n http.start\n @response = http.request request\n check_response\n end", "title": "" }, { "docid": "ecb5e60716952e6d4c4981ebbc501bbb", "score": "0.64206237", "text": "def get_tweets(access_token, twitter_uid)\n access_token.get(\"https://api.twitter.com/1.1/statuses/user_timeline.json?user_id=#{twitter_uid}&count=200&exclude_replies=true&include_rts=false\").body\n end", "title": "" }, { "docid": "fe2d7a13609dbf30d8671826b992b69c", "score": "0.6385565", "text": "def load_tweet\n\t### Setup access credentials\n\n\tconsumer_key = \"i6baQCTt1sCXAo8YWcKhuly9Z\"\n\tconsumer_secret = \"DeE9vnnlt7uLgvb1k7ymuHkhBMA0WlOLhSOXzSZAPrO0HZb63h\"\n\n\t### Get the Access Token\n\n\tbearer_token = \"#{consumer_key}:#{consumer_secret}\"\n\tbearer_token_64 = Base64.strict_encode64(bearer_token)\n\n\ttoken_uri = URI(\"https://api.twitter.com/oauth2/token\")\n\ttoken_https = Net::HTTP.new(token_uri.host,token_uri.port)\n\ttoken_https.use_ssl = true\n\n\ttoken_request = Net::HTTP::Post.new(token_uri)\n\ttoken_request[\"Content-Type\"] = \"application/x-www-form-urlencoded;charset=UTF-8\"\n\ttoken_request[\"Authorization\"] = \"Basic #{bearer_token_64}\"\n\ttoken_request.body = \"grant_type=client_credentials\"\n\n\ttoken_response = token_https.request(token_request).body\n\ttoken_json = JSON.parse(token_response)\n\n\taccess_token = token_json[\"access_token\"]\n\n\t### Use the Access Token to make an API request\n\n\ttimeline_uri = URI(\"https://api.twitter.com/1.1/statuses/home_timeline.json\")\n\ttimeline_https = Net::HTTP.new(timeline_uri.host,timeline_uri.port)\n\ttimeline_https.use_ssl = true\n\n\ttimeline_request = Net::HTTP::Get.new(timeline_uri)\n\ttimeline_request[\"Authorization\"] = \"Bearer #{access_token}\"\n\n\ttimeline_response = timeline_https.request(timeline_request).body\n\ttimeline_json = JSON.parse(timeline_response)\n\n\tputs JSON.pretty_generate(timeline_json)\n\t@timeline_json = timeline_json\n\n\nend", "title": "" }, { "docid": "15cc8ced0b04880adcf17a157f144c4b", "score": "0.6381767", "text": "def twitter\n get_authorization(:twitter)\n end", "title": "" }, { "docid": "9a67573c348d79622bee8d7012dbf428", "score": "0.6343493", "text": "def tweet_new_tweet(tweet)\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n $log.debug(tweet)\n client.update(tweet)\n $log.info(\"Successfully tweeted!\")\nend", "title": "" }, { "docid": "2a810a71634ce45b4989344d128f5692", "score": "0.63085943", "text": "def twitter\n if self.vanity and not @twitter\n url= \"http://www.twitter.com/#{self.vanity}\"\n begin\n m= WWW::Mechanize.new.get(url)\n if m #and m.title.match(/#{self.name}/)\n @twitter= url \n end\n rescue\n @twitter= nil\n end\n end\n @twitter\n end", "title": "" }, { "docid": "aaa9165b1e1bb0acec7ebe9526078b79", "score": "0.63045865", "text": "def get_tweets\n ##added the rescue block to handle exceptions during no internet connection\n begin\n # hit the API\n Tweet.client.search(:value_to_search, :count => 10, :result_type => \"recent\").collect do |tweet| \n self.tweets << \"#{tweet.urls}\"\n end \n rescue\n errors.add :base, \"It seems that something has went wrong,Please try after some time\" if self.tweets == nil\n end\n end", "title": "" }, { "docid": "bb207a1eddcc7a7593bc40827f1913a9", "score": "0.6290096", "text": "def twitter\n @tweets = search('JazzHouston', 10)\n end", "title": "" }, { "docid": "41a847c85f87e13f59ebd82e7f34f1ed", "score": "0.628169", "text": "def get_tweets_from_api(uri)\n\n headers = {\n \"Username\" => \"[email protected]\"\n }\n\n response = JSON.parse(HTTParty.get(\n 'http://tweeps.locaweb.com.br/tweeps' + uri,\n :headers => headers\n ))\n\n return response\n end", "title": "" }, { "docid": "55872e6b4e51b0a20b2c5ff18fb498ca", "score": "0.628018", "text": "def twitter\n @twitter ||= Twitter::Client.new(oauth_token: oauth_token, oauth_token_secret: oauth_secret)\n end", "title": "" }, { "docid": "8f57a6410623d5367b39567cf2fbfa63", "score": "0.6273557", "text": "def trawl(criteria)\n\t\tbegin\n\t\t\taddress = URI(\"https://api.twitter.com#{@path}?#{criteria}\")\n\t\t\thttp = Net::HTTP.new address.host, address.port\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\t\t\trequest = Net::HTTP::Get.new address.request_uri\n\n\t\n\t\t\trequest.oauth! http, @consumer_key, @access_token\n\t\t\thttp.start\n\t\t\tresponse = http.request request\n\n\t\t\tcode = response.code\n\t\t\tif code == '200' then\n\t\t\t\tresults = JSON.parse(response.body)\n\t\t\t\treturn results, response[\"x-rate-limit-remaining\"], response[\"x-rate-limit-reset\"]\n\t\t\telse\n\t\t\t\tbody = JSON.parse(response.body)\n\t\t\t\tif body.has_key?(\"errors\") then \n\t\t\t\t\traise TwitterAPIError.new(code,body[\"errors\"][0][\"code\"],body[\"errors\"][0][\"message\"],response)\n\t\t\t\telse \n\t\t\t\t\traise TwitterAPIError.new(code,nil,body[\"error\"],response)\n\t\t\t\tend\n\t\t\tend\n\t\trescue EOFError => e\n\t\t\tputs \"SSL EOF Error\"\n\t\t\tsleep(3)\n\t\t\tretry\n\t\trescue OpenSSL::SSL::SSLError => e\n\t\t\tputs \"SSL Error\"\n\t\t\tsleep(3)\n\t\t\tretry\n\t\trescue TwitterAPIError => e\n\t\t\tputs \"Error code #{e.code}-#{e.errcode}: #{e.reason}\"\n\t\t\tcase e.code.to_i\n\t\t\t# 89: invalid access token?\n\t\t\t# 92: need ssl\n\t\t\twhen 400..401\t# 135: Oauth timestamp issue, 215: bad data\n\t\t\t\tif e.errcode.to_i == 135 then raise \"Oauth timestamp outside of acceptable bounds\" end\n\t\t\t\treturn \"<Not authorized>\",response[\"x-rate-limit-remaining\"], response[\"x-rate-limit-reset\"]\n\t\t\twhen 403\n\t\t\t\t# 64: acct suspended, 161: following too many, 179: can't see status, 185: posted too amny tweets\n\t\t\t\tcase e.errcode.to_i\n\t\t\t\t\twhen 64\n\t\t\t\t\t\traise \"Account has been suspended\"\n\t\t\t\t\twhen 161\n\t\t\t\t\t\traise \"Following too many users\"\n\t\t\t\t\twhen 179\n\t\t\t\t\t\treturn \"<Tweet not available>\",response[\"x-rate-limit-remaining\"], response[\"x-rate-limit-reset\"]\n\t\t\t\t\twhen 185\n\t\t\t\t\t\traise \"Posted too many tweets recently\"\n\t\t\t\t\telse \traise \"Access forbidden\"\n\t\t\t\tend\n\t\t\twhen 404\n\t\t\t\t# 34: page doesn't exist\n\t\t\t\treturn \"<Tweet not available>\",response[\"x-rate-limit-remaining\"], response[\"x-rate-limit-reset\"]\n\t\t\twhen 406\n\t\t\t\traise \"Invalid search request format\"\n\t\t\twhen 410\n\t\t\t\traise \"This API resource is gone.\"\n\t\t\twhen 422\n\t\t\t\traise \"Banner image can't be processed\"\n\t\t\twhen 429\n\t\t\t\t# 88: rate limit exceeded\n\t\t\t\treturn nil, response[\"x-rate-limit-remaining\"], response[\"x-rate-limit-reset\"] \n\t\t\twhen 500\n\t\t\t\traise \"Internal Twitter server error\"\n\t\t\twhen 502\n\t\t\t\t#raise \"Twitter is down\"\n\t\t\t\twait(15)\n\t\t\t\tretry\n\t\t\twhen 503\n\t\t\t\t#raise \"Twitter is overloaded\"\n\t\t\t\twait(15)\n\t\t\t\tretry\n\t\t\twhen 504\n\t\t\t\t#raise \"Twitter timeout\"\n\t\t\t\twait(15)\n\t\t\t\tretry\n\t\t\telse\n\t\t\t\traise \"Unrecoverable error\"\n\t\t\tend\t\n\t\tend\t\n\tend", "title": "" }, { "docid": "66a97680b0351c1f0aeb5d93e3983ba8", "score": "0.6269261", "text": "def load_tweets_locaweb\n\n # Configure HTTP\n baseurl = \"http://tweeps.locaweb.com.br\"\n path = \"/tweeps\"\n address = URI(\"#{baseurl}#{path}\")\n request = Net::HTTP::Get.new address.request_uri\n\n # Request HTTP with Header of User\n http = Net::HTTP.new(address.host, address.port)\n request.initialize_http_header({ \"Username\" => \"[email protected]\" })\n http.start\n response = http.request(request)\n\n # Other mode\n # uri = URI(URL_API)\n # request = Net::HTTP::Get.new(uri)\n # request['Username'] = '[email protected]'\n # response = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(request) }\n\n # Testing if response is ok\n if response.code == '200' then\n @all_tweets = JSON.parse(response.body)\n else\n puts response.message\n puts response.code\n puts \"#{address.request_uri} => #{response.code}\"\n end\n\n end", "title": "" }, { "docid": "b47d6c0425e1dec9b91909e3837b2e92", "score": "0.6264252", "text": "def get_tweets(list)\n unless list.authorized?(@user)\n raise AuthorizationException.new\n end\n list.tweets\nend", "title": "" }, { "docid": "5868509b99ba3155ce6b15f9f7857bed", "score": "0.6252192", "text": "def twitter_url\n \"http://twitter.com/#{self.twitter_name}\" if self.twitter_name\n end", "title": "" }, { "docid": "c81156da3999561c16c5e0048dc21af0", "score": "0.62518764", "text": "def twitter\n self.twitter_identity.api\n end", "title": "" }, { "docid": "be1438758f7c46af61e0b2d8c85cfeed", "score": "0.62454116", "text": "def send_to_external_accounts\n return if ENV['RAILS_ENV'] == 'development'\n\n # If there is no user we can't get to the oauth tokens, abort!\n if author.user\n # If the twitter flag is true and the user has a twitter account linked\n # send the update\n if self.twitter? && author.user.twitter?\n begin\n Twitter.configure do |config|\n config.consumer_key = ENV[\"CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"CONSUMER_SECRET\"]\n config.oauth_token = author.user.twitter.oauth_token\n config.oauth_token_secret = author.user.twitter.oauth_secret\n end\n\n Twitter.update(text)\n rescue Exception => e\n #I should be shot for doing this.\n end\n end\n end\n\n end", "title": "" }, { "docid": "03b5c042e72ea1c1c1867005044f13b6", "score": "0.62346023", "text": "def get_tweets(list)\n unless list.authorized?(@user)\n raise AuthorizedException.new\n end\n list.tweets\nend", "title": "" }, { "docid": "f8ba65871d2606f055520305471389b4", "score": "0.6222931", "text": "def connect_to_twitter\n @client = Twitter::REST::Client.new do |config|\n # These come from settings.yaml – you need to enter your details in there\n config.consumer_key = @settings[\"twitter\"][\"consumer_key\"]\n config.consumer_secret = @settings[\"twitter\"][\"consumer_secret\"]\n config.access_token = @settings[\"twitter\"][\"access_token\"]\n config.access_token_secret = @settings[\"twitter\"][\"access_token_secret\"]\n end\nend", "title": "" }, { "docid": "a3e7d30e72ab15deb9799eb015c311e0", "score": "0.6220861", "text": "def send_tweet(tweet)\n client = Twitter::Client.new\n client.update(tweet) \n end", "title": "" }, { "docid": "fef48d2aacb12d98a1a48bef0d6df2de", "score": "0.62157", "text": "def follow_on_twitter\n unless self.twitter_screen_name.blank?\n begin\n Campaign.borwin_twitter_connection\n Twitter.follow(self.twitter_screen_name)\n rescue Exception\n end\n end\n end", "title": "" }, { "docid": "14a64d795a029efcac6bd983ab729e8f", "score": "0.6209853", "text": "def get_twitter_tweets\n TwitterDataJob.perform_later current_user.id\n respond_to do |format|\n format.html { redirect_to request.referrer, notice:\"Updating All Twitter\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07dcd1f00ccaa8d0b5495a34a3ee4f5b", "score": "0.6208202", "text": "def twitter\n render nothing: true\n end", "title": "" }, { "docid": "84fa446425195d31f68e5cac9a08a438", "score": "0.6206501", "text": "def load_twitter_keys\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = @twitter_consumer_key\n config.consumer_secret = @twitter_consumer_secret\n config.access_token = @twitter_access_token\n config.access_token_secret = @twitter_access_token_secret\n end\nend", "title": "" }, { "docid": "bf197d426b73040d1dce4eb38ca7c855", "score": "0.62056315", "text": "def twitter_index\n if user_is_logged_in?\n if SocialMedium.find_by_provider_and_user_id(\"twitter\",session[:user_id])\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"9KgIgsd0LoGJBpDTUxydENoMs\"\n config.consumer_secret = \"6ohRmMBev9V5XNrQ6kDkk6p8cR6l9SlKd4NbVFIp7aNAG0biVb\"\n config.access_token = \"781715888861024256-aTtNbHLZDzSf314WNkTt2HRhUapWjeI\"\n config.access_token_secret = \"gkBVX5ohujRjTPNEcHsk2BQtU31HpUJe22XbsoiQR6H3j\"\n end\n @[email protected]_timeline(count: 7)\n add_breadcrumb \"twitter home\", social_media_twitter_index_path\n else\n redirect_to users_twttr_login_path\n end\n else\n redirect_to users_login_path\n end\n end", "title": "" }, { "docid": "a793683d0aab0858adb338e2607635c4", "score": "0.62055856", "text": "def load_twitter\n fetcher = DataFetcher.new(Authorizer.instantiate_token)\n fetcher.get_twitter_data\n redirect_to root_path\n end", "title": "" }, { "docid": "eb6ee3dfdd34ea7f5f66b8d653035934", "score": "0.62013584", "text": "def twitter\n\n \t\t# create the users twitter client and return it! as a new object\n \t\treturn Twitter::Client.new(\n\n \t\t\t:oauth_token => self.key,\n \t\t\t:oauth_token_secret => self.secret,\n \t\t)\n\n \tend", "title": "" }, { "docid": "b1e8425334ecb2115c74fd27a0bd9506", "score": "0.6197756", "text": "def twitter\n @twitter ||= Twitter::Client.new(\n oauth_token: access_token,\n oauth_token_secret: access_token_secret\n )\n end", "title": "" }, { "docid": "2c311888845225632f2790191d8855b5", "score": "0.6168815", "text": "def twitter_url\n \"#{TWITTER_BASE}/#{twitter}\" unless twitter.blank?\n end", "title": "" }, { "docid": "10e65ef754b33cb7c1d7c61486ef5597", "score": "0.61544937", "text": "def start_streaming_tweets\n \n end", "title": "" }, { "docid": "6f5009663a76207731dd4e819cb47de0", "score": "0.6152363", "text": "def fetch\n fetcher {|params| ActiveTwitter.tweets(:mine, params)}\n super\n end", "title": "" }, { "docid": "140c8bf0cf1b7f73c55aaa0f8b2a8d2c", "score": "0.615054", "text": "def fetch_tweets!\n tweets_from_api = $client.user_timeline(username)\n tweets_from_api.each do |tweet|\n tweets.create(text: tweet.text,\n twitter_time: tweet.created_at)\n end\n end", "title": "" }, { "docid": "0d474a6436f99c78ca5106d9c602356c", "score": "0.6148252", "text": "def twitters\n @request_token = UsersController.consumer.get_request_token\n session[:request_token] = @request_token.token\n session[:request_token_secret] = @request_token.secret\n # Send to twitter.com to authorize\n return redirect_to(@request_token.authorize_url)\n end", "title": "" }, { "docid": "6b9094b4dd6157792c87c2bd579cafd8", "score": "0.61470896", "text": "def request_followers(uid)\n followers = []\n cursor = -1\n page_count = 0\n until cursor == 0\n url = \"https://api.twitter.com/1.1/followers/ids.json?cursor=#{cursor}&id=#{uid}\"\n response = send_request(url)\n additional_followers = response['ids']\n followers = (followers << additional_followers).flatten\n cursor = response['next_cursor']\n puts \"requesting followers, on page #{page_count}\"\n page_count++\n end\n followers\n end\n \n # Use cURL to request and return the screen_name associated with an id number\n def request_screen_name(uid)\n url = \"https://api.twitter.com/1.1/users/show.json?user_id=#{uid}\"\n response = send_request(url)\n name = response['screen_name']\n name\n end\n \n # Use cURL to request and return the id number associated with a screen_name\n def request_uid(screen_name)\n url = \"https://api.twitter.com/1.1/users/show.json?screen_name=#{screen_name}\"\n response = send_request(url)\n uid = response['id']\n uid\n end\n \n private\n \n def send_request(url)\n c = Curl::Easy.perform(url) do |curl|\n curl.headers[\"Authorization\"] = @auth_token\n end\n response = JSON.parse(c.body_str)\n response\n end\nend", "title": "" }, { "docid": "b5682424cf42b8d231c862c5d92c9577", "score": "0.61357605", "text": "def tweet\n @tweet ||= nil # TODO: make a network call and retrieve the tweet.\n end", "title": "" }, { "docid": "944561aa3c80dfd1a9e61880b0bb0dbd", "score": "0.61329913", "text": "def get_tweets search_text\n begin\n # hit the API\n TWITTER_CLIENT.client.search(search_text, :count => 10, :result_type => \"recent\").collect do |tweet|\n @tweets << \"#{tweet.urls}\"\n end\n rescue\n @show_error_message = \"It seems that something has went wrong,Please try after some time\" if @tweets == nil\n end\n\n end", "title": "" }, { "docid": "72b8596352e6dcacc6efa8a9e14cadbe", "score": "0.6118419", "text": "def twitter\n if provider == \"twitter\"\n @twitter ||= Twitter::Client.new(oauth_token: oauth_token, oauth_token_secret: oauth_secret)\n end\n end", "title": "" }, { "docid": "8f4405a0ff4662494698ba33c081bff4", "score": "0.6112401", "text": "def twitter\n @twitter ||= Twitter::Base.new('tweetfleet', 'v4mp1r3')\n end", "title": "" }, { "docid": "8f4405a0ff4662494698ba33c081bff4", "score": "0.6112401", "text": "def twitter\n @twitter ||= Twitter::Base.new('tweetfleet', 'v4mp1r3')\n end", "title": "" }, { "docid": "1b0a77d572f1cfd5c1da568f10d6fa5a", "score": "0.61074996", "text": "def initialize\n puts \"MicroBlogger is get Start in\"\n @client = JumpstartAuth.twitter\n end", "title": "" }, { "docid": "186087f0d982d23b06e470a3c1108f19", "score": "0.6106577", "text": "def tweets\n @tweets = begin\n client = twitter_client_config\n client.user_timeline(@user_name, {:count => 10})\n rescue Exception => e\n 'Twitter account not found !!!'\n end\n end", "title": "" }, { "docid": "ca988ebeade5d86c77058e756fba8508", "score": "0.6094289", "text": "def getIncomingTweets\n @client.user_timeline(\"StockTwits\", :count => 200, :max_id => 360024446179869000\n\n\n\n\n).each do |tweet|\n puts \"\\\"\" + tweet.text.gsub(/\"/, '').gsub(/(?:f|ht)tps?:\\/[^\\s]+/, '') + \"\\\",\" + tweet.id.to_s\n end\n end", "title": "" }, { "docid": "568df19645ed16775738e598cb8afd91", "score": "0.60940576", "text": "def twitter_client\n @twitter_client ||= Twitter::Client.new\n end", "title": "" }, { "docid": "a9e6d3535deb618e50334b91509f3699", "score": "0.6082007", "text": "def twitter_client\n RandomTwitterClient.new\n end", "title": "" }, { "docid": "a9e6d3535deb618e50334b91509f3699", "score": "0.6082007", "text": "def twitter_client\n RandomTwitterClient.new\n end", "title": "" }, { "docid": "d0e3164a6996fe45a2533fb2fa37c133", "score": "0.6070188", "text": "def stub_twitter_user_timeline_request(tweets_to_return)\r\n return if ENV[\"DisableWebmock\"] == \"true\"\r\n stub_request(\r\n :get,\r\n \"https://api.twitter.com/1.1/statuses/user_timeline.json?user_id=0\"\r\n ).to_return(status: 200, body: tweets_to_return.to_json, headers: {})\r\n end", "title": "" }, { "docid": "9b7565f5ff7a3c9541e3a42aea8fd71c", "score": "0.6058702", "text": "def getTweets(type,name, parameter={})\n tweets_url = \"http://api.twapperkeeper.com/2/notebook/tweets/?apikey=\"\n query = \"#{tweets_url}#{apikey}\"\n if type == \"hashtag\" || type == \"keyword\" || type == \"person\" || type == \"collection\" || type == \"person-collection\"\n query+= \"&type=#{type}\"\n else\n raise ArgumentError, \"No valid type given\", caller\n end\n if name != nil\n query+= \"&name=#{name}\"\n else\n raise ArgumentError, \"No valid name given\", caller\n end \n #optional Parameter\n if parameter[:lang] != nil\n query+= \"&lang=#{parameter[:lang]}\"\n end\n if parameter[:max_id] != nil\n query+= \"&max_id=#{parameter[:max_id]}\"\n end\n if parameter[:since_id] != nil\n query+= \"&since_id=#{parameter[:since_id]}\"\n end \n if parameter[:until] != nil\n query+= \"&until=#{parameter[:until]}\"\n end \n if parameter[:order_by] == \"a\" || parameter[:order_by] == \"d\"\n query+= \"&order_by=#{parameter[:order_by]}\"\n end \n if parameter[:nort] == 0 || parameter[:nort] == 1\n query+= \"&nort=#{parameter[:nort]}\"\n end \n if parameter[:text] != nil\n query+= \"&text=#{parameter[:text]}\"\n end \n if parameter[:from_user] != nil\n query+= \"&from_user=#{parameter[:from_user]}\"\n end \n if parameter[:latitude] != nil\n query+= \"&latitude=#{parameter[:latitude]}\"\n end\n if parameter[:longitude] != nil\n query+= \"&longitude=#{parameter[:longitude]}\"\n end \n if parameter[:radius] != nil\n query+= \"&radius=#{parameter[:radius]}\"\n end \n if parameter[:rpp] != nil\n query+= \"&rpp=#{parameter[:rpp]}\"\n end \n if parameter[:page] != nil\n query+= \"&page=#{parameter[:page]}\"\n end \n return sendRequest(query)\n end", "title": "" }, { "docid": "3c8cdd8bd0b5a1ed5c11282ba7c8f223", "score": "0.6057588", "text": "def twitter?; twitter.present? end", "title": "" }, { "docid": "496a00316d5888d70a6680459fd28fa4", "score": "0.6057007", "text": "def process_tweets\n tweet_timeline = $client.mentions_timeline\n \n @tweet_timeline.each do |tweet|\n tweet.user.screen_name\n tweet.text\n end\n\n #get user and information supplied, then reply to the tweeter\n #tweet = $client.update(\"#{}\")\n end", "title": "" }, { "docid": "8193e8a48faef4705483b5701963b95b", "score": "0.60536057", "text": "def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend", "title": "" }, { "docid": "45c6ff108f22dd6168f411d80a53d834", "score": "0.605335", "text": "def twitter_authorization_callback\n access_token = session['twitter_client'].authorize(\n session[:temp_twitter_token],\n session[:temp_twitter_secret],\n :oauth_verifier => params[:oauth_verifier]\n )\n\n session[:temp_twitter_token] = nil\n session[:temp_twitter_secret] = nil\n if session['twitter_client'].authorized?\n session[:twitter_access_token] = access_token.token\n session[:twitter_secret_token] = access_token.secret\n\n profile = session['twitter_client'].info\n user_data = {\n :userId => current_user_id,\n :twitterId => profile[\"id\"],\n :accessToken => access_token.token,\n :tokenSecret => access_token.secret,\n :profileUrl => \"https://twitter.com/#{profile[\"screen_name\"]}\",\n :profilePictureUrl => profile[\"profile_image_url\"]\n }\n api_endpoint = \"#{Settings.api_endpoints.AddTweeterDetails}\"\n add_twitter_response = Typhoeus.post(api_endpoint, body: user_data)\n unless add_twitter_response.success?\n log_errors(add_twitter_response.return_message)\n end\n session[:twitter_client] = nil\n render :text => \"accessToken: #{access_token.token} tokenSecret: #{access_token.secret}\"\n else\n redirect :action => login_with_twitter\n end\n session[:twitter_client] = nil\n end", "title": "" }, { "docid": "92235ceaf5d72e8801c7288be12fcbc9", "score": "0.6053242", "text": "def twitter\n unless @twitter_user\n @twitter_user = Twitter::Client.new(:oauth_token => self.authentication_token, :oauth_token_secret => self.secret) rescue nil\n end\n @twitter_user\n end", "title": "" }, { "docid": "81bd0e4ea748cbace1ab704c472970af", "score": "0.60514563", "text": "def callback\n auth_hash\n # not supported right now, no access to twitter ads granted\n # @@ads_client = TwitterAds::Client.new(\n # Rails.application.secrets.twitter_api_key,\n # Rails.application.secrets.twitter_api_secret,\n # auth_hash.token,\n # auth_hash.secret\n # )\n\n redirect_to '/twitter'\n end", "title": "" }, { "docid": "d547f9c856bf083f75a9d3020558d3b4", "score": "0.6046172", "text": "def get_twitter_client(user)\n\n client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => user.credential_token, \n :secret => user.credential_secret\n )\n\nend", "title": "" }, { "docid": "07ab5797081716ecfd140fae49c50bf6", "score": "0.6041624", "text": "def twitter_callback\n request_token = OAuth::RequestToken.new(oauth_consumer, session['rtoken'], session['rsecret'])\n access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n reset_session\n session['atoken'] = access_token.token\n session['asecret'] = access_token.secret\n profile = twitter_client.verify_credentials\n \n twitter_user = User.find_by_twitter_token_and_twitter_secret(access_token.token, access_token.secret)\n \n # If user is logged in and clicked on \"Link\"\n if logged_in?\n current_user.twitter_secret = access_token.secret\n current_user.twitter_token = access_token.token\n current_user.save(false)\n \n #twitter_client.update(\"I'm using @duffelup's Visual Trip Planner. http://duffelup.com\", {})\n flash[:notice] = \"You linked your Twitter account!\"\n redirect_to(dashboard_path) and return\n end\n \n # If user is not logged in\n if !twitter_user.nil?\n self.current_user = twitter_user\n\n redirect_back_or_default(dashboard_path, params[:redirect]) and return\n else # create new user\n self.current_user = User.create_from_twitter_oauth(profile, session['atoken'], session['asecret'])\n \n Friendship.add_duffel_professor(current_user)\n \n # Create a new duffel as \"research duffel\"\n Trip.create_duffel_for_new_user({ :title => \"#{current_user.username}'s first duffel\", :start_date => nil,\n :end_date => nil, :is_public => 1, :destination => \"San Francisco, CA, United States\" }, current_user)\n \n # Add a city to follow its travel deals\n current_user.cities << City.find_by_id(609)\n \n #twitter_client.update(\"I'm checking out @duffelup's Visual Trip Planner. http://duffelup.com\", {})\n \n redirect_to(steptwo_path) and return\n end\n\n end", "title": "" }, { "docid": "7d510b056c5e68a1b8b28061fa2f01bc", "score": "0.6029547", "text": "def tweet\n return \"tweeet\"\n end", "title": "" }, { "docid": "6502b5e8b1c362d537f3de23a8eea847", "score": "0.60250074", "text": "def connect_to_twitter\n begin\n @client = TwitterWrapper.get_client\n rescue Exception => e\n puts \"\\nThere was an error while connecting to Twitter: #{e.message}\"\n end\n end", "title": "" }, { "docid": "e2a50cda10fc45cc6610d372dbc240cb", "score": "0.60019326", "text": "def mytweets\n # if cancan properly used, these method calls would be removed.\n authorize! :mytweets, Tweet\n @tweets = Tweet.where user_id: current_user.id\n @tweet=current_user.tweets.new\n @page=2\n end", "title": "" }, { "docid": "ad2ea1d3b1df45b88ddb886600bd47af", "score": "0.59988886", "text": "def tweets(username)\n tweet_request = self._tweets_request(username)\n tweet_list_json = @access_token.get(tweet_request).body\n tweet_list = JSON.parse(tweet_list_json)\n \n # TODO: We should act proactively in order to avoid being\n # rate limited; Twitter explicitly mentions applications which\n # consistently exceed rate limiting will be blacklisted\n while tweet_list.size > 0 && tweet_list.first['errors'].nil?\n tweet_list.each { |tweet| yield tweet }\n max_id = tweet_list.min_by { |tweet| tweet['id'].to_i }['id']\n tweet_request = self._tweets_request(username, max_id)\n tweet_list_json = @access_token.get(tweet_request).body\n tweet_list = JSON.parse(tweet_list_json)\n end\n end", "title": "" }, { "docid": "7a1f63b052de33e055b94f9ecc59c9b7", "score": "0.599149", "text": "def twitter\n require './lib/twitter'\n\n if @twitter.nil? then\n @twitter = TwitterLinks::Twitter.new(token, secret)\n end\n\n @twitter\n end", "title": "" }, { "docid": "910634b434d1668ba2dbe15077a08233", "score": "0.59911716", "text": "def index\n p \"*\"*100\n p Rails.application.secrets.consumer_api_key\n p Rails.application.secrets.consumer_api_secret\n p Rails.application.secrets.access_token\n p Rails.application.secrets.access_token_secret\n p \"*\"*100\n\n @client = Twitter::REST::Client.new do |config|\n\n config.consumer_key = ENV['CONSUMER_API_KEY']\n config.consumer_secret = ENV['CONSUMER_API_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n\n # config.consumer_key = CONSUMER_API_KEY\n # config.consumer_secret = CONSUMER_API_SECRET\n # config.access_token = ACCESS_TOKEN\n # config.access_token_secret = ACCESS_TOKEN_SECRET\n\n # config.consumer_key = Rails.application.secrets.consumer_api_key\n # config.consumer_secret = Rails.application.secrets.consumer_api_secret\n # config.access_token = Rails.application.secrets.access_token\n # config.access_token_secret = Rails.application.secrets.access_token_secret\n\n end\n\n @tweets = @client.user_timeline('casetabs', count: 20)\n\n @tweets_arr = []\n\n @tweets.each { |tweet| @tweets_arr << tweet }\n\n\n\n respond_with :api, :v1, (@tweets_arr)\n\n end", "title": "" }, { "docid": "d30d4f1737d249f82b79768e031f20aa", "score": "0.59910315", "text": "def tweet\n\treturn \"tweet tweet\"\nend", "title": "" }, { "docid": "f6de9e2acdac73d410adda59f5c0b560", "score": "0.59904134", "text": "def request_token_twitter\n\n consumer = OAuth::Consumer.new(CONSUMER_KEY_TWITTER, CONSUMER_SECRET_TWITTER,\n { :site => \"https://twitter.com\" })\n \n \n request_token = consumer.get_request_token(:oauth_callback => SITE + '/oauth/callback_twitter')\n\n session[:request_token] = request_token.token\n session[:request_token_secret] = request_token.secret\n\n redirect_to request_token.authorize_url(:oauth_callback => SITE + '/oauth/callback_twitter')\n\nend", "title": "" }, { "docid": "0955032f4f7c86b5e4df32bf432f2000", "score": "0.59898347", "text": "def tweet_it(member, tweet)\n if member.twitter_settings\n url = $1 if tweet =~ %r|(http://[^\\s]*)|\n resp = member.twitter_settings.authed_twitter_client.update(tweet)\n tweet_id = resp[\"id\"]\n tweet_url = \"http://twitter.com/#{member.twitter_settings.tw_uid}/statuses/#{tweet_id}\"\n notice = \"Your tweet is posted @ <a href='#{tweet_url}'>#{tweet_url}</a>. Please try again in a bit if didn't show up there.\"\n# success_test = url || tweet\n# if (resp[\"text\"] =~ %r|#{success_test}|)\n# tweet_id = resp[\"id\"]\n# tweet_url = \"http://twitter.com/#{member.twitter_settings.tw_uid}/statuses/#{tweet_id}\"\n# notice = \"Your tweet is posted @ <a href='#{tweet_url}'>#{tweet_url}</a>\"\n# else\n# tweet_id = nil\n# error = \"We are sorry! Your tweet didn't go through. Please try again, or email us so we can take a look at this!\"\n# logger.error \"Tweet #{tweet} with #{url} failed to go through for #{member.id}\"\n# end\n else\n # SSS: We should never ever get here because the tweet option should never have been shown to the user in the first place!\n # But, just a safeguard!\n error = \"We are sorry! You need to link your Twitter and #{SocialNewsConfig[\"app\"][\"name\"]} accounts to post on Twitter. Please visit your account page to do this!\"\n end\n { :id => tweet_id, :error => error, :notice => notice }\n rescue Twitter::General\n { :error => \"We are sorry! You have reached Twitter's 24-hour limits and cannot make any more posts today (See http://help.twitter.com/forums/10711/entries/15364 for more information)\" }\n rescue Twitter::Unauthorized\n { :error => \"We are sorry! We no longer have the authorization to tweet on your behalf! <a href='#{twitter_authenticate_path}' style='color:green;font-weight:bold;' target='_blank'>Please click here to authorize us to tweet on your behalf.</a>\" }\n rescue Exception => e\n logger.error \"ERROR tweeting #{tweet} #{url} on behalf of #{member.id}! Exception: #{e}; Backtrace: #{e.backtrace.inspect}\"\n { :error => \"We are sorry! We encountered an unknown error tweeting on your behalf. The error has been logged and we'll look into this as soon as possible!\" }\n end", "title": "" }, { "docid": "c0ac5f4f1b2fc250b190eb5ca4221fb4", "score": "0.5987304", "text": "def twitter_api_authenticate!\n Twitter.configure do |config|\n config.consumer_key = TWITTER_KEY\n config.consumer_secret = TWITTER_SECRET\n config.oauth_token = token\n config.oauth_token_secret = secret\n end\n end", "title": "" }, { "docid": "fff62af8f2cce4b4b0418533094e4fd4", "score": "0.5984011", "text": "def getsTweetText(username,token,tweetcount)\r\n\tresponse = token.request(:get,\r\n\t\"https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=#{username}&count=#{tweetcount}\")\r\n\tresult = JSON.parse(response.body)\r\n\tsleep 1\r\n\ttweets_array = result.map{ |hash|\r\n\t\t#When the twitter api return an error it returns an object with two things\r\n\t\t#-an error message and a code # instead of the larger object\r\n\t\tif hash.size ==2\r\n\t\t\tputs \"Error: #{hash[1][0][\"message\"]}\"\r\n\t\t\tif hash[1][0][\"code\"] !=34\r\n\t\t\t\tabort(\"program ended prematurely\\nError: #{hash[1][0][\"message\"]}\") #find documentation about abort\r\n\t\t\tend\r\n\t\telse\r\n\t\t\thash[\"text\"] #think about when to continue, but and when to raise errors and stop\r\n\t\tend\r\n\t}\r\nend", "title": "" }, { "docid": "a49b192276fae4403c7a3674e44bb821", "score": "0.59762126", "text": "def tweet(following)\n end", "title": "" }, { "docid": "6f63c04c10f7aa0716320cef656110af", "score": "0.5974302", "text": "def _GetTwitterData\n consumer = OAuth::Consumer.new(\"InspcUqL1BllUxvd78Y0Q\", \"NwNWjKA1RDNcNKKcwC0UtaRNcC9Edy1zOgxFmhwzd8\",{\n :site => \"http://api.twitter.com\",\n :scheme => :header\n }\n )\n token_hash = { :oauth_token => \"1368765691-5psuTFZTZ4WhzOD3y46kTLwJpLqtc6ToU5oYco9\",\n :oauth_token_secret => \"NdNubll9qQzIMZBeBGfRM2wMnxZjr1ThcqFKhzaXiAmHj\"\n }\n access_token= OAuth::AccessToken.from_hash(consumer,token_hash)\n @response=Ratelimit.rate_limit(consumer,access_token)\n end", "title": "" }, { "docid": "3b39f16e470fe825181fca9ed162fd1f", "score": "0.59564435", "text": "def tweets?\n twitter?\n end", "title": "" }, { "docid": "45fb0b4fead66594dc78544d07e7bb8f", "score": "0.5945843", "text": "def index\n\n \n if params[:screen_name].present?\n tweets_count = 200\n begin \n request_params = {:count => tweets_count, :include_rt => false }\n @tweets = get_user_tweets(params[:screen_name])\n rescue\n end\n else\n @tweets = [{:id=>1, :text=>\"dummy\", :created_at=>123}]\n end\n @tweets = Tweet.all()\n\n \n end", "title": "" }, { "docid": "56bfa67adfd589052f82cfc05aecdca3", "score": "0.59437895", "text": "def configure\n\t# insert /1.1 types\n\tbaseurl = \"https://api.twitter.com\"\n\taddress = URI(\"#{baseurl}#{@path}?#{@query}\")\n\trequest = Net::HTTP::Get.new address.request_uri\n\n\t# Set up HTTP.\n\thttp = Net::HTTP.new address.host, address.port\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n\t##credential oauth\n\n\tconsumer_key = OAuth::Consumer.new(\n\t \"OerU09ehRUZ5KOXMRPj2BOHh6\",\n\t \"KaOIq8Y8xLAIM51AZLJCK1E1Zs5d4uZAl1KFxxN8oRvKxlwMG9\")\n\taccess_token = OAuth::Token.new(\n\t \"292110213-3P0uHIyz9q25mOKTaI4G48Jzv7xoR7GKI5pt8hVA\",\n\t \"BI639AC1vn74tlguEdilmP7lWXlTOxsh1WXEDYjy7AP7W\")\n\n\t# Issue the request.\n\trequest.oauth! http, consumer_key, access_token\n\thttp.start\n\tresponse = http.request request\n\n\t# Parse and print the Tweet if the response code was 200\n\t\tif response.code == '200' then\n\t\t\tputs \"success\"\n\t\t\t$tweets= JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Your connection failed!\"\n\t\tend\nend", "title": "" }, { "docid": "9198cd5b1b377f1b4252756753eda7c3", "score": "0.5941358", "text": "def fetch_tweets(screen_name)\n\t\tif @client.blank?\n\t\t\tconnect_to_twitter\n\t\tend\n\t\ttweets = @client.user_timeline(screen_name)\n\t\ttweet_texts = tweets.collect{|tweet| tweet.text}\n\t\treturn tweet_texts\n\tend", "title": "" }, { "docid": "895aa559dc1a9829b45c0187c631a2a3", "score": "0.59412044", "text": "def get_tweets\n tweets = TwitterService.new.get_tweets(params[:screen_name])\n respond_to do |format|\n format.json { render json: tweets }\n end\n end", "title": "" }, { "docid": "68f9606bfe28ac295453ec3a721ec291", "score": "0.59360856", "text": "def tweet\n return \"tweet tweet\"\n end", "title": "" }, { "docid": "2dc3039066d66e4e7f922f89f732c60a", "score": "0.5932749", "text": "def read_public_twitter()\n return read_twitter(\"public_timeline\")\n end", "title": "" }, { "docid": "503dc6b2ad0859b3879276407a53ea0d", "score": "0.5927179", "text": "def on_user_timeline_tweet(tweet) \n if tweet.text.downcase.index(\"rt @#{@myself}\") != nil \\\n and @lisa.client.status(tweet.id).user.following? == false # Don't use tweet.user.*? methods as they'll have stale results\n # Sleeping nature of RW actions need this to be run in a new thread. \n # What if we receive another retweet when sleep is active - hence the thread\n LisaToolbox.run_in_new_thread(:RT_on_user_timeline_tweet) {\n log tweet, \"RT on_user_timeline_tweet\"\n # I was retweeted, do something for the retweeter only if he's new\n messages = [\n \"@#{tweet.user.handle}, love the RT. Let's shake hands on Twitter :)\",\n \"@#{tweet.user.handle}, thanks for the RT. Let's connect\",\n \"@#{tweet.user.handle}, RT's are awesome. Let's connect :)\",\n \"@#{tweet.user.handle}, RT is much appreciated. Lets keep in touch!\",\n ]\n message = messages[rand(messages.length)]\n @lisa.tweet_without_media(message) \n @lisa.follow(tweet.user, false)\n }\n end # if\n end", "title": "" }, { "docid": "8096787f53c49518a6b596c545f25768", "score": "0.5925029", "text": "def twitter\n\t\t@client ||= Twitter::REST::Client.new do |config|\n\t\t config.consumer_key = Rails.application.secrets.twitter_api_key\n\t\t config.consumer_secret = Rails.application.secrets.twitter_api_secret\n\t\t config.access_token = token\n\t\t config.access_token_secret = secret\n\t\tend\n\tend", "title": "" }, { "docid": "a0639179201b8545aba6180f0ce9a319", "score": "0.59240997", "text": "def get_tweets # gets tweets connected to a trend\n\t\tget_twitter_client.search(\"#{self.name}\", result_type:\"recent\", lang: \"en\").attrs[:statuses]\n\t\t# in the future, add logic to get a more location-diverse sample of tweets\n\tend", "title": "" }, { "docid": "a0639179201b8545aba6180f0ce9a319", "score": "0.59240997", "text": "def get_tweets # gets tweets connected to a trend\n\t\tget_twitter_client.search(\"#{self.name}\", result_type:\"recent\", lang: \"en\").attrs[:statuses]\n\t\t# in the future, add logic to get a more location-diverse sample of tweets\n\tend", "title": "" }, { "docid": "43d7b29635a05c42eb90ee9b29327365", "score": "0.5922571", "text": "def on_timeline(tweet)\n #do nothing\n end", "title": "" }, { "docid": "c3e35fd83917d4e47b119afb1a4029ea", "score": "0.59199893", "text": "def fetch_tweet!\n client = Twitter::Client.new.configure do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.oauth_token = ENV['OAUTH_TOKEN']\n config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']\n end\n\n \n tweets = client.search(word, :lang => \"en\", :count => 1).results\n if tweets.empty?\n return false\n else\n tweet = tweets.first\n tweet_text = tweet.text \n return [select_word(tweet_text).first, tweet]\n end\n end", "title": "" }, { "docid": "efcb65eddcd5952ad9446b745656c3be", "score": "0.5916413", "text": "def check_tweets(tweets_num)\n puts \"Checking #{tweets_num} latest tweets...\"\n\n sj = Swearjar.default\n\n # Get keys and secrets from local file (not in repo anymore...)\n # In file ./creds add each on a newline matching below\n creds = File.readlines('./creds')\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = creds[0].chomp\n config.consumer_secret = creds[1].chomp\n config.access_token = creds[2].chomp\n config.access_token_secret = creds[3].chomp\n end\n\n generated_haiku = false\n\n search_terms = '(#gaming OR #games OR #ghostoftsushima OR #ghostsoftsushima OR #videogames OR #fallguys) -rt'\n client.search(search_terms, result_type: 'recent', lang: 'en').take(tweets_num).collect do |tweet|\n # Skip if we generated a haiku this search.\n next if generated_haiku\n\n # Skip if it has discriminatory language.\n scorecard = sj.scorecard(tweet.text)\n next if scorecard.key?('discriminatory') && (scorecard['discriminatory']).positive?\n\n @words = []\n\n # Setting encoding options to remove tweets with garbage characters\n encoding_options = {\n invalid: :replace, # Replace invalid byte sequences\n undef: :replace, # Replace anything not defined in ASCII\n replace: '', # Use a blank for those replacements\n universal_newline: true # Always break lines with \\n\n }\n\n t_text = tweet.text.tr('#@$', '').encode(Encoding.find('ASCII'), encoding_options).dup\n t_name = tweet.user.screen_name.dup\n\n # this removes @ and # entries\n # t_text.gsub!(/\\B[@#]\\S+\\b/, '')\n t_text.gsub!(/#{URI::DEFAULT_PARSER.make_regexp}/, '')\n if File.exist?(\"#{@settings[:img_path]}/#{tweet.id}.jpg\")\n puts \"File exists for #{tweet.id}. Skipping.\"\n next\n end\n\n total_syl = t_text.count_syllables\n if total_syl == 17\n puts \"Tweet #{tweet.user.id} has exactly #{total_syl} syllables.\"\n @words = escape_characters_in_string(t_text).split(' ')\n lines = ['', '', '']\n\n # First line. 5 syllables.\n lines[0] = get_line(5)\n next unless lines[0]\n\n # Second line. 7 syllables.\n lines[1] = get_line(7)\n next unless lines[1]\n\n # Third line. 5 syllables.\n lines[2] = get_line(5)\n next unless lines[2]\n\n bylines_arr = File.readlines('./by_lines')\n byline = bylines_arr.sample.chomp.gsub('%NAME%', t_name)\n puts \"Generated Haiku from Tweet ##{tweet.id}!\\n\"\n puts byline\n puts lines\n puts \"- #{t_name}\"\n make_image(\"#{lines[0]}\\n#{lines[1]}\\n#{lines[2]}\\n- @#{t_name}\", tweet.id)\n posted_tweet = client.update_with_media(byline, File.new(\"#{@settings[:img_path]}/#{tweet.id}.jpg\"))\n puts \"Tweet #{posted_tweet.id} posted: #{posted_tweet.url}\"\n generated_haiku = true\n else\n abort_text = total_syl > 17 ? 'too many' : 'too few'\n puts \"Phrase has #{abort_text} syllables (#{total_syl})!\"\n end\n end\n timeout_length = generated_haiku ? 3600 : 120\n tweet_timeout(timeout_length)\nend", "title": "" } ]
82f3b7f9ee94ce08461e2f828baa7f28
Returns the document date. If metadata is not present then calculates it based on Jekyll::Sitetime or the document file modification time. Return document date string.
[ { "docid": "dc7602904bb9be2afd223890faee93db", "score": "0.6870719", "text": "def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end", "title": "" } ]
[ { "docid": "9c6a61a72cb8d90777aad74bdacd9b5c", "score": "0.6695055", "text": "def datacite_issued_date\n res = resources.with_public_metadata.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end", "title": "" }, { "docid": "8ff8cd11d03ed944b6a537f03d163d61", "score": "0.661341", "text": "def date\n return @_date if @_date\n\n frontmatter_date = data['date']\n\n # First get the date from frontmatter\n @_date = if frontmatter_date.is_a? Time\n frontmatter_date.in_time_zone\n else\n Time.zone.parse(frontmatter_date.to_s)\n end\n\n # Next figure out the date from the filename\n source_vars = blog_data.source_template.variables\n\n if source_vars.include?('year') &&\n source_vars.include?('month') &&\n source_vars.include?('day')\n\n filename_date = Time.zone.local(path_part('year').to_i, path_part('month').to_i, path_part('day').to_i)\n if @_date\n raise \"The date in #{path}'s filename doesn't match the date in its frontmatter\" unless @_date.to_date == filename_date.to_date\n else\n @_date = filename_date.to_time.in_time_zone\n end\n\n end\n\n raise \"Blog post #{path} needs a date in its filename or frontmatter\" unless @_date\n\n @_date\n end", "title": "" }, { "docid": "d6968e6affb3a541de85de71821acf35", "score": "0.64975506", "text": "def datacite_available_date\n res = resources.files_published.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end", "title": "" }, { "docid": "2f313539a0c1c876c40c749f0dcec918", "score": "0.64130014", "text": "def date\n file.version.authored_date.strftime(\"%B %d, %Y\")\n end", "title": "" }, { "docid": "8517ffab412e8bc196f4b5e7a0d036ad", "score": "0.63840914", "text": "def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['dcterms:created']\n\n @creation_date = Time.parse(metadata['dcterms:created'])\n end", "title": "" }, { "docid": "45724370ecb6215bb8760942f5926392", "score": "0.6297209", "text": "def the_datetime(content=nil, output=nil)\n if node = content || @content || Content.get(params[:id])\n output.nil? ? node.created_at : node.created_at.strftime(output)\n else\n \"<strong>Error:</strong> No creation date could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end", "title": "" }, { "docid": "1e623ba9f6877159df87f79b7237cd98", "score": "0.6251047", "text": "def publication_date\n end", "title": "" }, { "docid": "fa536414e1bf0d3cddfc819b73730394", "score": "0.6205872", "text": "def date\n page.version.authored_date.strftime(\"%B %d, %Y\")\n end", "title": "" }, { "docid": "c940c8812f9707a32b6778ed5637e8e9", "score": "0.61924994", "text": "def display_date\n if self.publication_date\n if self.volume && self.issue\n # just the year, ma'am\n I18n.localize(self.publication_date, :format => \"%Y\")\n else\n # whole date, since we got it\n I18n.localize(self.publication_date, :format => \"%d %b %Y\")\n end\n elsif self.year\n self.year.to_s\n else\n nil\n end\n end", "title": "" }, { "docid": "fbecfce8ff78e7f239274188c1102cff", "score": "0.61837816", "text": "def post_date\n find_post_content @file_contents, '<p class=\"date\">', 4\n end", "title": "" }, { "docid": "b2aa011cb4cec9d6b6bc656e99895452", "score": "0.6174069", "text": "def publication_date\n if @publishing_detail\n @publishing_detail.publication_date\n end\n end", "title": "" }, { "docid": "7bba7b31b62a6cf952319bd6197a02d9", "score": "0.6150265", "text": "def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['Creation-Date']\n\n @creation_date = Time.parse(metadata['Creation-Date'])\n end", "title": "" }, { "docid": "150707c37435f2c543f540bfed11de42", "score": "0.6135717", "text": "def release_date\n document[\"release\"][\"releaseDate\"] rescue nil\n end", "title": "" }, { "docid": "ea5c94b7215beebe6389c3bca424e225", "score": "0.61119586", "text": "def creation_date\n# stat.ctime\n @bson['uploadDate'] || Date.new\n end", "title": "" }, { "docid": "63376fc71241133b8814ad0b1f880a61", "score": "0.6094946", "text": "def publication_date\n object.publication_date.strftime \"%Y-%m-%d\"\n end", "title": "" }, { "docid": "e4707b2e4a0eb0c5ade03b36b0e7e564", "score": "0.6087317", "text": "def date\n return @date if @date\n if matches = class_const(:DATE_RE).match(page)\n @date = matches[1].to_s.strip\n date_processor\n @date\n end\n end", "title": "" }, { "docid": "c6c598bdb8da7cb15ade58a7681cdf8c", "score": "0.60384566", "text": "def publication_date\n Time.parse self.table[:publication_date]\n end", "title": "" }, { "docid": "570b8063fda78fe12510a9294366532c", "score": "0.6030246", "text": "def pub_date\n solr_output[\"pub_date\"] && solr_output[\"pub_date\"].first\n end", "title": "" }, { "docid": "e176c2b8484168e3c74ad291d91d765a", "score": "0.60150516", "text": "def formatted_date(date = nil)\n return '' unless date\n date.last_modified_date.strftime(\"%m/%d/%y\")\n end", "title": "" }, { "docid": "c074dde63c9f7e80a75aff0ebc7aa842", "score": "0.5900934", "text": "def formal_publication_date\n publication_date.to_s(:formal_wo_ordinal)\n end", "title": "" }, { "docid": "7bc52641d6acfc6a1fbb5807106e9a9a", "score": "0.5856745", "text": "def extract_publish_date( existing_payload, solr_doc, fedora_doc )\n\n # for articles\n node_list = IngestHelpers.fedora_node_list_extract( fedora_doc, 'relatedItem part date' )\n node_list.each do |n|\n return n.text if n.text.present?\n end\n\n # for books\n publish_date = IngestHelpers.fedora_first_field_extract( fedora_doc, 'mods originInfo dateOther' )\n return publish_date if publish_date.present?\n return nil\n end", "title": "" }, { "docid": "7ea78c40c16f7bd3e926c0682822f209", "score": "0.5852214", "text": "def version # :nodoc:\n if document.present?\n document.version\n else\n @metadata[:version]\n end\n end", "title": "" }, { "docid": "23899c37f9601f4419d6d8b234a3c4cb", "score": "0.58503187", "text": "def publication_date\n xpath(\"//mods:originInfo/mods:dateIssued\").text\n end", "title": "" }, { "docid": "e8c58922b35af1adfa82358981928b7f", "score": "0.58377343", "text": "def published_date_time\n return @published_date_time\n end", "title": "" }, { "docid": "e8c58922b35af1adfa82358981928b7f", "score": "0.58377343", "text": "def published_date_time\n return @published_date_time\n end", "title": "" }, { "docid": "5c2f5d8fae218352be265d12649b0250", "score": "0.5808353", "text": "def creation_date\n data.creation_date\n end", "title": "" }, { "docid": "48c4313939eaf90395676f048533e747", "score": "0.58071333", "text": "def date\n self.publicized_or_packaged || super\n end", "title": "" }, { "docid": "48c4313939eaf90395676f048533e747", "score": "0.58071333", "text": "def date\n self.publicized_or_packaged || super\n end", "title": "" }, { "docid": "9e4236591ccbc3ff96e9d87a32ad2626", "score": "0.58055484", "text": "def build_date\n Time.at(@header.build_date).to_datetime\n end", "title": "" }, { "docid": "d6aab3fd811a1feacadca2c36524f051", "score": "0.58028495", "text": "def create_date\n return DateTime.iso8601(@doc.xpath('//mets:metsHdr/@CREATEDATE').to_s)\n end", "title": "" }, { "docid": "762a928939c92b8c5a9dc254e3ec8d3c", "score": "0.57981026", "text": "def date_view value, meta=nil\n return value.strftime \"%Y-%m-%d\" unless value.nil?\n ''\n end", "title": "" }, { "docid": "80e51c2dc045b36b20187c24bb5f4cae", "score": "0.5796647", "text": "def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend", "title": "" }, { "docid": "ea3c154a577308b81037e7a4ed8b5392", "score": "0.57860243", "text": "def creation_date\n data[:creation_date]\n end", "title": "" }, { "docid": "57bb9107b63be4177f8252186008ca0e", "score": "0.577771", "text": "def date_published\n created_at.strftime(\"%b %d, %Y\")\n end", "title": "" }, { "docid": "9d5012f67c8236cb09129c93d0adc22f", "score": "0.57749915", "text": "def published_at\n node.at(\"pubDate\").text\n end", "title": "" }, { "docid": "943749c1cad8601ad92f73371ba32826", "score": "0.5774205", "text": "def published_at_date\n self[:published_at].to_s.split.first\n end", "title": "" }, { "docid": "687871cfa573c748bc1a3e410aeae9e2", "score": "0.57601", "text": "def creation_date\n stat.ctime\n end", "title": "" }, { "docid": "0674ad101478fd1b0e8038713b2846f9", "score": "0.5759699", "text": "def published_at_from_filename\n basename.to_s =~ PUBLISHED_AT_PATTERN\n Date.parse($1) rescue nil\n end", "title": "" }, { "docid": "e4b5f75cb1434e3c987a33dd7d1a076e", "score": "0.5757322", "text": "def return_date\n\t\tif(last_line_modified_date && last_modified_date != nil)\n\t\t\tif(last_line_modified_date <= last_modified_date)\n\t\t\t\treturn last_line_modified_date()\n\t\t\telse\n\t\t\t\treturn last_modified_date()\n\t\t\tend\n\t\telse\n\t\t\treturn '2000-01-01'\n\t\tend\n\tend", "title": "" }, { "docid": "e13be953ef939a79893780b6f7ac28a4", "score": "0.5752034", "text": "def getExifCreatedDate(file)\n data = Exif::Data.new(file.path)\n data.date_time.strftime(\"%F\")\n end", "title": "" }, { "docid": "4871307883ebe5dc9947a20c43f5fc72", "score": "0.57518554", "text": "def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end", "title": "" }, { "docid": "d3bcec01424eec6e74e1c4872e2a45e7", "score": "0.5738468", "text": "def last_modification_date\n return DateTime.iso8601(@doc.xpath('//mets:metsHdr/@LASTMODDATE').to_s)\n end", "title": "" }, { "docid": "534ff8d8e6b70b49207015d6a03b6e9e", "score": "0.57376564", "text": "def published\n rval = get( :published )\n return Date.parse(rval.strftime('%Y/%m/%d')) if rval.is_a? Time\n return Date.parse(rval) if rval.is_a? String\n return rval if rval.is_a? Date\n return Date.today\n end", "title": "" }, { "docid": "bf7bc3969868924f9319c24594e38d91", "score": "0.57246965", "text": "def date\n return @date if @date\n\n return Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime if ENV['SOURCE_DATE_EPOCH']\n\n return File.mtime(path) if File.exist?(path)\n\n Time.now\n end", "title": "" }, { "docid": "b895f38ec890939ab4e38f1580ef901d", "score": "0.57202226", "text": "def last_modified\n if v = @meta['last-modified']\n Time.httpdate(v)\n else\n nil\n end\n end", "title": "" }, { "docid": "f29cb68ebf78fb468fc7b920d75a82ea", "score": "0.57030976", "text": "def date\n @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)\n end", "title": "" }, { "docid": "38a6916e781a22475faaa0a50355a308", "score": "0.569505", "text": "def data_upload_date\n formatted_timestamp(data['modifyDate'])\n end", "title": "" }, { "docid": "e11b4ba79048da6b9c842ed0b393938b", "score": "0.56896794", "text": "def pub_date\n Date.today\n end", "title": "" }, { "docid": "997625688378cd223d204fcd08c5e086", "score": "0.56887215", "text": "def date\n get_scm_data if @_date.nil?\n @_date\n end", "title": "" }, { "docid": "42af732ee3c8a897fc1cb6f1159fc3f7", "score": "0.56836617", "text": "def publication_date(field = nil)\n IsoDay.cast(find_record_items(field).first)&.to_s if field\n end", "title": "" }, { "docid": "028a233633a28bf865b2edb35b7b8a73", "score": "0.5681923", "text": "def news_published_on(page)\n published_on = page.blocks.find {|b| b.identifier == 'published_on' }\n if !!published_on && !published_on.content.blank?\n DateTime.parse published_on.content\n else\n page.created_at\n end\n end", "title": "" }, { "docid": "75bb1ca239742fdb308ef7a65f03ac47", "score": "0.5674223", "text": "def date\n node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRdate[@name=\"Generation\"]', a: NS)\n node && node['date']\n end", "title": "" }, { "docid": "d99c8109eeea241b8938dbb34b05dead", "score": "0.56613004", "text": "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "title": "" }, { "docid": "08c100e4c7f02e2334c11a3b76cd1276", "score": "0.56372774", "text": "def get_creation_timestamp(path)\n nil\n end", "title": "" }, { "docid": "c956673d736b5da634c01d4ae7d8778d", "score": "0.56319267", "text": "def creation_date\n read_datetime_from_string('receipt_creation_date')\n end", "title": "" }, { "docid": "81b8180ae661dd8f82ea3e6a82b92ca9", "score": "0.5627527", "text": "def collect_posting_date(doc, offer_object)\n puts \"Mining posting date\"\n meta = doc.at('script:contains(\"localeData\")')\n # extract CDATA\n meta = meta.children[0].content\n date = meta.match(/Creation-Date:([^\\\\]+)/)[1]\n date[0] = ''\n offer_object[:posting_date] = date.to_datetime\n end", "title": "" }, { "docid": "b26580dd829d90bf50e64dfef6b7cc7d", "score": "0.56264156", "text": "def created_at; @doc['created_at']; end", "title": "" }, { "docid": "fdd5d1f0337573fe5c4dc72df53c08ad", "score": "0.56176215", "text": "def fecha_publicacion\n run_at = self.publication_date\n end", "title": "" }, { "docid": "69b85fd95d2f5fc352bc3ac43dfacc95", "score": "0.5617379", "text": "def www_date(date)\r\n if date.nil?\r\n Time.now.strftime('%d/%m/%Y')\r\n else\r\n date.strftime('%d/%m/%Y')\r\n end\r\n end", "title": "" }, { "docid": "25d34f9f29c544c019c024bfbdbf5a60", "score": "0.560849", "text": "def patch_publication_date\n @patch_publication_date ||= if @event.at('patch_publication_date')\n DateTime.strptime(@event.at('patch_publication_date').inner_text, fmt='%Y/%m/%d')\n else\n false\n end\n end", "title": "" }, { "docid": "d1660d1143ddb23910a9ded93ec566af", "score": "0.55908847", "text": "def date\n object.date.strftime('%a %b %e') rescue nil\n end", "title": "" }, { "docid": "73608def8a24fb8e588504f63bf054e2", "score": "0.5580154", "text": "def article_short_post_date(article)\n if article.posted_at.nil?\n content = article.issue.date.strftime(\"%m-%d-%Y\") \n else\n content = article.posted_at.strftime(\"%m-%d-%Y\")\n end\n content_tag('i', content)\n end", "title": "" }, { "docid": "b9da43b789377d482436d725a604ca6b", "score": "0.5579904", "text": "def zt_date date\n if date.year == Time.now.year\n l date, format: :short\n else\n l date, format: :long\n end\n end", "title": "" }, { "docid": "b3b041745264373aecd0c7d06113c887", "score": "0.5576212", "text": "def creationdate\n if !record.nil? and record.respond_to? :created_at\n record.created_at.httpdate\n end\n end", "title": "" }, { "docid": "6eddf86ad5b872f6a3131e8d63f4dcaf", "score": "0.5572655", "text": "def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end", "title": "" }, { "docid": "e57743e7e15a2498f4c97c63a8e22b38", "score": "0.5563529", "text": "def get_date_scraped\n return Date.today.to_s\nend", "title": "" }, { "docid": "e57743e7e15a2498f4c97c63a8e22b38", "score": "0.5563529", "text": "def get_date_scraped\n return Date.today.to_s\nend", "title": "" }, { "docid": "535bdd6e1b2e1d34b686dae15e83a9cf", "score": "0.55591935", "text": "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "title": "" }, { "docid": "31efe895a93391b194161976ed9dbf02", "score": "0.55541456", "text": "def ris_date\n return @ris_date if defined?(@ris_date)\n\n @ris_date ||= begin\n if start_d = @citable_attributes.date && @citable_attributes.date.parts.first\n self.class.formatted_ris_date(year: start_d.year, month: start_d.month, day: start_d.day)\n end\n end\n end", "title": "" }, { "docid": "25ff2146e41a73cb0b28890267e265b5", "score": "0.55389273", "text": "def created_at\n DateTime.parse(solr_document.fetch(\"created_at_dtsi\").to_s).utc\n end", "title": "" }, { "docid": "716c399d69a3e33447a1ac5bfe50712c", "score": "0.5536305", "text": "def date\n @date ||= @config['date']\n end", "title": "" }, { "docid": "cbd1b3e4b08e89dc1a95d644c585748d", "score": "0.5530464", "text": "def request_timestamp\n auth_info[\"date\"] || \"\"\n end", "title": "" }, { "docid": "2171c5407ebdb51071dcf5f3ef33fd35", "score": "0.5528955", "text": "def parse_date_from_metatags(metatags)\n return unless metatags\n # rubocop:disable RescueModifier\n date = Time.parse(metatags['pubdate']) rescue nil\n date || Time.parse(metatags['revision_date']) rescue nil\n # rubocop:enable RescueModifier\n end", "title": "" }, { "docid": "a8459619b61c20b2bfb7c6ca2043e235", "score": "0.5527508", "text": "def date(text)\n if datetime?(text)\n Nickel.parse(text).occurrences[0].start_date.to_date\n else\n Nickel.parse(clear_text(text)).occurrences[0].start_date.to_date\n end\n end", "title": "" }, { "docid": "c88dcdce1b7762f5d7f91e9fe5c4c8ee", "score": "0.55255574", "text": "def web_date; strftime(WEB_DATE_FORMAT); end", "title": "" }, { "docid": "1605a9d10c09d6b1c1f758f5e1f7f7ce", "score": "0.5518876", "text": "def manifestation_date\n node = @meta.at_xpath('./a:identification/a:FRBRManifestation/a:FRBRdate[@name=\"Generation\"]', a: NS)\n node && node['date']\n end", "title": "" }, { "docid": "c5e17f500c1ab3cf6733cbc8e86b76e1", "score": "0.5516638", "text": "def published_at\n handle_none post.published_at do\n time_tag(post.published_at, post.published_at.strftime('%b.%d.%Y'), pubdate: true)\n end\n end", "title": "" }, { "docid": "b1741739cfe885fdc7c0b70c421db8fd", "score": "0.55160874", "text": "def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end", "title": "" }, { "docid": "8bc89bd42e015ca991985b0bfc2d489b", "score": "0.5512247", "text": "def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end", "title": "" }, { "docid": "49262e2811b58a58497d0b565a1532dd", "score": "0.5502888", "text": "def published_date\n Date.strptime(@data['published_date'], '%Y-%m-%d')\n end", "title": "" }, { "docid": "b29effc1dbbc52c623e184beb9360927", "score": "0.55009484", "text": "def date; end", "title": "" }, { "docid": "b29effc1dbbc52c623e184beb9360927", "score": "0.55009484", "text": "def date; end", "title": "" }, { "docid": "b29effc1dbbc52c623e184beb9360927", "score": "0.55009484", "text": "def date; end", "title": "" }, { "docid": "b29effc1dbbc52c623e184beb9360927", "score": "0.55009484", "text": "def date; end", "title": "" }, { "docid": "c92d3fe335583efab2a56bde59f0c8fc", "score": "0.549153", "text": "def modification_date; end", "title": "" }, { "docid": "3afcc6f8c4605a3d8d3871f3f526c9ab", "score": "0.5484484", "text": "def publication_date\n super(:dc_date)\n end", "title": "" }, { "docid": "bfc98693dcfe5195e00c96b7c8fc1957", "score": "0.5481359", "text": "def date_str d\n Util::date(d)\n end", "title": "" }, { "docid": "7af087e1d235a958981a7aebcdf1c8e8", "score": "0.54809046", "text": "def goth_published_date(goth)\n\t\tgoth.published_at.strftime('%b %d, %Y %H:%M')\n\tend", "title": "" }, { "docid": "eedb130f887e062fc455d85dd356f336", "score": "0.54798156", "text": "def get_revdate(doc_path)\n doc = Nokogiri::HTML(File.open(doc_path)) { |config| config.strict.nonet}\n revdate = doc.search('//span[@id=\"revdate\"]').text.strip\n DateTime.strptime(revdate, '%Y-%m-%d') if /^\\d{4}-\\d{2}-\\d{2}$/.match(revdate)\nend", "title": "" }, { "docid": "c0586d402fd357350e8d04bf69469334", "score": "0.54792184", "text": "def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end", "title": "" }, { "docid": "b67bf71b795b12d4bb30e9515989c785", "score": "0.5477518", "text": "def created\n DateTime.parse(properties[\"x-dura-meta-space-created\"]) rescue nil\n end", "title": "" }, { "docid": "70f0bb9ef44be8b81cc3e18001db0b8e", "score": "0.5475192", "text": "def easy_date; date; end", "title": "" }, { "docid": "235cae9970703488b4dc83de5f67f01b", "score": "0.5474182", "text": "def date\n if date = headers['Date']\n Time.httpdate(date)\n else\n headers['Date'] = now.httpdate unless headers.frozen?\n now\n end\n rescue ArgumentError\n headers['Date'] = now.httpdate unless headers.frozen?\n now\n end", "title": "" }, { "docid": "b402357da9d3fecf04392381597610a9", "score": "0.5474017", "text": "def get_image_day(page_doc)\n\treturn DateTime.parse(page_doc.css('body center:nth-child(1) p')[1].text.strip)\nend", "title": "" }, { "docid": "8e6d41a72f47f0d5d5ca17a90966db3b", "score": "0.5472225", "text": "def creation_date\n @creation_date ||= Date.parse(theme.created_at)\n end", "title": "" }, { "docid": "e16225b822c8422905d035e8b01509b8", "score": "0.5471143", "text": "def read_date; end", "title": "" }, { "docid": "590e9d80a1fbbd6c3979ab3c66d97b8a", "score": "0.54645234", "text": "def document_stamp(document)\n distance = distance_of_time_in_words_to_now(document.updated_at)\n update = document.updated_at && document.updated_at != document.created_at\n\n if account = (document.updated_by || document.created_by)\n profile = account_avatar_and_name(account, '40x40#')\n key = update ? :updated_by : :created_by\n t(key, scope: 'locomotive.shared.list', distance: distance, who: profile)\n else\n key = update ? :updated_at : :created_at\n t(key, scope: 'locomotive.shared.list', distance: distance)\n end\n end", "title": "" }, { "docid": "89c9c34ca5f7205adc8a4a0876a51c50", "score": "0.5462813", "text": "def get_date_scraped\n\n return Date.today.to_s\n\nend", "title": "" }, { "docid": "89c9c34ca5f7205adc8a4a0876a51c50", "score": "0.5462813", "text": "def get_date_scraped\n\n return Date.today.to_s\n\nend", "title": "" }, { "docid": "4109e3a0660ba654e1bc559458e21345", "score": "0.5460997", "text": "def date_of_birth\n DateTime.parse(user_data['date_of_birth']).strftime(FOOTER_DATE_FORMAT) if user_data\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a544be43e8d15c608927ff7fd14b20cf", "score": "0.0", "text": "def shift_schedule_params\n params.require(:shift_schedule).permit(:shift_time_id, :from, :to, :status)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67419964", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.674013", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6734356", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6591046", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6502396", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6496313", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6480641", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64565", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6438387", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63791263", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.63740575", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.6364131", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.63192815", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.62991166", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62978333", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6292148", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6290449", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6290076", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62894756", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283177", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6242471", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62382483", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217549", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214457", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.6209053", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6193042", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6177802", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.6174604", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61714715", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6161512", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151757", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6150663", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61461", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61213595", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6106206", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6105114", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6089039", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081015", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071004", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6019971", "text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.601788", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6011056", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6010898", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6001556", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6001049", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59943926", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992201", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59909594", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5990628", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980841", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59669393", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59589154", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.5958826", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5957911", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957385", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5953072", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.59526145", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5943361", "text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59386164", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933856", "text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.59292704", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.59254247", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5924164", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59167904", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59088355", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5907542", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.59064597", "text": "def url_whitelist; end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.5906243", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5898226", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589687", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5896091", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5894501", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5894289", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5891739", "text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.58860534", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.5882406", "text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.587974", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58738774", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5869024", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58679986", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.5867561", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865932", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5864461", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58639693", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.58617616", "text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5861436", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5860451", "text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58602303", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854586", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.58537364", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5850427", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.5850199", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
ed83ad168ad3f79094205e1a4dbe7302
DELETE /postulations/1 DELETE /postulations/1.json
[ { "docid": "7be571b284b624d5451d48cba3f049b6", "score": "0.71221983", "text": "def destroy\n @postulation.destroy\n respond_to do |format|\n format.html { redirect_to user_postulations_path, notice: \"Postulation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "25c7914cf9caabef9302ca4d523b9a66", "score": "0.7280447", "text": "def destroy\n @postulate.destroy\n respond_to do |format|\n format.html { redirect_to postulates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6cb169e3d1e71e8a12dce26ada0d5415", "score": "0.72381943", "text": "def destroy\n @postulation.destroy\n respond_to do |format|\n format.html { redirect_to postulations_url, notice: 'Postulation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d2967b0b04aeff2fcebfecba1d4cd0a1", "score": "0.7107956", "text": "def destroy\r\n @post.destroy\r\n\r\n render json: {}, status: :ok\r\n end", "title": "" }, { "docid": "0bb7e18bf412742726aadde12b6d1174", "score": "0.7072055", "text": "def destroy\n @post.destroy!\n render json: {status: :ok}\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.6935721", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "30d8fec47e32db9bdd181a7c76d0639c", "score": "0.69051045", "text": "def destroy\n render json: @post.destroy\n end", "title": "" }, { "docid": "87a873da4ed63103ae1cda1344d03ce8", "score": "0.6901911", "text": "def destroy\n @postulation.destroy\n respond_to do |format|\n format.html { redirect_to postulations_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d20abfb718a7c8019a340bb0cdff1647", "score": "0.6892296", "text": "def destroy\n @post1 = Post1.find(params[:id])\n @post1.destroy\n\n respond_to do |format|\n format.html { redirect_to post1s_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "9cb14f1d65d414aec1e90b4706219b74", "score": "0.68379", "text": "def destroy\n @prepod = Prepod.find(params[:id])\n @prepod.destroy\n\n respond_to do |format|\n format.html { redirect_to prepods_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "52416dfceb0a01fef49a0745f32781cc", "score": "0.6827543", "text": "def destroy\n @postulate = Postulate.find(params[:id])\n @postulate.destroy\n\n respond_to do |format|\n format.html { redirect_to(postulates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9e6f7563b0bc75f93a8cd92e95c0d63a", "score": "0.6826081", "text": "def destroy\n @postit = Postit.find(params[:id])\n @postit.destroy\n\n respond_to do |format|\n format.html { redirect_to postits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c136ab1a46cd3117698253bd66ad161a", "score": "0.6824695", "text": "def destroy\n @postulate_collection.destroy\n respond_to do |format|\n format.html { redirect_to postulate_collections_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8bbc54c0483f1debc5da0bb5b5b86a8f", "score": "0.6820067", "text": "def test\n @posting = Posting.find(params[:id])\n #@Posting = Posting.where(name: params[:name])\n @posting.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.html { redirect_to postings_url }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.68085855", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "10e7eccd3458f03a66a08311f3e70d16", "score": "0.68054414", "text": "def destroy\n @postmetum.destroy\n respond_to do |format|\n format.html { redirect_to postmeta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0b24cbc6495df3923ea7679acbcd8deb", "score": "0.6797298", "text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "title": "" }, { "docid": "7cc34c987bb6e9d815701c172508a551", "score": "0.6790231", "text": "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d35b1ea242313dbe37f610cf3b7ba831", "score": "0.6785751", "text": "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n render json: \"Success\"\n end", "title": "" }, { "docid": "3f9ecb41c172e34eca6755c13bbd5100", "score": "0.6769815", "text": "def destroy\n @api_post.destroy\n end", "title": "" }, { "docid": "1ef84e1a094b6f22744b5829798c984f", "score": "0.6762222", "text": "def destroy\n @post_p1_post = Post::P1Post.find(params[:id])\n @post_p1_post.destroy\n\n respond_to do |format|\n format.html { redirect_to post_p1_posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7f54aa049d55dcf1434ca7fff88fdf88", "score": "0.674307", "text": "def destroy\n Post.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end", "title": "" }, { "docid": "1513fc486f8687aa8d9405b1a4999585", "score": "0.67227554", "text": "def destroy\n @postum.destroy\n respond_to do |format|\n format.html { redirect_to posta_url, notice: \"Postum was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f079d45086b1fbdb883ef64db7ef1ac7", "score": "0.6718859", "text": "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f7e50ea5ae4ae18478702c2556cd433a", "score": "0.67158353", "text": "def destroy\n @postt = Postt.find(params[:id])\n @postt.destroy\n\n respond_to do |format|\n format.html { redirect_to postts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0997dc22d118a722f7bb7d144a42ed39", "score": "0.6708956", "text": "def destroy\n @post = @society.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to society_path(@society) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2e0fecf75d2aa0598083a26c45ba16a", "score": "0.67084646", "text": "def destroy\n #binding.pry\n @post = Post.find(params[:id])\n @post.destroy\n render json: @post\n end", "title": "" }, { "docid": "2215dc74bf64dc8f5a0e2550fcb82eaa", "score": "0.67005634", "text": "def destroy\n @premise = Premise.find(params[:id])\n @premise.destroy\n\n respond_to do |format|\n format.html { redirect_to premises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0959aa963e5ffefe99ae79f07b3b7a1a", "score": "0.6695439", "text": "def destroy\n @stress2_survey.destroy\n respond_to do |format|\n format.html { redirect_to survey_stress2_survey_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee6151d3368c0ee12587586ea93088f8", "score": "0.6688969", "text": "def destroy\n @postit.destroy\n respond_to do |format|\n format.html { redirect_to postits_url, notice: 'Postit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4fda7f33eb8d22fe051709171d6a5b94", "score": "0.66856676", "text": "def destroy\n @postulate_collection_program.destroy\n respond_to do |format|\n format.html { redirect_to postulate_collection_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d436b07948cd9253205d68a16af08912", "score": "0.6685297", "text": "def destroy\n @miscopost.destroy\n respond_to do |format|\n format.html { redirect_to miscoposts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5c92a84477af60a74c72481957ace015", "score": "0.66830057", "text": "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "986a008952e7a38a2e1e1a9d75b2a1f3", "score": "0.6673152", "text": "def delete\n \n #get post specified by id\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "5a25abdc33b44b309635bdcfd4d6f1c2", "score": "0.66722953", "text": "def destroy\n @pest = Pest.find(params[:id])\n @pest.destroy\n\n respond_to do |format|\n format.html { redirect_to pests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3f7e77f7ebd5b6fcfa81286a3142b368", "score": "0.6667728", "text": "def destroy\n @post_example.destroy\n respond_to do |format|\n format.html { redirect_to post_examples_url, notice: 'Post example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d900d8c10e18265a531ee7312c637612", "score": "0.6659782", "text": "def destroy\n @preguntum.destroy\n respond_to do |format|\n format.html { redirect_to pregunta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "98571bdac58e36aa94455667781a4838", "score": "0.66504294", "text": "def destroy\n @prestep = Prestep.find(params[:id])\n @prestep.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_path(@prestep.recipe_id) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f2f44bf6dd24c630c050257e6a3a0a9c", "score": "0.6648841", "text": "def destroy\n fetch_by_id\n singular.destroy\n head :no_content\n end", "title": "" }, { "docid": "457a3632d7b29be8354270a472e1d37b", "score": "0.66369146", "text": "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to admin_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f4404dad138cba806cc199d4add754a2", "score": "0.66354173", "text": "def destroy\n @pool_post.destroy\n respond_to do |format|\n format.html { redirect_to pool_posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fab4121a965a72a0b40e2e5492f56216", "score": "0.663238", "text": "def destroy\n @postlet = Postlet.find(params[:id])\n @postlet.destroy\n\n respond_to do |format|\n format.html { redirect_to postlets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "be7dca0f87e6c3467418fe7b39ec86a6", "score": "0.6630984", "text": "def destroy\n @post = Post.get_random\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90c7bf071cbd6984133159442ab74488", "score": "0.6621133", "text": "def destroy\n @postulacion.destroy\n respond_to do |format|\n format.html { redirect_to postulacions_url, notice: 'Postulacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "093cd5d4ec55c6857d98cec5f689f62b", "score": "0.6621007", "text": "def destroy\n @postmicro = Postmicro.find(params[:id])\n @postmicro.destroy\n\n respond_to do |format|\n format.html { redirect_to postmicros_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "093cd5d4ec55c6857d98cec5f689f62b", "score": "0.6621007", "text": "def destroy\n @postmicro = Postmicro.find(params[:id])\n @postmicro.destroy\n\n respond_to do |format|\n format.html { redirect_to postmicros_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "feb05fa712cede2232b7a79bf0cdeb56", "score": "0.66102886", "text": "def delete\n render json: Entry.delete(params[\"id\"])\n end", "title": "" }, { "docid": "e8d3acffe2edc26223a19d590a39a8f2", "score": "0.6597997", "text": "def destroy\n @permise.destroy\n respond_to do |format|\n format.html { redirect_to permises_url, notice: 'Permise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "91f602a60ce8f0b5d2ff4ec9a516ad8d", "score": "0.65977454", "text": "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to post_index_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd01164c6edd3314ec13ec01f586fae8", "score": "0.65938675", "text": "def destroy\n @pelicula = Pelicula.find(params[:id])\n @pelicula.destroy\n render json: {message: 'Eliminated'}, status: :ok\n\n end", "title": "" }, { "docid": "190dfb35abea5e407aa0796ad6303ae7", "score": "0.65920633", "text": "def destroy\n @micripost = Micripost.find(params[:id])\n @micripost.destroy\n\n respond_to do |format|\n format.html { redirect_to micriposts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "75a785bddc2252b3dfe08070dcb44399", "score": "0.65893286", "text": "def delete(args)\n if args[:json]\n post(args.merge(method: :delete))\n else\n get(args.merge(method: :delete))\n end\n end", "title": "" }, { "docid": "0eddac169be4b973dfc843260c1a7564", "score": "0.65874356", "text": "def destroy\n @pensum = Pensum.find(params[:id])\n @pensum.destroy\n\n respond_to do |format|\n format.html { redirect_to pensums_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44dd996fd77af55e9e6494f7b3364ea8", "score": "0.65841097", "text": "def destroy\n @pregunta = Pregunta.find(params[:id])\n @pregunta.destroy\n\n respond_to do |format|\n format.html { redirect_to preguntas_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "05b58d924c712120f49f7d5fd3377b97", "score": "0.65796334", "text": "def destroy\n @apportionment_per_greenhouse.destroy\n respond_to do |format|\n format.html { redirect_to apportionment_per_greenhouses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2b30af486c39f0dd5ce2ee43be8ab7c", "score": "0.65750784", "text": "def destroy\n @pregunta = Pregunta.find(params[:id])\n @pregunta.destroy\n\n respond_to do |format|\n format.html { redirect_to preguntas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c39fed9ba27f252ef029f3d87c2cd44", "score": "0.6574957", "text": "def destroy\n @post_ulo.destroy\n respond_to do |format|\n format.html { redirect_to post_ulos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "699bda24971bfb015e15025d5df74198", "score": "0.65663487", "text": "def destroy\n @reponse = Reponse.find(params[:id])\n @reponse.destroy\n\n respond_to do |format|\n format.html { redirect_to reponses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0879ade66bdab83e51e8da609fb6b45b", "score": "0.65662676", "text": "def destroy\n @resposta = Resposta.find(params[:id])\n @resposta.destroy\n\n respond_to do |format|\n format.html { redirect_to respostas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7999d8893e02badf2390e63e1fc7c05a", "score": "0.6564433", "text": "def destroy\n @repost.destroy\n respond_to do |format|\n format.html { redirect_to reposts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b15f12df8273cbf024fa8e6bd2eca834", "score": "0.6563445", "text": "def destroy\n @pregunta = Pregunta.find(params[:id])\n @pregunta.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "d6f1737e7f52e75a7e1de45cef4a57aa", "score": "0.65599585", "text": "def destroy\n @pensum.destroy\n respond_to do |format|\n format.html { redirect_to pensums_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cacf1cce75b331c081c53f7d9348c019", "score": "0.6559602", "text": "def destroy\n respond_with Post.destroy(params[:id])\n end", "title": "" }, { "docid": "b01e303b7a9399a5fe0686a9c086942e", "score": "0.6554257", "text": "def destroy\n @stress_survey.destroy\n respond_to do |format|\n format.html { redirect_to stress_surveys_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "93c36d288b9cf8c8088550385eb1e476", "score": "0.6551458", "text": "def destroy\n Throne::Request.delete\n end", "title": "" }, { "docid": "01ec74016ab762e9cb1fcc1ddc434464", "score": "0.65512884", "text": "def destroy\n @one_on_one.destroy\n head :no_content\n end", "title": "" }, { "docid": "773e5d611adeb09776f9c841e1b876cc", "score": "0.6546228", "text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end", "title": "" }, { "docid": "c19d910bfeb3d555f8b93402c5efb4a8", "score": "0.6545901", "text": "def destroy\n @post.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "c19d910bfeb3d555f8b93402c5efb4a8", "score": "0.6545901", "text": "def destroy\n @post.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "c19d910bfeb3d555f8b93402c5efb4a8", "score": "0.6545901", "text": "def destroy\n @post.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "c19d910bfeb3d555f8b93402c5efb4a8", "score": "0.6545901", "text": "def destroy\n @post.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "ac24bccbd4132716b8f3597894b223ba", "score": "0.6540771", "text": "def destroy\n @postick = Postick.find(params[:id])\n @postick.destroy\n\n respond_to do |format|\n format.html { redirect_to posticks_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d89b0c7f748b135c780edaf90b81350f", "score": "0.6532375", "text": "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n ES_Index_Delete()\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.65312", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "822ddea2e45bf78350003645efcbdb54", "score": "0.6529638", "text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end", "title": "" }, { "docid": "01cfe5d32b670c45850fcac8c8d6cbee", "score": "0.65267825", "text": "def destroy\n @testimony = Testimony.find(params[:id])\n @testimony.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9201c1e2c2e9bc7e6df271677e06f509", "score": "0.65256", "text": "def destroy\n @survey1 = Survey1.find(params[:id])\n @survey1.destroy\n\n respond_to do |format|\n format.html { redirect_to survey1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8f314271b6ddc87eeeea2ba210ec49d1", "score": "0.6519636", "text": "def delete\n render json: Person.delete(params[\"id\"])\n end", "title": "" }, { "docid": "53b565b11a128219fe399bd6349ca438", "score": "0.6518654", "text": "def destroy\n @postt.destroy\n respond_to do |format|\n format.html { redirect_to postts_url, notice: \"Postt was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a766f914bfedb308ca3fa50827d71644", "score": "0.6514021", "text": "def destroy\n @punt = Punt.find(params[:id])\n @punt.destroy\n\n respond_to do |format|\n format.html { redirect_to punts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4a192c87bb43531caa277d51c16488e5", "score": "0.65112627", "text": "def destroy\n post = @coment.post\n @coment.destroy\n respond_to do |format|\n format.html { redirect_to post_path(post), notice: 'Coment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5c181505ac0deedddfba684db419e428", "score": "0.6510211", "text": "def delete\n render json: Own.delete(params[\"id\"])\n end", "title": "" }, { "docid": "801ce71e01586dcd396138c7836d4a07", "score": "0.6504552", "text": "def destroy\n @drumy = Drumy.find(params[:id])\n @drumy.destroy\n\n respond_to do |format|\n format.html { redirect_to drumies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "83824714428182d740d3c2e5a6691f7d", "score": "0.65023655", "text": "def destroy\n @policial = Policial.find(params[:id])\n @policial.destroy\n\n respond_to do |format|\n format.html { redirect_to policials_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "aeee216a01bf1e950c024274da1197c3", "score": "0.6500159", "text": "def destroy\n @post = Post.find(params[:id])\n Photo.retract_photos(@post)\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json=>{:result=>\"0\"} }\n end\n end", "title": "" }, { "docid": "e1a63f6802fc993b9c7ebe64b56dcb98", "score": "0.64987326", "text": "def destroy\n notifications = Notification.where(notifiable: @postulation)\n notifications.each(&:destroy)\n result = @postulation.destroy\n render json: { result: result }\n end", "title": "" }, { "docid": "9206c12be0e9315e9442367f39e0b53d", "score": "0.6497586", "text": "def destroy\n @demand.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bb9aee1459f36d31081343da615dde58", "score": "0.6490363", "text": "def destroy\n @predmet = Predmet.find(params[:id])\n @predmet.destroy\n\n respond_to do |format|\n format.html { redirect_to predmets_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "aec2b7cc264222caeadb9487e972995a", "score": "0.648948", "text": "def destroy\n @post.destroy\n head :no_content\n end", "title": "" }, { "docid": "aec2b7cc264222caeadb9487e972995a", "score": "0.648948", "text": "def destroy\n @post.destroy\n head :no_content\n end", "title": "" }, { "docid": "2d628e188250ad636c5d933927848d90", "score": "0.64887357", "text": "def destroy\n @repost_url.destroy\n respond_to do |format|\n format.html { redirect_to repost_urls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "89db6e97bf7b46a0aff787169fb5aabe", "score": "0.64874226", "text": "def destroy\n @crudpost.destroy\n respond_to do |format|\n format.html { redirect_to crudposts_url, notice: 'Crudpost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b5c01c5ba51eec015aeb408add0cfa74", "score": "0.6487223", "text": "def destroy\n @recuest = Recuest.find(params[:id])\n @recuest.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f2b23d340d60464530661d4db5e0e2b9", "score": "0.6484792", "text": "def destroy\n @budgetpost = Budgetpost.find(params[:id])\n @budgetpost.destroy\n\n respond_to do |format|\n format.html { redirect_to budgetposts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a389aa09a3f5959b8412bb6ef487e85b", "score": "0.64818126", "text": "def destroy\n @opt10059_one_one.destroy\n respond_to do |format|\n format.html { redirect_to opt10059_one_ones_url, notice: 'Opt10059 one one was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "113b6e0e4fa1ca05c661682306d26718", "score": "0.6481202", "text": "def destroy\n @part_one_predict = PartOnePredict.find(params[:id])\n @part_one_predict.destroy\n\n respond_to do |format|\n format.html { redirect_to part_one_predicts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "224a2319de9274c5deb6bbe4de2b1a75", "score": "0.6477455", "text": "def destroy\n @posting.destroy\n respond_to do |format|\n format.html { redirect_to postings_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cc8610d2752711fd5cca801ba4f3252a", "score": "0.64770955", "text": "def destroy\n @resturant = Resturant.find(params[:id])\n @resturant.destroy\n self.headers.merge!('Content-Type' => 'application/json' )\n self.response_body = {status: \"Deleted\"}\n end", "title": "" }, { "docid": "fc5423de560ff5a1a695db9af31baa5c", "score": "0.6476494", "text": "def destroy\n @narrative = Narrative.find(params[:id])\n @narrative.destroy\n\n respond_to do |format|\n format.html { redirect_to narratives_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e218cb848bc03c05b46c07528ba21f8", "score": "0.6474005", "text": "def destroy\n @prescription = Prescription.find(params[:id])\n @prescription.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9106867cee9e8775ba817195d3bc2020", "score": "0.6472928", "text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "8d437062b0ac269765383a9f6bc1ec97", "score": "0.0", "text": "def snapshot_params\n params.require(:snapshot).permit(:name, :query)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6887521", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.67666084", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.671326", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6705381", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.66164786", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.66156906", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.65888846", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6575757", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6572969", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572365", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.65321475", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.65129966", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.65128386", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.64990044", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.6491305", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6489574", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6476191", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.645836", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.64389294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6431918", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.642512", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6420569", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.63736504", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6336598", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6319846", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.63113743", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6292978", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6291", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.6290657", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.62724084", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6266407", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.6265082", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6262119", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6258491", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6243215", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62372005", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.6226018", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.6225602", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.62250364", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.62147176", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.62035644", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.61931455", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.618889", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6180647", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.6180104", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175616", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.61731255", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.61730814", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.6172509", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.6172386", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6163843", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.6146083", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.6145458", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.61444825", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143515", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.61364955", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.61280644", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6113519", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6112032", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6106793", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61061025", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6105072", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6092409", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.60909486", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.60895824", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6083517", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.6081807", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6079226", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077248", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.60767365", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.60746986", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.60703695", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6070048", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.6069783", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.6063365", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.6047726", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.60399187", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.6033119", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6029004", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.6025425", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60199857", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" } ]
02bd78737db36f3fce70daad8019b35e
By default, log to rack.errors.
[ { "docid": "65b851cdd671564212d67675beaee693", "score": "0.6291538", "text": "def <<(str)\n @env[\"rack.errors\"].write(str)\n @env[\"rack.errors\"].flush\n end", "title": "" } ]
[ { "docid": "7ed4f73bd5bf46834a0c3203ad47a333", "score": "0.74924666", "text": "def test_logs_errors_to_rack_logger\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n logger_output = StringIO.new\n without_error do\n app.get('/', 'rack.logger' => Logger.new(logger_output))\n end\n\n assert_match /ERROR -- : Kaboom/, logger_output.string\n end", "title": "" }, { "docid": "453e870799846b8221aaf7e9f2cee1a8", "score": "0.73872334", "text": "def default_errors!\n configure :production do\n error ::Exception do\n boom = env['sinatra.error']\n logger.error [\"#{boom.class} - #{boom.message}:\", *boom.backtrace].join(\"\\n \")\n response.status = 500\n content_type 'text/html'\n '<h1>Internal Server Error</h1>'\n end unless errors.has_key?(::Exception)\n end\n end", "title": "" }, { "docid": "a78ae8e157f6f7d39c95f70d80e0685e", "score": "0.7294824", "text": "def default_errors\n configure :production do\n error ::Exception do\n logger.exception env['sinatra.error']\n halt(500, { 'Content-Type' => 'text/html' }, ['<h1>Internal Server Error</h1>'])\n end unless errors.has_key?(::Exception)\n end\n end", "title": "" }, { "docid": "ceba5a62b60e050ffc56c36813506b73", "score": "0.69311625", "text": "def errors\n @errors || (@env && (@errors = @env['rack.errors'])) || STDERR\n end", "title": "" }, { "docid": "a595f48d2acc17641f80e831c050b460", "score": "0.6781578", "text": "def log_errors\n\t Rails.logger.debug self.errors.full_messages.join(\"\\n\")\n\tend", "title": "" }, { "docid": "70f5781930903f1ee563479137eb0336", "score": "0.6715684", "text": "def error!(e)\n @env['rack.errors'].puts(e.message)\n @status = 500 if new?\n @state = :errored\n @handler.close!(false)\n end", "title": "" }, { "docid": "60a4f5a6df8bc9b65a1146c6c9f38eda", "score": "0.66620445", "text": "def log(env, status, header, began_at)\n logger_before = env['rack.errors']\n params = env['rack.request.query_hash']\n params = params.merge(env['rack.request.form_hash']) if env['rack.request.form_hash']\n env['rack.errors'] = AppendLogger.new(logger_before, \"#{params.inspect}\\n\")\n super(env, status, header, began_at)\n ensure\n env['rack.errors'] = logger_before\n end", "title": "" }, { "docid": "60a4f5a6df8bc9b65a1146c6c9f38eda", "score": "0.66620445", "text": "def log(env, status, header, began_at)\n logger_before = env['rack.errors']\n params = env['rack.request.query_hash']\n params = params.merge(env['rack.request.form_hash']) if env['rack.request.form_hash']\n env['rack.errors'] = AppendLogger.new(logger_before, \"#{params.inspect}\\n\")\n super(env, status, header, began_at)\n ensure\n env['rack.errors'] = logger_before\n end", "title": "" }, { "docid": "1cd3ce45d8e0ac6d4361ccd6e1acc7d2", "score": "0.6584254", "text": "def setup_error_handling(rack_env)\n end", "title": "" }, { "docid": "346daf35202548cdb127b4215a390838", "score": "0.65827924", "text": "def error(event)\n Firehose.logger.error \"WS connection `#{@req.path}` error. Message: `#{event.message.inspect}`\"\n end", "title": "" }, { "docid": "727dae64946c21b28a51c9119955a8a4", "score": "0.6504908", "text": "def log_error\n @base_slot[\"log/error\"]\n end", "title": "" }, { "docid": "7d78b5ef81212e1f0ce3f790263b3b4f", "score": "0.64988756", "text": "def log_errors\n if !Rails.env.production? && self.errors.any?\n str = \"Errors for #{self.class.name}\"\n if id\n str += \" (ID: #{self.id})\"\n end\n str += \" - #{self.errors.full_messages.join(', ')}\"\n\n str = \"\\n#{str}\\n\"\n\n if Rails.env.test?\n puts str\n else\n Rails.logger.debug(str)\n end\n end\n end", "title": "" }, { "docid": "7862334e2f2cf16ac68401c6d9622d74", "score": "0.6483176", "text": "def error(string)\n @logged << string\n end", "title": "" }, { "docid": "2a22f7c88779746f98ef1904e97d3abb", "score": "0.6478356", "text": "def error(msg)\n log msg, :error\n end", "title": "" }, { "docid": "8d958968910cb4177431ad98df056580", "score": "0.64613837", "text": "def log\n Deltacloud::Exceptions.logger(Deltacloud.default_frontend.logger)\n end", "title": "" }, { "docid": "6479ce5f0dd036b89380dcd3d2eb30fe", "score": "0.6458807", "text": "def log_error(response)\n log('ERROR', \"#{response.code} - #{response.body}\")\n end", "title": "" }, { "docid": "8f45424170051447d2b59e6965f6c070", "score": "0.6451732", "text": "def error(msg)\n log.error msg\n end", "title": "" }, { "docid": "f6bbc02220560fa83ad32e9c2f5530df", "score": "0.6439642", "text": "def connection_error(error, req, text=\"HTTP connection error\")\n @error_logger.info(error: error, req: req, text: text)\n end", "title": "" }, { "docid": "042d41836ed7de5087a50dd42d289e82", "score": "0.64244145", "text": "def traces_error\n TRACES.level = Logger::ERROR\n end", "title": "" }, { "docid": "4cb023ff03481eb8fc40453519957f6c", "score": "0.64207345", "text": "def error(msg)\n @logger.error(msg)\n end", "title": "" }, { "docid": "4e1d100b0e86bed3a6373124fecf9af2", "score": "0.6416023", "text": "def set_error\n @client.on_error do |message|\n Aji.log.error \"ERROR: #{message}\"\n end\n end", "title": "" }, { "docid": "c6e8af1e6452ad0391f1a22fa430c36d", "score": "0.6396814", "text": "def error\n # Logging exception handling\n # Logging backtrace / context info\n respond_to do |f|\n f.any do\n render json: {\n error: \"An error has occured. Server administrators have been alerted.\",\n }, status: 500\n end\n end\n end", "title": "" }, { "docid": "ce4b84143c0a8a03a5dc0e40853ea9b1", "score": "0.6381611", "text": "def err(msg)\n @logger.error msg\n end", "title": "" }, { "docid": "9b44ed7d06c1b54dcf5898bae6597246", "score": "0.63672847", "text": "def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend", "title": "" }, { "docid": "8497131766e1a05e7af7fe4ea38e78eb", "score": "0.63480747", "text": "def error(message)\n log(message, :error)\n end", "title": "" }, { "docid": "e46ee083c4318c35b55fbd04eb4ae849", "score": "0.6345887", "text": "def error\n @log_level = 4\n return self\n end", "title": "" }, { "docid": "c587e1477f5364e6c2d8136592ea5260", "score": "0.6344643", "text": "def error_handler\n yield\n rescue StandardError => e\n logger.tagged(ContextRequestMiddleware.logger_tags) do\n logger.error e.message + e.backtrace.join('\\n')\n end\n end", "title": "" }, { "docid": "7c47b04adcecfeff95c5afac5630ac9d", "score": "0.6313437", "text": "def raise_server_error!; end", "title": "" }, { "docid": "ccdbe8e0a7d8563684191f67e70faacf", "score": "0.62952536", "text": "def application_error!\n res.status = 500\n render \"public/shared/500\"\n halt res.finish\n end", "title": "" }, { "docid": "d0cc2b73596d72be666bb7768fbda1dd", "score": "0.62926793", "text": "def error_event(err, env)\n {\n type: 'error.internal',\n to: '[email protected]',\n subject: \"[#{env['HTTP_HOST']}] #{err.class} on #{env['PATH_INFO']}\",\n err: { class: err.class, message: err.message, backtrace: err.backtrace },\n req: env.dup.delete_if { |k, v| k.start_with?('rack.') || k.start_with?('puma.') }\n }\n end", "title": "" }, { "docid": "c477d205ff92d491bf7b5b7f6ff4e76a", "score": "0.62708366", "text": "def handle_error\n log \"!! Unexpected error while processing request: #{$!.message}\"\n log \"!! #{$!.backtrace.join(\"\\n\")}\"\n log_error\n close_connection rescue nil\n end", "title": "" }, { "docid": "264065d256cf7a5c8d176e812cf90006", "score": "0.6261366", "text": "def error(msg)\n @log.puts(msg)\n @log.flush\n end", "title": "" }, { "docid": "397d707f436d17a6fbba1b8980bc6045", "score": "0.625552", "text": "def test_logs_errors_to_stderr\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n captured_errs = StringIO.new\n without_error(captured_errs) do\n app.get('/')\n end\n\n assert_match /ERROR -- : Kaboom/, captured_errs.string\n end", "title": "" }, { "docid": "0a45cc39580295ac25d5f1c65662579e", "score": "0.62533414", "text": "def server_error!(err)\n render_error(error: err.message)\n end", "title": "" }, { "docid": "65c8d68038b5ee8ba5690db6cf9d4c8a", "score": "0.6248154", "text": "def error(msg) log(ERROR, \"ERROR \" << format(msg)); end", "title": "" }, { "docid": "7b521a4a018493fb9f3f8a4b8d5ddf07", "score": "0.6247619", "text": "def respond_internal_error(err)\n respond_and_log(err.message, 500, false)\n end", "title": "" }, { "docid": "de7f88f7fb87bab7e15f08f9f8b75487", "score": "0.6232848", "text": "def log_error(err)\n\t\tprint_error(err)\n\n\t\twlog(err)\n\n\t\t# If it's a syntax error, log the call stack that it originated from.\n\t\tdlog(\"Call stack:\\n#{[email protected](\"\\n\")}\", 'core', LEV_1)\n\tend", "title": "" }, { "docid": "de7f88f7fb87bab7e15f08f9f8b75487", "score": "0.6232848", "text": "def log_error(err)\n\t\tprint_error(err)\n\n\t\twlog(err)\n\n\t\t# If it's a syntax error, log the call stack that it originated from.\n\t\tdlog(\"Call stack:\\n#{[email protected](\"\\n\")}\", 'core', LEV_1)\n\tend", "title": "" }, { "docid": "de7f88f7fb87bab7e15f08f9f8b75487", "score": "0.6232848", "text": "def log_error(err)\n\t\tprint_error(err)\n\n\t\twlog(err)\n\n\t\t# If it's a syntax error, log the call stack that it originated from.\n\t\tdlog(\"Call stack:\\n#{[email protected](\"\\n\")}\", 'core', LEV_1)\n\tend", "title": "" }, { "docid": "64081ceacf53738b0be757d9f2995ae3", "score": "0.62299013", "text": "def error(exception)\n log exception, :error\n end", "title": "" }, { "docid": "e47cbabb2452ab5bcd314b9c52f27d04", "score": "0.6227136", "text": "def error_500\n end", "title": "" }, { "docid": "5e43289e97c06acc92c6235b819930d5", "score": "0.6221717", "text": "def log_error(message)\n Rails.logger.error(message)\n end", "title": "" }, { "docid": "575f9eb6bf123d944683e4c429d42a69", "score": "0.6211577", "text": "def log_error msg\n Rails.logger.error \"TOPHITSERROR #{msg}\"\n end", "title": "" }, { "docid": "b939148c985242becd74f9f0564e04ab", "score": "0.62076926", "text": "def error(error)\n @logger.error error\n @haserror = true\n end", "title": "" }, { "docid": "495a7e8167baf8d235990c5f47832ab4", "score": "0.61990607", "text": "def error(msg)\n log(:error, msg)\n end", "title": "" }, { "docid": "22228023d1ffef3e3ae89426558eed0b", "score": "0.6188272", "text": "def log\n Rocket::Server.logger\n end", "title": "" }, { "docid": "3b5a3588a40dffac13bd0481c7f10d1e", "score": "0.6180885", "text": "def write_errors(env, err, status)\n err.seek(0)\n dst = env['rack.errors']\n pid = status.pid\n dst.write(\"#{pid}: #{args.inspect} status=#{status} stderr:\\n\")\n err.each_line { |line| dst.write(\"#{pid}: #{line}\") }\n dst.flush\n end", "title": "" }, { "docid": "38d6698861dde8d633e6afd804b1571f", "score": "0.6172067", "text": "def http_error\n Log.add_info(request, params.inspect)\n end", "title": "" }, { "docid": "161255555c99b20a993083fd4b17cf2b", "score": "0.61707014", "text": "def error(msg)\n log(:error, msg)\n end", "title": "" }, { "docid": "f5032c90ce6fa4a1cc94fc0b27b4c8a4", "score": "0.617027", "text": "def error(message)\n log message, true\n STDERR.puts message\n end", "title": "" }, { "docid": "c02fb8e5f14cf5a01027faa1d080a60d", "score": "0.61638224", "text": "def error(msg)\n @logger.log(:error, from, msg)\n end", "title": "" }, { "docid": "4319ea4b6e33edc06a6d37111f9a8c04", "score": "0.61617506", "text": "def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n end", "title": "" }, { "docid": "4319ea4b6e33edc06a6d37111f9a8c04", "score": "0.61617506", "text": "def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n end", "title": "" }, { "docid": "fd1719299e91f76322757b2509d3aba7", "score": "0.6155082", "text": "def catch_errors_and_log_request_stats\n clear_user_globals\n stats = request_stats\n yield\n IpStats.log_stats(stats)\n logger.warn(request_stats_log_message(stats))\n rescue StandardError => e\n raise(@error = e)\n end", "title": "" }, { "docid": "6f4443fe281b9f7c01c7d7341918553f", "score": "0.61300325", "text": "def error(message)\n log(:error, message)\n end", "title": "" }, { "docid": "b1b59dd7945cfcf8a2e2c921b89f0ec6", "score": "0.6124735", "text": "def log\n msg = \"#{Time.new} - #{request_method} #{path} - 400 Unauthorized\\n\"\n msg << \"HTTP_AUTHORIZATION: #{env['HTTP_AUTHORIZATION']}\\n\"\n msg << \"Auth Message Config: #{config.request_config[request_method]}\\n\"\n\n if allowed_messages\n msg << \"Allowed Encrypted Messages:\\n\"\n allowed_messages.each do |hash|\n msg << \"#{hash}\\n\"\n end\n end\n\n msg << \"Auth Signature: #{config.signature}\"\n\n Rack::SimpleAuth::Logger.log(config.logpath, config.verbose, ENV['RACK_ENV'], msg)\n end", "title": "" }, { "docid": "4665f373a6b3e10f43beba488bc765d9", "score": "0.6121109", "text": "def error(message)\n log(:error, message)\n end", "title": "" }, { "docid": "fd3d9c88c11a068a9ec9b6761f1346dc", "score": "0.61201715", "text": "def error_500(exc)\n Rails.logger.error(caller)\n respond_to do |format|\n format.html { render :text => '500 internal server error'}\n end\n end", "title": "" }, { "docid": "34c265bcf322b31754ed542353045e51", "score": "0.6118166", "text": "def test_rescues_errors\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n without_error do\n app.get('/')\n end\n end", "title": "" }, { "docid": "29efa20469300f12f6783ef200f1b869", "score": "0.61015654", "text": "def error_log(msg)\n Amigrind::Core::Logging.logger.error msg\n end", "title": "" }, { "docid": "b592e6a7b13318668cbabb75fab4903d", "score": "0.60990536", "text": "def log_error(exception)\n super(exception)\n begin\n unless local_request? or RAILS_ENV == 'development' or\n exception.class == ActiveRecord::RecordNotFound\n ErrorMailer.deliver_snapshot(exception, clean_backtrace(exception),\n session.instance_variable_get(\"@data\"), params, request.env)\n end\n rescue => e\n logger.info e.to_s\n end\n end", "title": "" }, { "docid": "ffe388535e79203cbed2a179bfb11a1a", "score": "0.6098165", "text": "def log req\r\n msg = \"ERROR: #{req.code}: #{req.message}\\nbody: #{req.body}\\nheaders: #{req.response.to_hash.inspect}\"\r\n File.open('log.txt','a') do |f|\r\n f.puts msg\r\n end\r\n puts msg\r\n end", "title": "" }, { "docid": "59ff17ea4c71483f86dfaf448daaded6", "score": "0.60969347", "text": "def test_handles_error\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n response = without_error do\n app.get('/')\n end\n\n assert_equal 500, response.status\n assert_equal 'text/plain', response.content_type\n assert_equal 'Internal Server Error', response.body\n end", "title": "" }, { "docid": "d0e261de93c874bf4a7cb7f098e4041e", "score": "0.60925245", "text": "def internal_error(request:, error:, time:)\n @logger.error :server do\n {\n http: http_request_to_hash(request),\n internal_error: error_to_hash(error),\n elapsed_ms: time,\n }\n end\n end", "title": "" }, { "docid": "3b9f25aed7d666a71b68f6b505a45128", "score": "0.60923326", "text": "def error(msg)\n write msg, :error\n end", "title": "" }, { "docid": "1fece659e44043b8e3522185576ea748", "score": "0.60913736", "text": "def report_error\n @status = STATUS_ERROR\n end", "title": "" }, { "docid": "6c6b1c078cb04dff7142d4888293907a", "score": "0.6089669", "text": "def error!\n self.level = ERROR\n end", "title": "" }, { "docid": "aa34c6400fe70e491a4d6e4e1c9b6cc0", "score": "0.6084776", "text": "def handle_request_error\n log(\"ERROR WHILE SENDING REQUEST TO LINGUARA: #{$!}\")\n end", "title": "" }, { "docid": "aa34c6400fe70e491a4d6e4e1c9b6cc0", "score": "0.6084776", "text": "def handle_request_error\n log(\"ERROR WHILE SENDING REQUEST TO LINGUARA: #{$!}\")\n end", "title": "" }, { "docid": "d5f091279b6d97222e5fa9a2409f243e", "score": "0.60827696", "text": "def record_error(msg)\n\t\t\t@error = msg\n\t\tend", "title": "" }, { "docid": "521c20a16c56c9815e87d9dbe5e20a89", "score": "0.60798395", "text": "def internal_error\n self.status = 500\n self.headers = {}\n self.content = ['Internal error']\n self\n end", "title": "" }, { "docid": "39ff81fa1f0b9e2a712f5230b8ec1c20", "score": "0.6076795", "text": "def log_to_sentry(method, uri, params)\n Sentry.error('Api Failed', method: method, uri: uri, params: params)\n end", "title": "" }, { "docid": "e1408183ae120e4829788c83584fe2e7", "score": "0.60735184", "text": "def error_handler\n \n end", "title": "" }, { "docid": "7b35125edb8886e172ea5c839861c9d3", "score": "0.6066463", "text": "def error_log_message\n 'API can`t be used'\n end", "title": "" }, { "docid": "89e0e6c93124443394c0c76804d37e06", "score": "0.60442597", "text": "def log_service_error(response)\n if response[\"resources\"]\n Flareshow::Util.log_error(response[\"resources\"][\"message\"])\n Flareshow::Util.log_error(response[\"resources\"][\"details\"]) \n else\n Flareshow::Util.log_error(response[\"body\"])\n end\n end", "title": "" }, { "docid": "086b158af9fd4c71a10dabe36fd61c22", "score": "0.6034379", "text": "def handle_error\n log \"!! Unexpected error while processing request: #{$!.message}\"\n log_error\n close_connection rescue nil\n end", "title": "" }, { "docid": "6a13bffc85721f2799ffbb1f89df1a5f", "score": "0.6029758", "text": "def xml_error(socket)\n begin\n self.warning(\"sending ERROR to client\")\n socket.puts(REXML::Document.new.add_element('ERROR').to_s)\n rescue\n self.error('cannot write to socket')\n end \n end", "title": "" }, { "docid": "472f77578684c0736306007f78cccc74", "score": "0.6027815", "text": "def error(data, &blk)\n data = coalesce_strings_to_hash(data)\n data = data.merge(:level => @adapt_severity_for_syslog ? \"warning\" : \"error\") if data.is_a?(Hash)\n @log.log(data, &blk)\n end", "title": "" }, { "docid": "7cb2b2357a6b0280dfdc5080265cfba1", "score": "0.6027713", "text": "def on_error(error); end", "title": "" }, { "docid": "7cb2b2357a6b0280dfdc5080265cfba1", "score": "0.6027713", "text": "def on_error(error); end", "title": "" }, { "docid": "b374d69ee1de20ba83c36ec0d5401fa4", "score": "0.6025816", "text": "def loggingError(_label, *_values)\n loggingInspected(:error, _label, *_values) ;\n end", "title": "" }, { "docid": "92937453c4aab3071d7ec75414cfe156", "score": "0.6018312", "text": "def log_error(message)\n process_log.tagged('ERR') { process_log.warn(\"[#{Time.now.strftime('%F %T')}][hdls] #{message}\") }\n end", "title": "" }, { "docid": "92937453c4aab3071d7ec75414cfe156", "score": "0.6018312", "text": "def log_error(message)\n process_log.tagged('ERR') { process_log.warn(\"[#{Time.now.strftime('%F %T')}][hdls] #{message}\") }\n end", "title": "" }, { "docid": "ec0b3f296639ac522389a9c26984bb68", "score": "0.601203", "text": "def error_log_tag\n 'API ERROR'\n end", "title": "" }, { "docid": "fa3a0dbc0e06893588a906bcb02095fe", "score": "0.6011421", "text": "def error(*args); log(ERROR, *args); end", "title": "" }, { "docid": "717712c436287ec9ffa01012a1bc0d81", "score": "0.5996238", "text": "def unmatched_error(e)\n logger.error(\"Unexpected error occured\")\n logger.error(e)\n logger.error(e.backtrace.join(\"\\n\"))\n error!(\"Une erreur a été trouvée\", e.class.name, 500, message: e.message)\n end", "title": "" }, { "docid": "1fef889ab7a31024795e09d8aa6e92fa", "score": "0.5984705", "text": "def error!(status, message)\n response.status = status\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "1fef889ab7a31024795e09d8aa6e92fa", "score": "0.5984705", "text": "def error!(status, message)\n response.status = status\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "1fef889ab7a31024795e09d8aa6e92fa", "score": "0.5984705", "text": "def error!(status, message)\n response.status = status\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "1fef889ab7a31024795e09d8aa6e92fa", "score": "0.5984705", "text": "def error!(status, message)\n response.status = status\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "aab4deca03cd5596533b00aeba9a810d", "score": "0.597538", "text": "def error(exception)\n logger.error \"Beetle: handler execution raised an exception: #{exception}\"\n end", "title": "" }, { "docid": "33c6686eea5a719d23c393288cb3c208", "score": "0.5973797", "text": "def debug_error(error, req=nil, text=\"\")\n @error_logger.debug(error: error, req: req, text: text)\n end", "title": "" }, { "docid": "418e6488912657e7d0d7b69989256856", "score": "0.5973198", "text": "def err; end", "title": "" }, { "docid": "360eeb6bca882553ad1d1e38dd835ce3", "score": "0.5963679", "text": "def app_rescue\n logger.error(sprintf(\"error %s(%s) at %s#%s:\\n%s\",\n $!.class.to_s,\n $!.to_s,\n self.class.name,\n self.action_name,\n [email protected](\"\\n\")))\n end", "title": "" }, { "docid": "5c0a4b5c703e85c9744c4432e9504a50", "score": "0.59590393", "text": "def handle_error e\n logger.error e\n error_uri = URI.parse ENV['ERROR_URL']\n error_query = URI.decode_www_form(String(error_uri.query)) << ['error', e.message]\n error_uri.query = URI.encode_www_form(error_query)\n redirect error_uri.to_s\nend", "title": "" }, { "docid": "e496ba073f04358a30b9f178587a0320", "score": "0.5953312", "text": "def error_handler(err)\n\t\t(Thread.current[:errors] ||= []) << err\n\t\terror(\"#{err.class}: #{err.message} \" + err.backtrace.join(\",\"))\n\tend", "title": "" }, { "docid": "c6491b1bfc26d955f49f3e0f94364a26", "score": "0.5953073", "text": "def on_error(err)\n if (err.kind_of?(StandardError))\n logger.error \"ApplicationProcessor::on_error: #{err.class.name} rescued:\\n\" + \\\n err.message + \"\\n\" + \\\n \"\\t\" + err.backtrace.join(\"\\n\\t\")\n else\n logger.error \"ApplicationProcessor::on_error: #{err.class.name} raised: \" + err.message\n raise err\n end\n end", "title": "" }, { "docid": "a79cff59da9db2e9e291f0a56c72c589", "score": "0.59517217", "text": "def log_error(string)\n indexing_logger.error(string)\n puts(Rainbow(string).red) if verbose\n end", "title": "" }, { "docid": "7f7a4f227a7e6b1f75e85006b38d9624", "score": "0.59485716", "text": "def log_error(message, color=nil, mode=nil)\n\tlog message, color, mode, true\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "611e734f8f11a3cf7dfdc4ed8a681219", "score": "0.0", "text": "def subsubcategorium_params\n params.require(:subsubcategorium).permit(:frequencia, :ativo, :subcategoria_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
a2e0d5712398579d8437dee5cbad721a
The "slug" of the article that shows up in its URL.
[ { "docid": "3957e611031507b86a7ac2a1aed8567c", "score": "0.74626315", "text": "def slug\n @_slug ||= data[\"slug\"]\n\n @_slug ||= if blog_options.sources.include?(\":title\")\n path_part(\"title\")\n elsif title\n title.parameterize\n else\n raise \"Can't generate a slug for #{path} because it has no :title in its path pattern or title/slug in its frontmatter.\"\n end\n end", "title": "" } ]
[ { "docid": "2896371282292bd191a71ed532ecc885", "score": "0.7984458", "text": "def slug\n @_slug ||= path_part(\"title\")\n end", "title": "" }, { "docid": "3a3ae70aaa799512bc7a8898b6af0407", "score": "0.7938603", "text": "def slug\n @_slug ||= path_part(\"title\")\n end", "title": "" }, { "docid": "4b0b374cf6671625738e3ae2b3747e77", "score": "0.7932892", "text": "def slug\n urlname.to_s.split('/').last\n end", "title": "" }, { "docid": "e0c1b4f913a63af0b247e49a19ea27a0", "score": "0.79228354", "text": "def fetch_the_slug\n @permalink.split('/')[-1]\n end", "title": "" }, { "docid": "526fc1e6368a9b4fc8b316b24b110c71", "score": "0.7739715", "text": "def slug\n @slug ||= begin\n Base64.urlsafe_encode64(\n [Digest::MD5.hexdigest(url).to_i(16)].pack(\"N\")\n ).sub(/==\\n?$/, '')\n end\n end", "title": "" }, { "docid": "952f862595aa4e2aa99e349192d2df7b", "score": "0.77296054", "text": "def slug\n self.path.split('/').last\n end", "title": "" }, { "docid": "617fb4f8aa1ce6af587acdc4218679a8", "score": "0.7580167", "text": "def article_path( article )\n _article_path(:slug => article.full_url)\n end", "title": "" }, { "docid": "68bc91a862b844d31b9514bf980f656f", "score": "0.7564252", "text": "def slug\n specific.class.to_s.underscore.split('article_').last\n end", "title": "" }, { "docid": "9388d7799d586ededd2a186359b9933a", "score": "0.75582665", "text": "def slug\n query_for :slug do\n category = PublicEarth::Db::Category.find_by_id(self.id)\n category && category.slug || self.id.underscore.gsub(/_/, '-')\n end\n end", "title": "" }, { "docid": "eeeb778610332825e293a7b02c269344", "score": "0.7538332", "text": "def slug\n get_singular_rel(:slug)\n end", "title": "" }, { "docid": "cc3ae67e7c04214f278760b4e638c331", "score": "0.7438925", "text": "def article_path(article = current_page)\n prefix = article.blog_data.options.prefix.gsub(/\\//, '')\n \"#{prefix}/#{article.slug}/\"\n end", "title": "" }, { "docid": "16382acc5302b960471c4d853735df8c", "score": "0.7425255", "text": "def slug\n self.class.slug\n end", "title": "" }, { "docid": "16382acc5302b960471c4d853735df8c", "score": "0.7425255", "text": "def slug\n self.class.slug\n end", "title": "" }, { "docid": "16382acc5302b960471c4d853735df8c", "score": "0.7425255", "text": "def slug\n self.class.slug\n end", "title": "" }, { "docid": "2bff4db6561b34ccd801257cadc9b2be", "score": "0.7417995", "text": "def slug\r\n ret = read_attribute(:slug)\r\n if ret\r\n ret.split('.').join('_')\r\n else\r\n self.name\r\n end\r\n end", "title": "" }, { "docid": "aa3a951699c9994585626b6086f351ba", "score": "0.73898023", "text": "def slug\n get_singular_relationship_value(:slug)\n end", "title": "" }, { "docid": "df1b2375678db0fc69d47efc7a625f5d", "score": "0.736906", "text": "def slug\n @slug ||= record.find_slug(name, sequence)\n end", "title": "" }, { "docid": "524ed1e0c5c1ee7adf5575a2945a6351", "score": "0.7363419", "text": "def display_slug\n ENV['BASE_URL'] + self.slug\n end", "title": "" }, { "docid": "1738f6135fb8d6e7c38f826c5456abb6", "score": "0.73466474", "text": "def slug\n basename.split('_', 2)[1]\n end", "title": "" }, { "docid": "491f1fe56c2a755e25129c6ee71232b1", "score": "0.7342964", "text": "def slug\n @attributes[:slug]\n end", "title": "" }, { "docid": "e3f5122645285515191626acc41ad5cf", "score": "0.73116225", "text": "def to_s\n @slug\n end", "title": "" }, { "docid": "15acc76e01cb1de59ca24fe33d1b2c1a", "score": "0.7283705", "text": "def slug\n title.split.join('-').gsub(/[^\\w-]+/, '')\n end", "title": "" }, { "docid": "e0f9186fbc3a40cc5d3b699623cf8c17", "score": "0.72318316", "text": "def slug\n # hugs and kisses to Rick Olson's permalink_fu\n slug = title.dup\n slug.gsub!(/\\W+/, ' ')\n slug.strip!\n slug.downcase!\n slug.gsub!(/\\ +/, '-')\n return \"#{id.to_s}-#{slug}\"\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.72196954", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.72196954", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.72196954", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.72196954", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "efe80cac1f85d30af8f474d62a3c3d5c", "score": "0.72196954", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "7ee3558358988e39d6fc6954a84dccc4", "score": "0.7216329", "text": "def make_slug\n self.slug = strip_url(self.website).split(\".\").first\n end", "title": "" }, { "docid": "1cd4d89b547363437c2586fc1ae05851", "score": "0.7215126", "text": "def slug\n title.downcase.gsub(/\\W/,'-').squeeze('-').chomp('-')\n end", "title": "" }, { "docid": "f5f62c511ad6638c42ad198f3bfcc361", "score": "0.721191", "text": "def slug\n name\n end", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "894225db8a0e2a6088a1709da0a505a6", "score": "0.7211166", "text": "def to_param\n\t\tslug\n\tend", "title": "" }, { "docid": "99c22b359a2fe09ed3ef7be81fef6d68", "score": "0.7198395", "text": "def slug\n return '' if text.nil?\n @slug ||= text.match(/([\\w-]*)$/)[0]\n end", "title": "" }, { "docid": "c5545582819ca00ad122431e8c7ba12a", "score": "0.7188073", "text": "def slug\n @slug ||= File.basename(self.path, self.extension)\n end", "title": "" }, { "docid": "90c7385dbe2033a2b06d363100b7f576", "score": "0.7186684", "text": "def slug\n @slug ||= data_reader.sanitize_filename(basename)\n end", "title": "" }, { "docid": "0f085fa4405fffd1a9850ba5a05fb548", "score": "0.716935", "text": "def slug\n @slug = self.name.gsub(/ /, '-').downcase\n @slug\n end", "title": "" }, { "docid": "8074fc76a45bea9834aad7a13d632d67", "score": "0.7141769", "text": "def canonical_url\n \"http://localhost:3020/government/topics/#{slug}\"\n end", "title": "" }, { "docid": "654f8fe84f828b11392b700d44633a6d", "score": "0.71379334", "text": "def slug\n (self[:headline] || '').parameterize\n end", "title": "" }, { "docid": "654f8fe84f828b11392b700d44633a6d", "score": "0.71379334", "text": "def slug\n (self[:headline] || '').parameterize\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "1234fb1860ba316726c10f993f4f1e3d", "score": "0.713484", "text": "def to_param\n self.slug\n end", "title": "" }, { "docid": "e6bd54ff97ecc2ace89b9faf002d5459", "score": "0.7132065", "text": "def slug ; 'chipy' ; end", "title": "" }, { "docid": "ee27ead2fc0ebfcf21b815fd30b60e2d", "score": "0.713195", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "5fb5d3a4d7ff43107635f9c01ee4c0d9", "score": "0.7113334", "text": "def slug\n read_attribute(self.class.slug_column)\n end", "title": "" }, { "docid": "5eb4b7d8465c962ef750d08c46d9b9e6", "score": "0.7112208", "text": "def slug\n title.downcase.gsub(/\\W/, '-').squeeze('-').chomp('-')\n end", "title": "" }, { "docid": "c62bb6f909228f6ed399f327961bc7a2", "score": "0.7101106", "text": "def slug\n @text.to_slug.normalize.to_s\n end", "title": "" }, { "docid": "38a404776c9e4dad6f707dcd5a9e9859", "score": "0.7080394", "text": "def to_param\n self.slug \n end", "title": "" }, { "docid": "66683b6a667d613926007e36f1f9e273", "score": "0.7078226", "text": "def slug\n product.slug\n end", "title": "" }, { "docid": "7002234df7943e666101981e3c1895ce", "score": "0.70645976", "text": "def slug\n @global_page.slug\n end", "title": "" }, { "docid": "5cf4d6f5ffaa21b37867e9ca4a0eba40", "score": "0.70488435", "text": "def slug\n profile_url.sub(/^\\//, '')\n end", "title": "" }, { "docid": "4b24251045118ab6912d9aeb129b2770", "score": "0.70479125", "text": "def slug\n raise \"slug method is required for #{self.class.name}\"\n end", "title": "" }, { "docid": "bd5513d5d2e07ee7a1ed4fd1c99c21d2", "score": "0.7047427", "text": "def full_slug\n \"#{organization}/#{slug}\"\n end", "title": "" }, { "docid": "06ff2718fb846ab62abb53b993cd8373", "score": "0.7045284", "text": "def infer_slug entry\n slug = nil\n alt = e.links.find { |l| l['rel'] == 'alternate' }\n\n alt and alt['href'].split('/').last\nend", "title": "" }, { "docid": "85b326ca4cc50694ce92b8a96e4d0758", "score": "0.70336384", "text": "def slug\n @slug_resource ||= Slug.new(@client)\n end", "title": "" }, { "docid": "85b326ca4cc50694ce92b8a96e4d0758", "score": "0.70336384", "text": "def slug\n @slug_resource ||= Slug.new(@client)\n end", "title": "" }, { "docid": "666e4220e86eb3f52291b83c97857b2f", "score": "0.7013474", "text": "def slug\n self.title.downcase.gsub(/[^a-z0-9]/, '-').squeeze('-')\n end", "title": "" }, { "docid": "a63aa4fdac2dcb371ea46ac7649f15f3", "score": "0.6991663", "text": "def slug\r\n if @slug\r\n @slug\r\n else\r\n # sets instance varaible to the instance's name, with spaces replaced by \"-\"\r\n @slug = self.name.split.join(\"-\")\r\n end\r\n end", "title": "" }, { "docid": "ecee9644e3450687e77d96070bc04423", "score": "0.6990801", "text": "def generate_slug\n if self.title.present?\n self.slug = self.title.parameterize[0...50].sub(/-+\\z/, \"\")\n end\n end", "title": "" }, { "docid": "218477c8ba5f761ebe77e5fc05dacb7a", "score": "0.6985683", "text": "def slug\n (self.name.blank? ? self.title : self.name).to_s.parameterize\n end", "title": "" }, { "docid": "e99e8d7270a6392f031bdec1513a0fdf", "score": "0.6978536", "text": "def link\n self.redirect unless self.redirect.nil?\n (self.slug).gsub('//', '/')\n end", "title": "" }, { "docid": "ce7ba944ebd2ffb4305b75c221fbbd10", "score": "0.6969739", "text": "def to_param\n self[:slug]\n end", "title": "" }, { "docid": "c9315369de9c1d9df613c49e672d1e54", "score": "0.69636524", "text": "def real_slug (hierarchical)\n \"/#{hierarchical ? full_slug : slug}\"\n end", "title": "" }, { "docid": "ab6a639e3ef35f8938beaa83c14d4e0d", "score": "0.69554543", "text": "def webfinger_slug\n splitted_webfinger_id.first\n end", "title": "" }, { "docid": "d881b9a9e70d4a775cd30484023bc17a", "score": "0.6953958", "text": "def set_slug\n if self.slug.blank?\n # Some non-word characters were being included in the slug. This was screwing up voting later on.\n self.slug = self.title.to_url.scan(/\\w+/).join(\"-\") unless self.title.blank?\n end\n end", "title": "" }, { "docid": "f71ffde2e953879fab41f79d03817b7f", "score": "0.6945413", "text": "def rendered_slug\n return self.slug if self.slug\n\n self.slug = self.title\n .downcase\n .gsub(/\\P{ASCII}/, '')\n .gsub(/\\s+/, '-')\n .gsub(/[^a-z0-9\\-]/, '')\n .gsub(/-+/, '-')[0,80]\n self.save\n\n return self.slug\n rescue\n ''\n end", "title": "" }, { "docid": "2a0c86794fea63df19f1cdb77fba2bee", "score": "0.6928474", "text": "def slug\n self.title.downcase.gsub(/\\W/, \"-\") unless self.title.nil?\n end", "title": "" }, { "docid": "2a0c86794fea63df19f1cdb77fba2bee", "score": "0.6928474", "text": "def slug\n self.title.downcase.gsub(/\\W/, \"-\") unless self.title.nil?\n end", "title": "" }, { "docid": "eada3b56622aaf867adb894d5c691f42", "score": "0.69267493", "text": "def slug\n self.title.downcase.gsub(\"/\", \" \").gsub(\" \", \"-\")\n end", "title": "" }, { "docid": "cc1ad0bed1c820d2f9ca5728cf593084", "score": "0.69151014", "text": "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "title": "" }, { "docid": "96d1e289759a0df65a81ed38ed3ae403", "score": "0.6912492", "text": "def url\n \"posts/#{date.strftime(\"%Y/%m/%d\")}/#{slug}\"\n end", "title": "" }, { "docid": "e21392c4f112507625b001c710bd254f", "score": "0.69108886", "text": "def slug\n unless slug = read_attribute(:slug)\n return '' unless title.present?\n slug = Slug.for(title)\n if new_record?\n write_attribute(:slug, slug)\n else\n update_column(:slug, slug)\n end\n end\n\n slug\n end", "title": "" }, { "docid": "1da89aaa61a0efd529f0ea778968b7a7", "score": "0.6909044", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "85e976ee2c4f2fe748de54eac0edcfef", "score": "0.6900304", "text": "def to_param; slug end", "title": "" }, { "docid": "0d21ed6022a6a28dbffcdb8c46f703a1", "score": "0.68961334", "text": "def canonical_id\n @url\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" }, { "docid": "005f108044b5be1dc1b7369d6ee98bc7", "score": "0.6895005", "text": "def to_param\n slug\n end", "title": "" } ]
a0e97974d41bf6be95b8d0c7738574ab
true if it is whitelisted, an Integer, or a Float
[ { "docid": "685060b88ff78618f44dbac89dcbe6d4", "score": "0.7537517", "text": "def valid?(value)\n whitelisted_value?(value) || value.is_a?(Integer) || value.is_a?(Float)\n end", "title": "" } ]
[ { "docid": "03361bac3a04af8617708712a45dbfb3", "score": "0.6942512", "text": "def whitelisted_value?(value)\n WHITELIST.any? { |clazz| value.is_a?(clazz) }\n end", "title": "" }, { "docid": "a8fe092610b5106c0d1543f2732c97d1", "score": "0.6676384", "text": "def allowed?(val)\n case ftype\n when 'string', 'url'\n val.is_a?(String)\n when 'number'\n val.is_a?(Integer) || val.is_a?(Float)\n when 'sample'\n allowable_field_types.collect { |aft| aft.sample_type.id }.member? val.sample_type_id\n when 'item'\n allowable_field_types.collect { |aft| aft.object_type.id }.member? val.object_type_id\n end\n end", "title": "" }, { "docid": "7da5ed5e3e77b39adbfc1034e59e16d3", "score": "0.6513657", "text": "def number?\n [:double, :float, :integer, :long].include?(type)\n end", "title": "" }, { "docid": "7387c6e2ed7dc4bd805d75879da43141", "score": "0.63911235", "text": "def number?( item )\n [Float, Fixnum, Integer].any? {|type| item.is_a?( type )}\n end", "title": "" }, { "docid": "8522b80eb588d6962ed1108f918612e4", "score": "0.63489366", "text": "def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end", "title": "" }, { "docid": "f5ee8444423cf8ebc0b5488e316400ce", "score": "0.6340928", "text": "def float?(object)\n return true if Float(object)\n rescue \n return false\nend", "title": "" }, { "docid": "851dd4e429290c5b0434198c8633932d", "score": "0.6325424", "text": "def valid_number?(num)\n integer?(num) || float?(num)\nend", "title": "" }, { "docid": "10da0422547ada5d644ab0d17758e744", "score": "0.63055056", "text": "def number?(num)\n integer?(num) || float?(num)\nend", "title": "" }, { "docid": "cc3be1da50e1db3df7929391217b6ca2", "score": "0.62702763", "text": "def numeric?\n properties.include?(\"numeric\")\n end", "title": "" }, { "docid": "36dca830a44a2eb13a6713359711fe54", "score": "0.6244199", "text": "def valid_num?(input)\n integer?(input) || float?(input)\nend", "title": "" }, { "docid": "fc23ab29b88fdd086c1903890310dc33", "score": "0.61701477", "text": "def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend", "title": "" }, { "docid": "5bddead518cb45330039c01ed994a886", "score": "0.6164053", "text": "def numeric?(object)\n true if Float(object) rescue false\nend", "title": "" }, { "docid": "bd113bcafec19dfce0137e7ec6e31714", "score": "0.6162181", "text": "def herbalizable?(param)\n whitelisted?(param) && !blacklisted?(param)\n end", "title": "" }, { "docid": "a6bef4a10beef6f66187856eb9451c92", "score": "0.6160787", "text": "def is_a_number?(num)\n is_integer?(num) || is_float?(num)\nend", "title": "" }, { "docid": "e814fe3b002b8353b81024b400f57b5f", "score": "0.615904", "text": "def can_be_numeric?\n type == :numeric\n end", "title": "" }, { "docid": "37514952b9e802f27727998e12854261", "score": "0.6157744", "text": "def is_number?\n is_float? || is_integer?\n end", "title": "" }, { "docid": "093991436366c695e3e6f6bf7bd81d6b", "score": "0.6133947", "text": "def acceptable?(value)\n true\n end", "title": "" }, { "docid": "1f3bcb9c9c1deebdd6e695cb22f5c9d0", "score": "0.6128219", "text": "def float?(field)\n self.send(field).is_a? Float\n end", "title": "" }, { "docid": "22c9e7a32d21e1f1c4c57db083be7c8d", "score": "0.6098417", "text": "def type_allowed? type # Will check if the type is included in the list_types hash\n return @@list_types.keys.include?(type.to_sym)\n end", "title": "" }, { "docid": "3aba48f9ef6d864a8d151048644758f2", "score": "0.60612404", "text": "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end", "title": "" }, { "docid": "f7f09d82a086c1d6b1a4d437277674a2", "score": "0.6059118", "text": "def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end", "title": "" }, { "docid": "15864aa087cf83533d3a2d6b1c91a209", "score": "0.60555106", "text": "def is_numeric?(val)\n Float val rescue false\n end", "title": "" }, { "docid": "1d7e6a1516dcf083ab5d7982f39b67d5", "score": "0.5987284", "text": "def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end", "title": "" }, { "docid": "c1ae2252e80a01c24ca5665bc7b1b9c4", "score": "0.59839106", "text": "def is_float?\n\t\tFloat(self) != nil rescue false\n\tend", "title": "" }, { "docid": "6939ccbd47cd29cb6ce0f9fa330193f5", "score": "0.59790826", "text": "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "title": "" }, { "docid": "b74d7028aa6bcd6107b6f8cc4dd635b1", "score": "0.59735215", "text": "def float?\n self.class.float?(self)\n end", "title": "" }, { "docid": "15ec60049c94b84bd74a0c4d68fd2bcd", "score": "0.59670305", "text": "def valid_number?(num)\n valid_integer?(num) || valid_float?(num)\nend", "title": "" }, { "docid": "b8a4deb78c780ecfcc307b3629ec9d52", "score": "0.59396076", "text": "def is_numeric?(value)\n !!Float(value) rescue false \n end", "title": "" }, { "docid": "5b873d16e5093e828ff466933979e490", "score": "0.593938", "text": "def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end", "title": "" }, { "docid": "1edda59bcbfb615a67d68c3dac6bd208", "score": "0.59363884", "text": "def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end", "title": "" }, { "docid": "5239c55bac5fbccabf8b338151619d7f", "score": "0.5930233", "text": "def is_number?(i)\n true if Float(i) rescue false\nend", "title": "" }, { "docid": "5239c55bac5fbccabf8b338151619d7f", "score": "0.5930233", "text": "def is_number?(i)\n true if Float(i) rescue false\nend", "title": "" }, { "docid": "6abe493cfd6616743481f10c2184cdb1", "score": "0.5920823", "text": "def valid?(num)\n num.to_f.positive? && (valid_int?(num) || valid_float?(num))\nend", "title": "" }, { "docid": "b979c134da3b7c1da7532963dcba4c09", "score": "0.59203416", "text": "def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end", "title": "" }, { "docid": "0e757d0df3a64e9e53edcc2ec32e976f", "score": "0.59029156", "text": "def allowed?(*_)\n true\n end", "title": "" }, { "docid": "18fcbb2d3436aeb2f110c04697476521", "score": "0.5882933", "text": "def is_number(num)\n true if Float(num) rescue false\nend", "title": "" }, { "docid": "36a5ee4d1eaaabfec0a6f33de4d82574", "score": "0.5878387", "text": "def is_whitelisted?(address)\n !!(self.class.safetynet_options[:whitelist].match(address))\n end", "title": "" }, { "docid": "f4b7698ee3317a37a98b7a3f222e8122", "score": "0.5867332", "text": "def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end", "title": "" }, { "docid": "7497bd9a3bcb33ff3062e013990bcad8", "score": "0.58501196", "text": "def numeric?\n !!Float(self) rescue false\n end", "title": "" }, { "docid": "564508c3a1df2850c2d764c9a3c82c71", "score": "0.5843154", "text": "def allow?(item)\n @whitelist.include?(item) || [email protected]?(item)\n end", "title": "" }, { "docid": "316fd5d6b42c0d7ad543ef119152b1b3", "score": "0.58408815", "text": "def is_number? token\n Float(token) && true rescue false\n end", "title": "" }, { "docid": "66253a0baafea49680e4a9afdaf7283b", "score": "0.58396375", "text": "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "title": "" }, { "docid": "78a3f061e5608b2cc52303e711838ac0", "score": "0.5833056", "text": "def float?(num)\n num.to_f.to_s == num\nend", "title": "" }, { "docid": "e523794529435500c36fe2581cb15251", "score": "0.5824784", "text": "def is_float?(input)\n input.to_f.to_s == input\nend", "title": "" }, { "docid": "9227b8f8852e4a14f807b789711ec091", "score": "0.58056915", "text": "def is_number?(input)\n true if Float(input) rescue false\n end", "title": "" }, { "docid": "93187f227f295d6dbf66fa5deef4e9bf", "score": "0.5793248", "text": "def numeric?(object)\n true if Float(object) rescue false\n end", "title": "" }, { "docid": "1f78b73ad9d5cecda2afbaba41547dc7", "score": "0.57925284", "text": "def numeric?(num)\n !!Float(num) rescue false\nend", "title": "" }, { "docid": "0515610784638cdefab46aaf9a196fec", "score": "0.5786933", "text": "def float?(num)\n num == num.to_f.to_s\nend", "title": "" }, { "docid": "a277c8a4ef6f6198263f4209f323d8aa", "score": "0.5783188", "text": "def isFloat?\n !!Float(exp) rescue false\n end", "title": "" }, { "docid": "d4e122b02b4e7628d3b5aa53672766e2", "score": "0.5780714", "text": "def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end", "title": "" }, { "docid": "ee39e334e1e50b13fbc7135a455acf72", "score": "0.57729226", "text": "def valid_float_number?(num)\n num.to_f.to_s == num\nend", "title": "" }, { "docid": "023fa3239eeb294ca33c63900d93866f", "score": "0.57673156", "text": "def valid_importance?(importance)\n importance&.in? ValidImportances\n end", "title": "" }, { "docid": "35165f7ad585808ee3f646d1a72a7f1f", "score": "0.57518196", "text": "def params_checked(params)\n \tparams.each do |key, value|\n \t\tif !is_number?(value)\n \t\t\treturn false\n \t\tend\n \tend\n \treturn true\n end", "title": "" }, { "docid": "5d832a6efc76146a4b172dde26df3f5e", "score": "0.5737158", "text": "def operand?(str)\n\t\ttrue if Float(str) rescue false\n end", "title": "" }, { "docid": "917669fbcf678b729deb140ab83697c7", "score": "0.5733731", "text": "def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend", "title": "" }, { "docid": "b16b6acf525c0c634166f57dc51621e3", "score": "0.5728117", "text": "def numeric(x)\n true if Float(x) rescue false\n end", "title": "" }, { "docid": "af498e7e3f505376a984f1f20a9e3d7f", "score": "0.57230836", "text": "def is_float?\n self.to_f.to_s == self\n end", "title": "" }, { "docid": "08f37a2eb6fd4d6b09b71a8aaee06ff4", "score": "0.57184523", "text": "def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend", "title": "" }, { "docid": "9eb1a328bcc3b3393563a7633d874f00", "score": "0.57162046", "text": "def digits_only?(value)\n case value\n when Integer, ActiveModel::Type::Integer, ActiveSupport::Duration\n true\n when String, Symbol, Numeric, ActiveModel::Type::Float\n (s = value.to_s).present? && s.delete('0-9').blank?\n else\n false\n end\n end", "title": "" }, { "docid": "afbcfe2b52c29bf33d16c0678e953ff1", "score": "0.5712546", "text": "def wildcard?\n all_abilities? && all_ages? && !equipment? && !weight?\n end", "title": "" }, { "docid": "a15beba79d05eb2cf47c3b03d693cbe9", "score": "0.5690683", "text": "def numeric?\n type == \"NUMERIC\"\n end", "title": "" }, { "docid": "29ec151fa40094e49f9592732a85ec00", "score": "0.56888366", "text": "def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end", "title": "" }, { "docid": "80b8ea037a8d8193699b20e667f9feb0", "score": "0.56882817", "text": "def float?(num)\n num.to_f().to_s()==num\nend", "title": "" }, { "docid": "8d0cee81377b2e97d31bbc062aa9466f", "score": "0.5673004", "text": "def is_numeric?\n self.data_type == 'number'\n end", "title": "" }, { "docid": "059cd5f685ad5c4af24c6345237b3541", "score": "0.5667552", "text": "def valid_amount?\n Float(params[:amount]) rescue false\n end", "title": "" }, { "docid": "25e1407ef7299f1f06341657217203ec", "score": "0.5661937", "text": "def whitelisted?(request)\n false\n end", "title": "" }, { "docid": "875bfb4f9177519c24034e3fbb040970", "score": "0.5658914", "text": "def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end", "title": "" }, { "docid": "a0e3e9e4cbf970663c86a6820c396291", "score": "0.5649156", "text": "def numeric?\n\t\treturn all? {|x| Math.Is_Numeric?(x)}\n\tend", "title": "" }, { "docid": "59113b658b41e42f9733c9b62b40ae13", "score": "0.5647078", "text": "def float3?(input)\n Float(input) rescue false\nend", "title": "" }, { "docid": "11a1844e625548f8e7329606a7227f99", "score": "0.5645718", "text": "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "11a1844e625548f8e7329606a7227f99", "score": "0.5645718", "text": "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "a83e43b30464b276062cabf342db76ff", "score": "0.56422997", "text": "def allowed?\n true\n end", "title": "" }, { "docid": "a83e43b30464b276062cabf342db76ff", "score": "0.56422997", "text": "def allowed?\n true\n end", "title": "" }, { "docid": "d1ec3f6517398d4c9c19040f95fd9efc", "score": "0.5640089", "text": "def recognizable_value?(value_as_string)\n value_as_string =~ /^(\\+|-)?\\d+(\\.\\d*)?$/\n end", "title": "" }, { "docid": "01a9836bb01a2632b7e837a0e253b919", "score": "0.56367284", "text": "def allowed?\n allowed\n end", "title": "" }, { "docid": "d015ba04f7686ab06e918a06760162d0", "score": "0.56324106", "text": "def is_limit_valid?(limit)\n return (limit.class == Float &&\n limit >= 0.0 &&\n limit <= 100.0)\n end", "title": "" }, { "docid": "b80b53cb87ac5e0a7b830f490079c0b9", "score": "0.5630978", "text": "def number?\n lookahead?([:T_INT, :T_FLOAT])\n end", "title": "" }, { "docid": "7e084bdb241f6337021c51f79ae36505", "score": "0.562294", "text": "def numeric?\n true\n end", "title": "" }, { "docid": "94a3d21ac8a236b91cbd3b675612e1b0", "score": "0.56197023", "text": "def valid?\n case @thing\n when Integer, String, Symbol then true\n when TrueClass, FalseClass, NilClass then true\n else false\n end\n end", "title": "" }, { "docid": "c5f1d0985b3b47351bdc632253f6a675", "score": "0.56192523", "text": "def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end", "title": "" }, { "docid": "7a2fb43b249ea592712c5e644b4afd51", "score": "0.5616766", "text": "def allowed?\n true\n end", "title": "" }, { "docid": "067f0c336526540b82abc25fef65bb9d", "score": "0.56099975", "text": "def has_numeric(types)\n types.each do |elem|\n if elem != 'string'\n return true\n end\n end\n \n return false\n end", "title": "" }, { "docid": "02b4fccd11ea65b6b144e876acd729e7", "score": "0.5601585", "text": "def allowed?(request)\n case\n when whitelisted?(request) then true\n when blacklisted?(request) then false\n else true # override in subclasses\n end\n end", "title": "" }, { "docid": "ff2fc9ecc6447abe430fbe29cfdbd1e7", "score": "0.5598288", "text": "def float?(str)\n true if Float(str) rescue false\n end", "title": "" }, { "docid": "c48fc1dcc9307262cd261b3f89890f7d", "score": "0.55852026", "text": "def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend", "title": "" }, { "docid": "196c77bbdd81d5d9fdfb3c0f1e0dfc40", "score": "0.5584926", "text": "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "title": "" }, { "docid": "bc902ba5d3bfb735a54f074e49d4c431", "score": "0.5583488", "text": "def all_numeric?\n all? {|e| e.kind_of? Numeric }\n end", "title": "" }, { "docid": "9fe633158befa1cc8e6c44af3e040e52", "score": "0.55821186", "text": "def valid?(value, types)\n types.any? do\n case _1\n when :array then true if value.is_a?(Array)\n when :boolean then true # in Ruby everything is a boolean\n when :float then true if value.is_a?(Float) || value.is_a?(Integer)\n when :hash then true if value.is_a?(Hash)\n when :integer then true if value.is_a?(Integer)\n when :string then true if value.is_a?(String)\n when :symbol then true if value.is_a?(Symbol)\n when Class then true if value.is_a?(_1) # for custom checks\n else\n raise \"unknown flag type #{_1.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "ab02787e38514c088db24cbcee8ea343", "score": "0.55764484", "text": "def numeric?(object)\n \t\ttrue if Integer(object) rescue false\n \tend", "title": "" }, { "docid": "2cf31daadc0fe85af382ad9fac85541d", "score": "0.5573524", "text": "def is_numeric?\n data_type == 'number'\n end", "title": "" }, { "docid": "ed744a6b5c669fa6384f3cb9f1a9c94a", "score": "0.5561584", "text": "def allowed?; true end", "title": "" }, { "docid": "569eb71ce42b9eff4f34366db18aa753", "score": "0.55551755", "text": "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "title": "" }, { "docid": "3874953591245d68724cf330dbb9247d", "score": "0.5540592", "text": "def is_valid?(types, item)\n types.each do |type|\n if type == :ipv4\n return true if ipv4?(item)\n elsif type == :domain\n return true if domain?(item)\n elsif type == :hash\n return true if hash?(item)\n elsif type == :classification\n return true if classification?(item)\n elsif type == :tag\n return true if tag?(item)\n elsif type == :bool\n return true if bool?(item)\n elsif type == :ssl_field\n return true if ssl_field?(item)\n elsif type == :whois_field\n return true if whois_field?(item)\n elsif type == :tracker_type\n return true if tracker_type?(item)\n end\n end\n return false\n end", "title": "" }, { "docid": "55172d721297cbd9339b860286a9d697", "score": "0.55302995", "text": "def filter_available?\r\n # -1 = unused, 2 = Filter used\r\n self.query.ole_object.ortype == -1 ||\r\n self.query.ole_object.ortype == 2\r\n end", "title": "" }, { "docid": "577686f102593d4baae17c10672d737a", "score": "0.5526183", "text": "def is_number? string\n true if Float(string) rescue false\nend", "title": "" }, { "docid": "3393afe510b913878a13326fda77be7e", "score": "0.55237615", "text": "def whitelisted?(request)\n whitelisters.any? { |name, whitelister| whitelister.matched?(request) }\n end", "title": "" }, { "docid": "7199b3f26244ffd07b3f29ce7d837891", "score": "0.5521295", "text": "def is_integer?(num)\n\tif num.is_a? Integer\n\t\ttrue\n\telsif num.is_a? Float\n\t\tif num.nan?\n\t\t\tfalse\n\t\telsif num == num.floor\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\telse\n\t\tfalse\n\tend\nend", "title": "" }, { "docid": "5f8ff708f38c80b8dd6b36b2a5a32cfd", "score": "0.5516385", "text": "def type_enabled?(type)\n return true unless types_filter.any?\n types_filter.include? type\n end", "title": "" }, { "docid": "84d4355e0b8ff8d384efd889901b6f5f", "score": "0.55121034", "text": "def valid?(value)\n whitelisted_value?(value) || value.is_a?(Hash)\n end", "title": "" }, { "docid": "723c9e5db80d06f35aa8a027800594e8", "score": "0.55090284", "text": "def is_numeric?(s)\n !!Float(s) rescue false\n end", "title": "" } ]
452fecd92cae8f811b2471c1dc78c254
Create a new worktree for this branch at the given path location.
[ { "docid": "d23203c32d4a9b40756335b8de00ea25", "score": "0.7757673", "text": "def new_worktree(path, opts = {})\n @base.new_worktree(path, full, opts)\n end", "title": "" } ]
[ { "docid": "e7c800b6b40acae78c693bad44f3cb2c", "score": "0.8337973", "text": "def new_worktree(path, branch = nil, opts = {})\n self.lib.worktree_add(path, branch, opts) unless Dir.exists?(path)\n self.class.new({:working_directory => path})\n end", "title": "" }, { "docid": "8aa3b933e96625c80f50587c4166594f", "score": "0.75528276", "text": "def create_worktree(dest, branch)\n Dir.chdir @root do\n sh \"git worktree add #{dest} #{branch}\"\n end\n end", "title": "" }, { "docid": "b44e4eee039b608bfa5ea6917f5921a8", "score": "0.6661516", "text": "def create_branch(branch, path = Dir.pwd)\n #ap method(__method__).parameters.map { |arg| arg[1] }\n g = MiniGit.new(path)\n error \"not yet any commit performed -- You shall do one\" unless commits?(path)\n g.branch branch.to_s\n end", "title": "" }, { "docid": "39103548fbbc991d6e90a6d755624fb2", "score": "0.65874845", "text": "def worktree_add(path, branch = nil, opts = {})\n arr_opts = []\n arr_opts << 'add'\n arr_opts << '-f' if opts[:force]\n arr_opts << '-b' << opts[:branch] if opts[:branch]\n arr_opts += [path]\n arr_opts += [branch] if branch\n command('worktree', arr_opts)\n end", "title": "" }, { "docid": "9c9544629e364c9e617e958de1e8c3b0", "score": "0.64991313", "text": "def worktree(dir, commitish = nil)\n Git::Worktree.new(self, dir, commitish)\n end", "title": "" }, { "docid": "a6311cfe3262924944dc1fcd96668839", "score": "0.63522106", "text": "def create(path)\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", "title": "" }, { "docid": "b406b03c7857cebe5975166d626495f4", "score": "0.6239876", "text": "def build(branch, body = {})\n CircleCi.request(\"#{base_path}/tree/#{branch}\").post(body) \n end", "title": "" }, { "docid": "4fe85c651efb39b75374f2137a6fc2d0", "score": "0.6057902", "text": "def make_branch(branch_name)\n\n\t\t$snapshot_tree = Marshal.load(File.binread($store_dir))\n\t\t$head = File.open(head_dir, 'r'){|f| f.read}\n\t\t# Make a Json file in repo named \"branches.json\"\n\t\tjson_dir = File.join(repo_dir, \"branches.json\")\n\t\t# Record branch_nam and HEAD's snapshot_ID\n\t\tjhash = {\"#{branch_name}\" => \"#{$head}\"}\n\t\tFile.open(json_dir, \"w\") do |f|\n\t\t\tf.write(jhash.to_json)\n\t\tend\n\n\t\tsnapshot_branch = $snapshot_tree.add_snapshot($head + 1)\n\t\tsnapshot_branch.branch_name = branch_name\n\t\tsnapshot_branch.branch_HEAD = true\n\n\t\thead_snapshot = $snapshot_tree.find_snapshot($head)\n\n\t\thead_snapshot.add_child(snapshot_branch)\n\t\tsnapshot_branch.add_parent(head_snapshot)\n\t\tsnapshot_branch.repos_hash = head_snapshot.repos_hash\n\n\t\thead_snapshot.branches.push(branch_name)\n\n\t\t# transfer to this branch\n\t\t$snapshot_tree.current_branch = branch_name\n\t\thead_snapshot = snapshot_branch\n\t\t$head = head_snapshot.snapshot_ID\n\n\t\t# update \"head\" and \"store\"\n\t\tFile.open(head_dir, 'w'){ |f| f.write (\"#{head}\")}\n\t\tFile.open($store_dir, 'wb'){|f| f.write(Marshal.dump($snapshot_tree))}\n\n\n\tend", "title": "" }, { "docid": "050faa765c1f5f90f53bcb9c45ed7e77", "score": "0.59830165", "text": "def new_tree(x, y)\n @forest.push(Tree.new(x, y))\n end", "title": "" }, { "docid": "5e83ed082a77e1f41f61a9653994a6a8", "score": "0.59075487", "text": "def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\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", "title": "" }, { "docid": "5761c2299ae3a3cb00bf63d447e04fe9", "score": "0.5897789", "text": "def tree(treeish = 'master', paths = [])\n Tree.construct(self, treeish, paths)\n end", "title": "" }, { "docid": "5761c2299ae3a3cb00bf63d447e04fe9", "score": "0.5897789", "text": "def tree(treeish = 'master', paths = [])\n Tree.construct(self, treeish, paths)\n end", "title": "" }, { "docid": "3a130b0cf64c83121b0c27e585c1bf78", "score": "0.5881461", "text": "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", "title": "" }, { "docid": "a0fb15e4df9b1c89181d1e3eb1f312cf", "score": "0.58514774", "text": "def create_branch(branch, base_branch)\r\n switch_branch(@basedir)\r\n ex(\"bzr branch #{base_branch} #{branch}\")\r\n switch_branch(branch)\r\n end", "title": "" }, { "docid": "6af75e92471d10ea92f1cedcd56dee5f", "score": "0.585099", "text": "def create_branch(branch, base_branch)\r\n switch_branch(base_branch)\r\n ex(\"hg branch #{branch}\")\r\n commit(\"\", Time.at(0), \"create branch\")\r\n end", "title": "" }, { "docid": "b72be2fb627449634bc57fd99a6299fe", "score": "0.5831695", "text": "def mkdir(path)\n @nodes[path] ||= Node.new(path, @index, nodes: {})\n end", "title": "" }, { "docid": "7c666ddd9b2020b420d726ab7a79521c", "score": "0.58225703", "text": "def mkworkspace(path, body, initheader = nil)\n request(Mkworkspace.new(path, initheader), body)\n end", "title": "" }, { "docid": "22c9011a0c942fbfe7277bbdbd361da2", "score": "0.5810955", "text": "def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end", "title": "" }, { "docid": "1fe8fe8f95c56d7dddf915abeb9de810", "score": "0.5743068", "text": "def create_branch\n git.new_branch(branch_name, config.deploy_branch)\n end", "title": "" }, { "docid": "c006c923a428c220912d7f1a1034bb08", "score": "0.57422334", "text": "def create_branch(dir, branch)\n\tDir.chdir(dir) do |path|\n\t\tapprove_and_execute([\n\t\t\t\t\"git checkout develop\", \n\t\t\t\t\"git pull\", \n\t\t\t\t\"git checkout -b #{branch}\"\n\t\t\t\t], \"in #{path}\")\n\tend\nend", "title": "" }, { "docid": "db6e6fdb7a9efeb6f8f930fb9097c2cb", "score": "0.57398635", "text": "def create_branch(project, branch, ref)\n post(\"/projects/#{url_encode project}/repository/branches\", query: { branch: branch, ref: ref })\n end", "title": "" }, { "docid": "381376fe422f6473ced46ae95f9a5a80", "score": "0.56621647", "text": "def create_branch(branch, base_branch)\r\n switch_branch(base_branch)\r\n ex(\"git branch -q #{branch}\")\r\n switch_branch(branch)\r\n end", "title": "" }, { "docid": "687fcd566e743736aa652f9d47428018", "score": "0.5636508", "text": "def make_directory(txn, path)\n # turn \"path\" into absolute path\n path = expand_path(path, \"/\")\n # do nothiing if \"path\" is the root\n return txn if path == \"/\"\n\n # get the path of parent folder\n parent_path = File.dirname(path)\n # and create parent folder before the current folder (recursively)\n txn = make_directory(txn, parent_path)\n\n # now that the parent folder has been created,\n # create the current folder\n if (txn.root.check_path(path) == 0)\n txn.root.make_dir(path)\n end\n\n return txn\n end", "title": "" }, { "docid": "79905ed176da4e984fb074b6dd1a8c14", "score": "0.5636104", "text": "def worktree(dir, commitish = T.unsafe(nil)); end", "title": "" }, { "docid": "d577c4b3e259556cec3ecfd265f35a57", "score": "0.56303966", "text": "def execute\n raise ArgumentError unless new_branch_name\n git.new_branch(new_branch_name, source_branch_name)\n end", "title": "" }, { "docid": "e28753e3d47c344742f928079746e1ff", "score": "0.5617425", "text": "def create!(path)\n be = new(path)\n be.save!\n\n be\n end", "title": "" }, { "docid": "38d20c01f21702c0138d9252be6437de", "score": "0.56105924", "text": "def git_branch_create(new_branch_name)\n repo.create_branch(new_branch_name)\n end", "title": "" }, { "docid": "5f365b1657539e271ad0a79b4da47d49", "score": "0.5553424", "text": "def in_work_tree(path)\n tmp_dir = path == :tmp\n path = Dir.mktmpdir if tmp_dir\n old_work_tree = ENV['GIT_WORK_TREE']\n ENV['GIT_WORK_TREE'] = path\n Dir.chdir(path) { yield path }\n ENV['GIT_WORK_TREE'] = old_work_tree\n FileUtils.rm_rf path, :secure => true if tmp_dir\n end", "title": "" }, { "docid": "2799359a9e98f774aa20c296fe69feed", "score": "0.55363387", "text": "def create_tree_node\n if tree_node\n new_node = TreeNode.new(tree_node)\n new_node.resource = self\n new_node.save!\n end\n end", "title": "" }, { "docid": "52fca2ee19f79e5e16a68e057df4580f", "score": "0.55309683", "text": "def create_path\n @zk.create(self.class.path(@root_znode))\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "1b168a607fc48eb4b288d6f6c03a09d6", "score": "0.55286175", "text": "def create_branch\n @branch = @project.create_branch params[:branch_name]\n if @branch\n flash[:notice] = \"Successfully created #{params[:branch_name]}!\"\n redirect_to project_tree_path @project, @branch.name\n else\n flash[:alert] = 'Something went wrong, the branch was not created!'\n redirect_to project_branches_path @project\n end\n end", "title": "" }, { "docid": "a5115fb09b9127420052811d0e9b9568", "score": "0.551547", "text": "def create(path, encoding: self.encoding, perm: self.perm, **_opts, &block)\n full = @root.join(norm_path(path))\n FileUtils.mkdir_p(full.dirname.to_s)\n\n BFS::Writer.new(full, encoding: encoding, perm: perm) do |temp|\n FileUtils.mv temp, full.to_s\n end.perform(&block)\n end", "title": "" }, { "docid": "b4c141cb3a989414000feb6cc1bd713b", "score": "0.5455382", "text": "def get_node(path)\n\t\tarray = path.split('/')\n\t\t@cur_branch = @tree\n\t\tarray.each {|arr| @cur_branch = @cur_branch[arr]}\n\n\t\t@cur_branch\n\tend", "title": "" }, { "docid": "cec9d1e4244776b7acb90aa4e23ace84", "score": "0.5454694", "text": "def mktree(path, subdirs)\n mkdir(path)\n\n subdirs.each do |dir|\n mkdir(File.join(path, dir))\n end\n end", "title": "" }, { "docid": "c96c48a68eab27e9c3c68b7608db6d79", "score": "0.5444369", "text": "def enroot(path)\n branching_class.new(path, self).tap { |e| e.relative! }\n end", "title": "" }, { "docid": "73badb51472f3dca93c37a0c567f5cb0", "score": "0.5429668", "text": "def mkpath(path)\n FileUtils.mkpath\n end", "title": "" }, { "docid": "2b47768fba678cf013c277dde2572872", "score": "0.5409089", "text": "def setup_branch(branch, new_content=nil)\n raise 'Not implemented'\n end", "title": "" }, { "docid": "3574203c312b308a48d537b8a30a3d49", "score": "0.5400443", "text": "def create(path)\n f = new path\n f.touch\n f\n end", "title": "" }, { "docid": "0818990137ccf0e6d89dab030508ae2a", "score": "0.54002523", "text": "def create_branch(name)\n commands = [\n \"echo 'For branch #{name}' >> branch\",\n 'git add branch',\n \"git commit -m 'Commit for branch #{name}'\",\n \"git checkout -b #{name} -q\"\n ].join(' && ')\n `#{commands}`\nend", "title": "" }, { "docid": "3f1732d301938569c042148de80675c4", "score": "0.5397911", "text": "def mkpath\n path = self.expand_path\n path = path.dirname if path.file? # Make sure the directory for the file exists\n Pathname(path).mkpath\n end", "title": "" }, { "docid": "3f1732d301938569c042148de80675c4", "score": "0.5397911", "text": "def mkpath\n path = self.expand_path\n path = path.dirname if path.file? # Make sure the directory for the file exists\n Pathname(path).mkpath\n end", "title": "" }, { "docid": "b21cc60a0e68b891ddd1079033f8621b", "score": "0.5393631", "text": "def create_branch(name, sha_or_ref = \"HEAD\")\n case sha_or_ref\n when Rugged::Object\n target = sha_or_ref.oid\n else\n target = rev_parse_oid(sha_or_ref)\n end\n\n branches.create(name, target)\n end", "title": "" }, { "docid": "9a576a2cb9f5d558440b080c4e0f1610", "score": "0.53906083", "text": "def create_branch(project, source, branch)\n body = { ref: source }\n put(branch_path(project, branch), body)\n rescue Gerry::Api::Request::RequestError\n # try source as revision\n body = { revision: source }\n put(branch_path(project, branch), body)\n end", "title": "" }, { "docid": "46a74545d8222fbb5af2e10e08703853", "score": "0.53615594", "text": "def from_path(path)\n lambda { |parent, child| start [\"build\", path, parent, child] }\n end", "title": "" }, { "docid": "b65230ed53d3736affa8208500e0cad8", "score": "0.53584576", "text": "def create\n logger.debug {\"Creating working copy at #{path}\"}\n end", "title": "" }, { "docid": "b65230ed53d3736affa8208500e0cad8", "score": "0.53584576", "text": "def create\n logger.debug {\"Creating working copy at #{path}\"}\n end", "title": "" }, { "docid": "00f0948219dda93fc4b7559915ac24ee", "score": "0.5352292", "text": "def create!\n return if path.exist?\n FileUtils.mkdir_p path\n in_repository do\n # TODO: Add a way to hook into the results of creating the repository.\n # E.g. so we can have post-create hooks.\n cmd(:git, '--bare', :init).ok?\n end\n end", "title": "" }, { "docid": "ba868c82f5345f9ee23734865882e5fe", "score": "0.5344989", "text": "def create(path, opts={}, &block)\n full = @root.join(norm_path(path))\n FileUtils.mkdir_p(full.dirname.to_s)\n\n temp = BFS::TempWriter.new(full, opts) {|t| FileUtils.mv t, full.to_s }\n return temp unless block\n\n begin\n yield temp\n ensure\n temp.close\n end\n end", "title": "" }, { "docid": "ff384c0331f31e9de5f4c324f45f779d", "score": "0.53415936", "text": "def mkpath(path)\n FileUtils.mkpath(path)\n end", "title": "" }, { "docid": "f22d45f26308b8ca9ea49dfc2be33810", "score": "0.5334803", "text": "def branch_for(name)\n branches.find_or_create_by(name: name)\n end", "title": "" }, { "docid": "c99feed290bd11245d8ced6c0f5cd34b", "score": "0.5331893", "text": "def new_branch(description)\n # Duplicated 'name' branch?\n if (File.directory?(branch_path()))\n return [false, \"Branch #{@name} already exists\"]\n end\n\n # Create the branch directory\n Dir.mkdir(branch_path())\n Dir.mkdir(\"#{branch_path()}/objects/\")\n Dir.mkdir(\"#{branch_path()}/runs/\")\n\n # Branch info YAML file\n branch_info = Hash.new\n branch_info[@name] = {\n \"description\" => description, \n \"author\" => @user, \n \"runs\" => 0, \n \"failures\" => 0, \n \"changelog\" => {\n Time.now.to_i => create_changelog_entry(\"Init branch\") \n } \n }\n save_branch_info(branch_info)\n return [true, \"Branch #{name} created successfully\"]\n end", "title": "" }, { "docid": "f009757ca5563ae7444661bbc8787e95", "score": "0.53265536", "text": "def create_branch(project_name, source, branch)\n # try source as ref\n body = { ref: source }\n put(\"/projects/#{project_name}/branches/#{branch}\", body)\n rescue Gerry::Api::Request::RequestError\n # try source as revision\n body = { revision: source }\n put(\"/projects/#{project_name}/branches/#{branch}\", body)\n end", "title": "" }, { "docid": "4e4dc4e7a87f75fc0897dbfa944a2daa", "score": "0.5326488", "text": "def mkbranch(rev, tag)\n raise NotImplementedError.new\n end", "title": "" }, { "docid": "73c7974353d7d003f610039249fc5a53", "score": "0.53244287", "text": "def initialize_path\n create_path\n write_state\n end", "title": "" }, { "docid": "6eaf7361505be908316fbefdc632c136", "score": "0.532089", "text": "def create_branch_from_commit(branch_name, commit)\n system [\n 'cd ~/test',\n \"git branch --no-track #{branch_name} #{commit}\",\n \"git push origin #{branch_name}\"\n ].join(' && ')\nend", "title": "" }, { "docid": "8e7cfd549f52d108922dbf17cb27dd80", "score": "0.5316543", "text": "def create_path\n @zk.create(ZNODE_PATH)\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "03eaa37e7e5d1092ff7a2a0182871983", "score": "0.5316474", "text": "def new\n @tree = Tree.new\n end", "title": "" }, { "docid": "03eaa37e7e5d1092ff7a2a0182871983", "score": "0.5316474", "text": "def new\n @tree = Tree.new\n end", "title": "" }, { "docid": "3b4b22ff6d2c9208b9a20d97d6770bc6", "score": "0.5302315", "text": "def switch_to_new_branch(new_branch)\n Dir.chdir @root do\n sh \"git checkout -b #{new_branch}\"\n end\n end", "title": "" }, { "docid": "91b0fd89ee5a3f1bfe1818f4d1e0dffe", "score": "0.52961224", "text": "def create\n @branch = Branch.new(permitted_params.branch)\n @branch.project = @project\n @branch.parent = @parent if @parent\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to project_branches_url(@project), notice: 'Branch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @branch }\n else\n format.html { render action: 'new' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e633a7976439872f9a30aa54313edcfe", "score": "0.52859193", "text": "def expand_tree(path)\n names = path.split('/')\n names.pop\n parent = git.root\n names.each do |name|\n object = parent[name]\n break if !object\n if object.type == :blob\n parent.move(name, name + CONTENT_EXT)\n break\n end\n parent = object\n end\n end", "title": "" }, { "docid": "6e0d30ecde95e68bc70a67cacd93a3b8", "score": "0.5278461", "text": "def create_branch(branch)\n command = \"git checkout --quiet -b #{branch}\"\n command_success?(command)\n end", "title": "" }, { "docid": "0e0f9dcc2d7930c2e1db5907e7f28444", "score": "0.52673304", "text": "def create\n @qbl_tree = QblTree.new(params[:qbl_tree])\n\n respond_to do |format|\n if @qbl_tree.save\n format.html { redirect_to @qbl_tree, notice: 'Qbl tree was successfully created.' }\n format.json { render json: @qbl_tree, status: :created, location: @qbl_tree }\n else\n format.html { render action: \"new\" }\n format.json { render json: @qbl_tree.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d94460e753f772d175c2d0c29230614", "score": "0.5266517", "text": "def branch(name, create_without_build: false)\n find_or_create_branch(name: name, create_without_build: create_without_build)\n end", "title": "" }, { "docid": "b41af57e8ee1ff83218ebdb522163c87", "score": "0.5251184", "text": "def new_branch(name=nil)\n return \"git.new_branch [name of new branch]\" if name.nil?\n co \"-b #{name}\"\n end", "title": "" }, { "docid": "a8bebf37a99c32862f75e5e5a0e72723", "score": "0.5246917", "text": "def add_dir(path)\n return self if path.dot?\n add_entry(path) { Git::Object::Tree.new }\n end", "title": "" }, { "docid": "4ff33d62fe5e33ff1f286e722c348899", "score": "0.52321255", "text": "def build_tree(start_position)\n @root = Node.new(start_position)\n build_driver(@root)\n end", "title": "" }, { "docid": "d29e800040548b2938d6d0f50b1d3c7e", "score": "0.5223215", "text": "def create_new_git_branch\n run(\"git checkout -b update_#{gem_name}_gem_#{Time.now.to_i}\")\n end", "title": "" }, { "docid": "22673d2aaf8e42cde33ec97be768a68f", "score": "0.52195895", "text": "def new_node_in_tree(a, b)\n c = TreeNode.new(a.integer + b.integer, a.character + b.character)\n c.right = a\n c.left = b\n a.parent = c\n b.parent = c\n c\n end", "title": "" }, { "docid": "8cf832ceea3a4eebb138c8a0d7ac6900", "score": "0.52178675", "text": "def create!\n Dir.mkdir(path)\n end", "title": "" }, { "docid": "2294869ebbe94afe44e21a4b1545442e", "score": "0.521717", "text": "def make_dir(path)\n path = parse_path(path)\n update_descriptor(path)\n @sandbox[path].create\n yield true\n end", "title": "" }, { "docid": "71fd41367bd12ba678dcda00fd7048b7", "score": "0.5210555", "text": "def create_local_branch(branch_name, repo)\n local_branch = repo.branches[branch_name]\n return local_branch unless local_branch.nil?\n\n $logger.debug(\"Creating local branch: #{branch_name}\")\n rbranch = \"#{@remote_name}/#{branch_name}\"\n raise MiqFlow::GitError, \"Unable to find remote branch #{rbranch}\" if repo.branches[rbranch].nil?()\n\n repo.create_branch(branch_name, rbranch)\n end", "title": "" }, { "docid": "4d235295d94af4257955d27afbb72dc4", "score": "0.5205266", "text": "def add_new_branch()\n\t\tdata = read_file(@currentDir + \"/repository\", \"_branches.txt\")\n\t\tdata = data.split('\\n')\n\t\tnewB = Array.new\n\t\tnewB[0] = @curbranch\n\t\tnewB[1] = @version\n\t\tdata.push(newB.join(' '))\n\t\tpath = @currentDir + \"/repository\"\n\t\twrite_file(path, \"_branches.txt\", data.join(\"\\n\"))\n\t\tDir.open(@prev_dir).each do |file|\n\t\t\tif(!file.start_with?('.'))\n\t\t\t\twrite_file(@branch_dir, file, read_file(@prev_dir, file))\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "4ebc8ea6f86d8cc9c34b17434a14c56d", "score": "0.5201576", "text": "def create_dir path\n base, name = split_path path\n assert_not cd(base), :include?, name\n cd(base)[name] = {dir: true}\n end", "title": "" }, { "docid": "ac3a306f680bf97285adba223c757346", "score": "0.51940376", "text": "def make_directory(txn, path) \n if (txn.root.check_path(path) == 0)\n txn.root.make_dir(path)\n end\n end", "title": "" }, { "docid": "55c89a7084ccd244e20ed3ac8fb130c6", "score": "0.5193665", "text": "def create!\n FileUtils.mkdir(self.path)\n self.nodes.each {|node| node.create! }\n end", "title": "" }, { "docid": "04a28671623f6aa75e9c8abac81e112f", "score": "0.51852936", "text": "def create_branch(child, parent_id)\n parent = Page.find(parent_id)\n\n branch = parent.branches.create!({\n destination_id: child[:id],\n choice_text: child[:text]\n })\n\n # story = Story.first\n story = @user.stories.first\n story.branches << branch\nend", "title": "" }, { "docid": "05c3d29f8f78a32fab3166e0b537de32", "score": "0.51818293", "text": "def build_tree(location = @character.cur_location)\n @root = Node.new(location)\n node_queue = [@root]\n locations_added = [@root.location]\n # make new nodes from each possible good move, and then check those nodes\n # for moves until no new lcotions appear, or until all move locations\n # have already been explored\n until node_queue.empty?\n cur_node = node_queue.shift\n @character.get_legal_moves(cur_node.location).each do |square|\n unless locations_added.include?(square)\n # create a new node with cur_node as parent\n child = Node.new(square, cur_node)\n cur_node.create_child(child)\n node_queue << child\n locations_added << square\n end\n end\n end\n end", "title": "" }, { "docid": "639b7283ce5d6ab31d13a65042560ef0", "score": "0.5179883", "text": "def create_branch(issue_key)\n ui.info \"Checking for existing branch...\"\n unless @git.branches.collect {|branch| branch.name }.include? issue_key\n\n #create the new branch\n branch_repo(issue_key)\n\n # create, update and write the new cookbook version\n increment_version(@issue.issuetype, @cookbook_name, @cookbook_path)\n\n # commit our changes and push\n @git.commit_all(\"Creating new branch for #{issue_key}\")\n @git.push(@git.remote, issue_key)\n\n # add a comment to the issue\n @issue.comment(\"Created new branch: #{issue_key}\")\n else\n ui.info \"Using existing branch: #{issue_key}\"\n @git.checkout(issue_key)\n end\n end", "title": "" }, { "docid": "3dbfba984d8159f714dc6e989d1e0256", "score": "0.5177755", "text": "def execute\n @gitRepository.create(@path)\n end", "title": "" }, { "docid": "6b86f5ac11ac26e5c07f493b8370ab07", "score": "0.51735634", "text": "def create_branch(name:, from_current:)\n from = if from_current\n current_branch\n else\n CONFIG[:default_branch]\n end\n check_status\n git_remote = ask_for_remote\n `git checkout #{from}` # Be sure to be on the default or specified branch.\n `git pull #{git_remote} HEAD` # Be sure to get the remote changes locally.\n `git checkout -b #{name}` # Create the new branch.\n puts \"\\nYou are now working on branch #{current_branch} created from #{from} !\"\n end", "title": "" }, { "docid": "f5e93422d05a9a14adcb1fb90aa6fbbe", "score": "0.515861", "text": "def create_story_branch(story)\n log \"creating the feature branch\"\n branch = branch_name(story)\n git \"checkout -b #{branch}\"\n # git \"push --set-upstream origin #{branch}\"\n end", "title": "" }, { "docid": "6479b7ceb2e490855584bb12edd0ed7b", "score": "0.51542896", "text": "def branch(*nodes)\n return branch(*nodes.first) if nodes.size == 1 and nodes.first.is_a? Enumerable\n\n parent = self\n nodes.each do |node|\n raise InvalidNode, \"#{node} in Path #{nodes.inspect} is not a valid tree node\" if\n node.is_a? Enumerable\n parent = Path.__send__(:new, parent, node)\n end\n\n parent\n end", "title": "" }, { "docid": "01d537f9365d8e3224e83c7c2db982e0", "score": "0.5151772", "text": "def initialize(path,options={})\n super(File.expand_path(path),options)\n\n @root = if File.basename(@path) == 'trunk'\n File.dirname(@path)\n else\n @path\n end\n\n @trunk = File.join(@root,'trunk')\n @branches = File.join(@root,'branches')\n @tags = File.join(@root,'tags')\n end", "title": "" }, { "docid": "e9ee3fef426bcb7e18eb89c51688415e", "score": "0.5135454", "text": "def build_move_tree\n @node = PolyTreeNode.new(start_pos)\n end", "title": "" }, { "docid": "a3c9ee77abd3de2472a336658a6b7870", "score": "0.5132989", "text": "def create_splunk_directory(path)\n dir = Chef::Resource::Directory.new(path, run_context)\n dir.path(path)\n dir.recursive(false)\n dir.owner(node['splunk']['user'])\n dir.group(node['splunk']['group'])\n dir.mode('0755')\n dir.run_action(:create)\n new_resource.updated_by_last_action(true) if dir.updated_by_last_action?\n end", "title": "" }, { "docid": "42f9521d691edeb96759a7e197882e0b", "score": "0.5124789", "text": "def add_at_path(path,subtree)\n\t\tparent_tree = tree_at_path(path)\n\t\tparent_tree << subtree\n\t\treturn self\n\tend", "title": "" }, { "docid": "9868119d43ff316d36c0639c4ae78295", "score": "0.51222116", "text": "def create\n\t\tconnection.create_dir(full_path)\n\t\tself\n\tend", "title": "" }, { "docid": "d5472aa11237f4be42833ec9aa23a038", "score": "0.51158047", "text": "def mk_sourcetree\n source = tempfile\n sourcefile = File.join(source, \"file\")\n Dir.mkdir source\n File.open(sourcefile, \"w\") { |f| f.puts \"yay\" }\n\n dest = tempfile\n destfile = File.join(dest, \"file\")\n return source, dest, sourcefile, destfile\n end", "title": "" }, { "docid": "5ab05d3385b4bda01dfdcb14e8036a49", "score": "0.5114829", "text": "def create_branch branch_name, remote: true, start_point: 'main'\n run \"git checkout -b #{branch_name} #{start_point}\"\n run \"git push -u origin #{branch_name}\" if remote\nend", "title": "" }, { "docid": "eb3b35c4c9a00afe323b98c22a31b1ec", "score": "0.51109606", "text": "def initialize path\n @path = B::Path.new path\n @name = Name.new @path.basename '.*'\n @job = [ ]\n @node = nil\n end", "title": "" }, { "docid": "f1c3cefcccb7cecb2ed462dc0c2127fe", "score": "0.51082563", "text": "def make_branch(value, node = @root)\r\n\t\tif value < node.value\r\n\t\t\tif node.leftChild == nil\r\n\t\t\t\tnode.leftChild = Node.new(value, node)\r\n\t\t\telse\r\n\t\t\t\tmake_branch(value, node.leftChild)\r\n\t\t\tend\r\n\t\telse #value >= node.value\r\n\t\t\tif node.rightChild == nil\r\n\t\t\t\tnode.rightChild = Node.new(value, node)\r\n\t\t\telse\r\n\t\t\t\tmake_branch(value, node.rightChild)\r\n\t\t\tend\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "b8a8881b0fcc080cef0cd1ffa201660f", "score": "0.5101859", "text": "def create_path(full_path, value=nil)\n paths = full_path.split('/')\n # Don't create the child node yet\n paths.pop\n paths.shift\n path = ''\n paths.each do |p|\n path << \"/#{p}\"\n # Ignore errors since it may already exist\n @zookeeper.create(:path => path)\n end\n if value\n @zookeeper.create(:path => full_path, :data => value, :ephemeral => @ephemeral)\n else\n @zookeeper.create(:path => full_path)\n end\n end", "title": "" }, { "docid": "98dede0709e9d8f926bf43b80011fd66", "score": "0.5101162", "text": "def worktrees\n Git::Worktrees.new(self)\n end", "title": "" }, { "docid": "cebc16b77ee347a77843741278e88423", "score": "0.5100304", "text": "def create\n parent_id = params[:folder][:parent_id]\n parent = Folder.find(parent_id)\n filespace = parent.filespace\n folder = nil\n begin\n ActiveRecord::Base.transaction do\n folder = Folder.new(name: \"New Node\")\n logger.info \"Filespace id is #{filespace.id}\"\n folder.filespace_id = filespace.id\n parent.children << folder\n \n # filespace.save! # also saves the new folder\n parent.leaf = false\n parent.save!\n end\n rescue Exception => e\n logger.info e.message\n logger.info e.backtrace.join(\"\\n\")\n render json: nil, status: :unprocessable_entity\n else\n logger.info folder.to_json\n render json: folder.to_json\n end\n end", "title": "" }, { "docid": "b613a9521fe7bf48b3769310bb672216", "score": "0.5092682", "text": "def checkout_tree(tree_digest, path)\n tree = load(tree_digest)\n Dir.mkdir(path) unless File.directory?(path)\n tree.each do |type, entry, digest, mode|\n full_path = File.join(path, entry)\n case type\n when :tree\n checkout_tree(full_path, digest)\n when :blob\n checkout_blob(full_path, digest)\n end\n File.chmod(mode, full_path)\n end\nend", "title": "" }, { "docid": "1bd80dc9b0487048b3cfd769f3725a54", "score": "0.50912476", "text": "def create_tree_path\n return false unless id\n newpath = ( (parent && parent.path_ids) || []) + [id]\n return true if path_ids == newpath\n self.path_ids = newpath\n save\n end", "title": "" }, { "docid": "2e644845890311e4d1071749509f60de", "score": "0.50794226", "text": "def process(path, metadata)\n existing_node = @root.child_at_path(path)\n if existing_node.present?\n return process_existing_node(existing_node, metadata)\n end\n\n # If the new entry includes parent folders that don't yet exist in your local state, \n # create those parent folders in your local state.\n parent = @root.mkdir_p(parent_path_for(path))\n\n Node.create!({\n dropbox_id: user.id,\n name: path_to_name(path),\n dropbox_path: path,\n size: metadata['bytes'],\n filetype: metadata['mime_type'],\n parent: parent\n })\n end", "title": "" }, { "docid": "f1f974ff7fd0248a7eff13a1cc9976c5", "score": "0.5078501", "text": "def create\n FileUtils.mkdir_p @path\n end", "title": "" }, { "docid": "b3870348ab0d42126b5c76c898d21cce", "score": "0.5078473", "text": "def create\n RootBranch.context(user: current_user) do\n parent = Category.where(version: Integer(params[:parent][:version])).first\n parent.add_child(params[:category])\n end\n\n redirect_to categories_url, notice: 'Category was successfully created.'\n end", "title": "" } ]
0e92526de95d5efb2cf0fb9e700dc3c6
Delete the instance from the database
[ { "docid": "f41317159865cad956b6911b9a495dc5", "score": "0.7563899", "text": "def delete\n Database.delete @id, self.class.table_name\n end", "title": "" } ]
[ { "docid": "087e9dd27bdcd5001b10eba7755e8dce", "score": "0.8205462", "text": "def delete\n self.class.database.delete self\n end", "title": "" }, { "docid": "8d314cdfb099dc6c90afbbaf33f278f4", "score": "0.80951273", "text": "def destroy\n self.class.database.delete(self)\n end", "title": "" }, { "docid": "cf8864cc312c2d7fb240c2efe7c77923", "score": "0.77663094", "text": "def delete\n ensure_service!\n service.delete_table(instance_id, name)\n true\n end", "title": "" }, { "docid": "9db59855ea09270330fd39413f80fddc", "score": "0.7658873", "text": "def destroy\n @database_instance = @object\n @database_instance.destroy\n\n respond_to do |format|\n format.html { redirect_to database_instances_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "25dae3ada6ce8e40cbe3a0c9485760b3", "score": "0.76432866", "text": "def destroy\n db.transaction do\n before_destroy\n delete\n after_destroy\n end\n end", "title": "" }, { "docid": "01a44f8e939e3bff637795b1bd270618", "score": "0.76277906", "text": "def destroy!\n database_context.destroy(self)\n end", "title": "" }, { "docid": "3a2fc5834ca80c2b2249e2f91f0ccbaf", "score": "0.76254344", "text": "def delete\n ensure_service!\n service.delete_instance instance_id\n true\n end", "title": "" }, { "docid": "2599a61279ea1be686dee9a4e09e6903", "score": "0.76235276", "text": "def destroy\r\n DBconnect.instance.query(\"DELETE FROM #{self.class.name}s WHERE ID = #{self.id};\")\r\n end", "title": "" }, { "docid": "2f3fa8a5d5440e40b59d1ef4821dadf6", "score": "0.7604784", "text": "def delete(instance)\n end", "title": "" }, { "docid": "c78949e20cda61696f9e5ca133f83e6d", "score": "0.76036286", "text": "def delete\n ensure_service!\n service.delete_instance(instance_id)\n true\n end", "title": "" }, { "docid": "5e0745963621d04b732afd8934e9854c", "score": "0.75969875", "text": "def destroy!\n response = @connection.dbreq(\"DELETE\", @dbmgmthost, \"#{@dbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\", @dbmgmtport, @dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end", "title": "" }, { "docid": "1e22ba2d6ef2af788cc3f7ddc4f58af0", "score": "0.7584089", "text": "def destroy\n authorize! :destroy, @db_instance\n @db_instance.destroy\n respond_to do |format|\n format.html { redirect_to db_instances_url, notice: 'Database instance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a72c5165c3afe5a281bb07ada95b482", "score": "0.75305283", "text": "def delete()\n\n self.destroy\n end", "title": "" }, { "docid": "0a72c5165c3afe5a281bb07ada95b482", "score": "0.75305283", "text": "def delete()\n\n self.destroy\n end", "title": "" }, { "docid": "95e05a26ef94e02e4ff6c1c184e22d70", "score": "0.75000656", "text": "def destroy\n Destroy.execute(self)\n end", "title": "" }, { "docid": "95e05a26ef94e02e4ff6c1c184e22d70", "score": "0.75000656", "text": "def destroy\n Destroy.execute(self)\n end", "title": "" }, { "docid": "0345f0652eac27933bb310df33249771", "score": "0.7494817", "text": "def destroy\n @instance.destroy\n \n flash[:success] = \"Instance Deleted Successfully!\" \n redirect_to instances_url \n end", "title": "" }, { "docid": "3499d750647b1c168ce7aa5a5b388399", "score": "0.7472379", "text": "def destroy\r\n if (@new_record)\r\n raise 'Cannot delete object from database because it has not been inserted'\r\n end\r\n \r\n id = get_attribute(primary_key)\r\n #delete(id)\r\n options = { :id => id }\r\n @@dbcontroller.delete(table_name, options)\r\n set_attribute(primary_key, default_primary_key_value)\r\n @new_record = true\r\n end", "title": "" }, { "docid": "4833e14e06b8e3c7119aa97d0849cb71", "score": "0.7418808", "text": "def destroy\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "title": "" }, { "docid": "89d0050dd5e6d55201b4f3f278129694", "score": "0.7406104", "text": "def destroy\n run_in_transaction { _destroy }\n end", "title": "" }, { "docid": "f97246afffca2c91b4956a99cbdf3ff7", "score": "0.7393897", "text": "def destroy\n @db_instance = DbInstance.find(params[:id])\n\n if params[:db_instance_delete_cancel]\n redirect_to db_instances_path\n return\n end\n\n respond_to do |format|\n if @db_instance.destroy\n format.html do\n flash[:notice] = \"Database Instance '#{@db_instance}' successfully deleted\"\n redirect_to db_instances_path\n end\n format.xml { head :ok }\n else\n format.html { render :action => 'delete' }\n format.xml { render :xml => @db_instance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24daf971b0db3b99307af39423232c72", "score": "0.73735833", "text": "def delete(instance); nil end", "title": "" }, { "docid": "dc7978b571fa1af94fbce826dcf38dc1", "score": "0.7360117", "text": "def destroy; delete end", "title": "" }, { "docid": "97f89b7150643d7be58b66133b1672c4", "score": "0.7322652", "text": "def destroy\n self.class.destroy(self.id)\n end", "title": "" }, { "docid": "97f89b7150643d7be58b66133b1672c4", "score": "0.7322652", "text": "def destroy\n self.class.destroy(self.id)\n end", "title": "" }, { "docid": "e8958cfafe1ba11c7c0ef5824ca11e8d", "score": "0.7321215", "text": "def destroy\n delete\n end", "title": "" }, { "docid": "e8958cfafe1ba11c7c0ef5824ca11e8d", "score": "0.7321215", "text": "def destroy\n delete\n end", "title": "" }, { "docid": "b753081be979702541dfa59de43713b2", "score": "0.73193383", "text": "def destroy\n delete\n end", "title": "" }, { "docid": "b753081be979702541dfa59de43713b2", "score": "0.73193383", "text": "def destroy\n delete\n end", "title": "" }, { "docid": "194d39cec833098983f796548365b804", "score": "0.7291607", "text": "def destroy\n db.transaction do\n return false if before_destroy == false\n delete\n after_destroy\n end\n self\n end", "title": "" }, { "docid": "81be8d9096f183f0c8d08104518fbe8e", "score": "0.72863716", "text": "def destroy\n use_transactions ? db.transaction{_destroy} : _destroy\n end", "title": "" }, { "docid": "34b13286df5caff682a76236aeee701b", "score": "0.7285177", "text": "def delete!\n Mongoid::Persistence::Remove.new(self).persist\n end", "title": "" }, { "docid": "2e82c7af02988f805f832952c4834515", "score": "0.7284383", "text": "def destroy\n DB.execute(\"DELETE FROM #{self.class.table} WHERE id = ?\", id)\n puts(\"\\s #{self.class} SQL Statement: \".cyan.bold + \"DELETE FROM #{self.class.table} WHERE id = #{id}\".red.bold)\n end", "title": "" }, { "docid": "c06177cb069db4417c93f7b0bc615552", "score": "0.7281951", "text": "def destroy\n return false unless self.id\n DBConnection.execute(<<-SQL)\n DELETE FROM #{table_name} WHERE id = #{self.id}\n SQL\n\n true\n end", "title": "" }, { "docid": "3336495b216149aabe1f4d5c5607a8cd", "score": "0.7279479", "text": "def delete_instance\n super\n end", "title": "" }, { "docid": "5a2d783ef0b9a13525c5b43ead3234b6", "score": "0.72788984", "text": "def delete\n @sql = 'DELETE'\n\n self\n end", "title": "" }, { "docid": "f83ab09c95fcc34fc70683da43b59e6d", "score": "0.72704893", "text": "def destroy\n unless new_record?\n connection.delete(self.class.table_name, self.id)\n end\n\n # FIXME: this currently doesn't work because we write the attributes everytime we read them\n # which means that we cannot read the attributes of a deleted record... it's bad\n# freeze\n end", "title": "" }, { "docid": "5bb5e4414b42364dccb5ef507fce6151", "score": "0.72632813", "text": "def delete\n destroy\n end", "title": "" }, { "docid": "f65f9b2a4be988ab611ef43c7e3aaa81", "score": "0.7248366", "text": "def delete!\n @destroyed = true\n Mongoid::Persistence::Remove.new(self).persist\n end", "title": "" }, { "docid": "24eec449213076cdae14d924678e6f73", "score": "0.7243719", "text": "def destroy\n self.class.destroy(id)\n end", "title": "" }, { "docid": "24eec449213076cdae14d924678e6f73", "score": "0.7243719", "text": "def destroy\n self.class.destroy(id)\n end", "title": "" }, { "docid": "d7291f6223d7c4995fed2ee35c89549d", "score": "0.72308713", "text": "def destroy\n self.class.query(self, :delete).nil?\n end", "title": "" }, { "docid": "79dfa09948c31ecf9cb9639a9815bfde", "score": "0.72290325", "text": "def destroy\n sql = \"DELETE FROM #{table_name} WHERE id=#{id}\"\n\n @@connection.exec(sql)\n end", "title": "" }, { "docid": "aa40d966d3e4b6b6ae28ccd34cbd4386", "score": "0.7225629", "text": "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "title": "" }, { "docid": "0bb1187d932a09b2efe190ec04af0043", "score": "0.72188276", "text": "def delete\n self.class.delete(@id)\n end", "title": "" }, { "docid": "ee306bbfb0ef05ab38b1c6a111c22297", "score": "0.72047764", "text": "def destroy!\r\n self.class.service_instance.delete_table(self.name)\r\n end", "title": "" }, { "docid": "dab4b1f0d4a4b8ac635a56eeb172b33f", "score": "0.71993536", "text": "def delete!\n deleted\n save!\n end", "title": "" }, { "docid": "7cacc6d92bfd311dfcc9e7201e690310", "score": "0.7189935", "text": "def delete!\n self.class.delete!(id: id)\n end", "title": "" }, { "docid": "4dd65010ea002b8596dd85d43261a7bf", "score": "0.7185976", "text": "def delete\n self.destroy\n end", "title": "" }, { "docid": "4dd65010ea002b8596dd85d43261a7bf", "score": "0.7185976", "text": "def delete\n self.destroy\n end", "title": "" }, { "docid": "4c083571afcdaf5958ce46271feb9ab9", "score": "0.71773356", "text": "def destroy\n self.class.destroy(self)\n end", "title": "" }, { "docid": "dcc33a228fd00157be484dca07cdaa58", "score": "0.71698755", "text": "def destroy()\n destroy!\n end", "title": "" }, { "docid": "1548573732edfa9145d31c368df82e55", "score": "0.7168579", "text": "def destroy_instance(instance_id)\n destroy_resource :instance, instance_id\n end", "title": "" }, { "docid": "7bfe23391f956b34d42a79668bbc8d56", "score": "0.71452117", "text": "def destroy!; self.class.destroy!(@id); end", "title": "" }, { "docid": "413d121312bee7a3eaf6db76debef3fb", "score": "0.7142556", "text": "def destroy\n _destroy\n end", "title": "" }, { "docid": "4bec9ea466a41de8a3be66a80badeaac", "score": "0.71393365", "text": "def destroy_instance(instance_id)\n db = self.class.load_database(database_file)\n instance = db.select(&find_by_states(ACTIVE, STOPPED)).find(&find_by_uuid(instance_id))\n raise StandardError.new(\"No Server Matches ID\") if instance.nil?\n\n # Mark the instance as available again.\n instance.state = AVAILABLE\n\n self.class.persist_database(db, database_file)\n end", "title": "" }, { "docid": "30a0fa0ed041c6e41cbd72b9e2ecb0f9", "score": "0.71267414", "text": "def delete\n run_hooks(:before, :delete)\n SORM.storage.delete(sorm_key)\n run_hooks(:after, :delete)\n @persisted = false\n @sorm_id = nil\n self\n end", "title": "" }, { "docid": "b46c7093c76f560195990bb1c782ac1d", "score": "0.71192163", "text": "def delete\n self.class.delete(self.name)\n end", "title": "" }, { "docid": "a944e917a559dc6a26bba77d6ba773f9", "score": "0.7116287", "text": "def destroy(id)\n @@instances.delete(id)\n end", "title": "" }, { "docid": "d6987b8ffbc82312b6797c4e5026f039", "score": "0.7112334", "text": "def destroy\n unless new_record?\n connection.delete(\n \"DELETE FROM #{self.class.quoted_table_name} \" +\n \"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}\",\n \"#{self.class.name} Destroy\"\n )\n end\n\n @destroyed = true\n freeze\n end", "title": "" }, { "docid": "9aa5b10b044730fe32dd947cf7cc2119", "score": "0.7110173", "text": "def destroy\n end", "title": "" }, { "docid": "9aa5b10b044730fe32dd947cf7cc2119", "score": "0.7110173", "text": "def destroy\n end", "title": "" }, { "docid": "a81a39a6f0d5cf131f06362b03474956", "score": "0.7108636", "text": "def destroy\n run_callbacks :destroy do\n self.delete_record\n end\n end", "title": "" }, { "docid": "d5160143440daef9f71eeb6c307fbc00", "score": "0.71002054", "text": "def delete\n @table.delete @record\n end", "title": "" }, { "docid": "03309d7bc4293356265fed717455a8e7", "score": "0.7093051", "text": "def delete!\n result = delete\n self.class.with_deleted do\n self.class.delete! self.id\n end\n result\n end", "title": "" }, { "docid": "ff34408ad8424212346ba8e97204d96a", "score": "0.70912635", "text": "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ff34408ad8424212346ba8e97204d96a", "score": "0.70912635", "text": "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to instances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8cea5a0e68df25cf2fa1ddae613b8356", "score": "0.70877814", "text": "def destroy\n self.class.destroy(self.id)\n end", "title": "" }, { "docid": "0920178db62876ae1552e0a22a737d09", "score": "0.70857364", "text": "def destroy!\n response = @connection.dbreq(\"DELETE\",@dbmgmthost,\"#{@dbmgmtpath}/instances/#{CloudDB.escape(@instance.id.to_s)}/users/#{CloudDB.escape(@name.to_s)}\",@dbmgmtport,@dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n true\n end", "title": "" }, { "docid": "3f09e89499b91555560763de76083789", "score": "0.70646495", "text": "def destroy\n @db_inst.destroy\n respond_to do |format|\n format.html { redirect_to db_insts_url, notice: 'Db inst was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ede7bf095305eb62328475fb4168255", "score": "0.70606625", "text": "def destroy!\n _destroy\n end", "title": "" }, { "docid": "4b699a4d2da578a8b9c621017b358899", "score": "0.70392805", "text": "def delete_instance(vm_id)\n execute('onevm', ['delete', vm_id])\n end", "title": "" }, { "docid": "007b0b2906e4f3e3d37d4149b6ce0b0e", "score": "0.70353645", "text": "def delete\n CONNECTION.execute(\"DELETE FROM users WHERE id = #{self.id};\")\n end", "title": "" }, { "docid": "25fa08f890a06421cd6eac1cb91434b7", "score": "0.70312965", "text": "def destroy\n Mara.instrument('model.destroy', model: self) do\n Mara::Batch.delete_model(primary_key)\n end\n end", "title": "" }, { "docid": "3817745106f22fe7e162f4591758c3b4", "score": "0.7028943", "text": "def destroy!\n self.destroy\n end", "title": "" }, { "docid": "944807c21c60f4ad1713f197b7c14aa7", "score": "0.70288867", "text": "def delete\n execute_dui(delete_sql)\n end", "title": "" }, { "docid": "1fcd01b2f6c7895d4872f694cbe8b25d", "score": "0.70266545", "text": "def destroy\n @conn.destroy\n self\n end", "title": "" }, { "docid": "1ffdb45a0a1857775198160131d2df5a", "score": "0.70213705", "text": "def destroy\n # .....\n end", "title": "" }, { "docid": "b14aa865c129a37e77cd1fb8d2b0e9a4", "score": "0.70194095", "text": "def delete_instance_in_project(project, instance)\n set_tenant project\n\n activate_instance(instance)\n remove_attached_instance_resources(project, instance)\n\n begin\n instance.destroy\n rescue => e\n e.message << \"Couldn't delete instance #{ instance.name } in #{ project.name }. \" +\n \"The error returned was: #{ e.inspect }.\"\n raise e\n end\n end", "title": "" }, { "docid": "8bf572aeb3078343aeae8c0f6b093758", "score": "0.69958353", "text": "def destroy\n \n end", "title": "" }, { "docid": "8bf572aeb3078343aeae8c0f6b093758", "score": "0.69958353", "text": "def destroy\n \n end", "title": "" }, { "docid": "8bf572aeb3078343aeae8c0f6b093758", "score": "0.69958353", "text": "def destroy\n \n end", "title": "" }, { "docid": "8bf572aeb3078343aeae8c0f6b093758", "score": "0.69958353", "text": "def destroy\n \n end", "title": "" }, { "docid": "8bf572aeb3078343aeae8c0f6b093758", "score": "0.69958353", "text": "def destroy\n \n end", "title": "" }, { "docid": "442a2b66868725c036087d253f99071f", "score": "0.69955033", "text": "def destroy!\n destroy || _raise_record_not_destroyed\n end", "title": "" }, { "docid": "89fcefc23aa8f55f223fae7904de0c76", "score": "0.6995268", "text": "def destroy\n @current_method = \"Delete\"\n notify(self) { connection.delete_document(self.class.table_name, id) }\n\n @persisted = false\n self\n end", "title": "" }, { "docid": "60fc4fad15b8d733c086321ef28143a4", "score": "0.69945335", "text": "def delete\n deleted\n save\n end", "title": "" }, { "docid": "06075f8538660b10c020629aca28d840", "score": "0.69855165", "text": "def destroy\n DB.execute(\"DELETE FROM players WHERE id = #{@id}\")\n end", "title": "" }, { "docid": "fa262f3cb85272167c6ae39536940c26", "score": "0.6975679", "text": "def del\n delete\n end", "title": "" }, { "docid": "315b8710b41db84fb34bfa9eea138174", "score": "0.6974231", "text": "def destroy\n # The basic syntax of DELETE query with WHERE clause is as follows:\n # \"DELETE FROM table_name\n # WHERE [condition];\"\n delete_row = \"DELETE FROM #{self.class.table} WHERE id = #{@hash[\"id\"]};\"\n DB.execute delete_row\n end", "title": "" }, { "docid": "dcb5195ca64e18b7be5de3082913265f", "score": "0.697303", "text": "def delete\n sql = \"DELETE FROM visitors WHERE id = ?\"\n DB.execute(sql, self.id)\n end", "title": "" }, { "docid": "976aea38741e5f4ea7c0f95603e49aac", "score": "0.6971927", "text": "def destroy\n @instance.destroy\n\n respond_to do |format|\n format.html { redirect_to(instances_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "375353c618e7c9aef57d0bffcd7078e9", "score": "0.69706196", "text": "def destroy\n #\n end", "title": "" }, { "docid": "75d0afc8ccdc3a1c2292ddca8b20e979", "score": "0.6954537", "text": "def destroy\n @instance = Instance.find(params[:id])\n @instance.destroy\n flash[:notice] = \"Instance #@instance is shutting down\"\n respond_to do |format|\n format.html { redirect_to(instances_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "344a0b05f717916bc6afb0400de92f27", "score": "0.69533765", "text": "def destroy\n persistence_strategy.destroy\n end", "title": "" }, { "docid": "5f95b6104abfac1e4ceb20e0b19f33d7", "score": "0.6952827", "text": "def delete\n self.class.complain(\"deleted\")\n end", "title": "" }, { "docid": "7ba33e93e2c84b9fd31e5920c673fc55", "score": "0.6945972", "text": "def delete!\n delete.tap do |result|\n self.class.with_deleted do\n self.class.delete! self.id\n end\n end\n end", "title": "" }, { "docid": "986a84d016743b7689a8079a9d5aa29b", "score": "0.69410485", "text": "def destroy\n raise ArgumentError, \"doc.database required to destroy\" unless database\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "title": "" }, { "docid": "236d74f7b85c380424e74a08634919f3", "score": "0.6930191", "text": "def destroy\n run_in_transaction(:destroy) do\n _destroy # Delete the entity after deleting connected entities\n _set_private_vars_to_nil\n end\n rescue NoMethodError => e\n _raise_doesnt_exist_anymore_error(e)\n end", "title": "" }, { "docid": "e6c795eb680fdbe660776cf3706ee8da", "score": "0.6929327", "text": "def delete\n table = self.class.to_s.pluralize.downcase\n DATABASE.execute(\"DELETE FROM #{table} WHERE id = #{id}\")\n self\n end", "title": "" } ]
a599c66e1c7230c3feeb169b1b4c278c
GET /daycares/1 GET /daycares/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "916bae95a90d2eacaee2f52a3d4acc9b", "score": "0.71646947", "text": "def show\n render json: @dailycares\n end", "title": "" }, { "docid": "d4f384162574fbcb4f4c5bdec7757986", "score": "0.7109825", "text": "def index\n @dailycares = Dailycare.all\n render json: @dailycares\n end", "title": "" }, { "docid": "fdb314b737343f128cfbcbccd85c6010", "score": "0.6996116", "text": "def show\n @cigs_per_day = CigsPerDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cigs_per_day }\n end\n end", "title": "" }, { "docid": "89df12c97e95a0b737b8af3ecc41654e", "score": "0.6893521", "text": "def show\n @day = Day.find(params[:id])\n\n render json: @day\n end", "title": "" }, { "docid": "b8a2fd96ec33fe2980b91b0d16f770c7", "score": "0.66225225", "text": "def show\n @day = Day.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "b8a2fd96ec33fe2980b91b0d16f770c7", "score": "0.66225225", "text": "def show\n @day = Day.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "b8a2fd96ec33fe2980b91b0d16f770c7", "score": "0.66225225", "text": "def show\n @day = Day.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "3e29a3e67af5a7d1fcfc8ea4d1f6c629", "score": "0.6532872", "text": "def index\n @daycares = Daycare.all\n end", "title": "" }, { "docid": "83a81f08a0fdb99a9e6a9f5a3d03964c", "score": "0.6522142", "text": "def show\n @t_cal_day = TCalDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @t_cal_day }\n end\n end", "title": "" }, { "docid": "84919f9f29e435ca9d3a0d2dba4880b2", "score": "0.65164495", "text": "def show\n @event = Event.find(params[:id])\n @days = @event.countdown\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "4100b731c8f60ef8b9dc98acb6091321", "score": "0.64165604", "text": "def dayIndex\n render json: Head.headDay\n end", "title": "" }, { "docid": "eb2c3e885a66fc2165d879aabc0a0a04", "score": "0.6348509", "text": "def show\n @day = @user.days.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "e9197137af5871c2e25a961eba4bfc28", "score": "0.63303894", "text": "def show\n @almanac_day = AlmanacDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @almanac_day }\n end\n end", "title": "" }, { "docid": "54a079212e1fc18b04ec0f6880fbeb78", "score": "0.63217926", "text": "def show\n @health_datum = HealthDatum.find(params[:id])\n\n @cigs_per_day = CigsPerDay.last\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_datum }\n end\n end", "title": "" }, { "docid": "35061d179996f17cd2c03a4934d3ca30", "score": "0.63036716", "text": "def show\n @day_entry = DayEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day_entry }\n end\n end", "title": "" }, { "docid": "3672fa1584c2782ffb62eddd47af05eb", "score": "0.6292138", "text": "def show\n @dayline = Dayline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayline }\n end\n end", "title": "" }, { "docid": "63595a9a9da168dbdb3d644a6f316144", "score": "0.62723684", "text": "def index\n @almanac_days = AlmanacDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @almanac_days }\n end\n end", "title": "" }, { "docid": "0385ed117b570170302d3f42b90522b8", "score": "0.62360966", "text": "def all\n @days = Day.where(\"date >= ?\", Date.today).all\n respond_to do |format|\n format.json { render json: @days }\n end\n end", "title": "" }, { "docid": "50e778eafe5dead12852623df06c5b8b", "score": "0.6177398", "text": "def show\n @calificacion = Calificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion }\n end\n end", "title": "" }, { "docid": "23a9433d9328565b29050cdf28fe5dce", "score": "0.6114399", "text": "def show\n @daily_datum = DailyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_datum }\n end\n end", "title": "" }, { "docid": "4714e8c418d51144752de4eba6b6aa47", "score": "0.6106384", "text": "def dayIndex\n render json: Driver.driversDay\n end", "title": "" }, { "docid": "d297a821f40f82f747ea9258e82d201c", "score": "0.60728115", "text": "def show\n @hollyday = Hollyday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hollyday }\n end\n end", "title": "" }, { "docid": "e2f253039f4b92c531dfc5cad4fefb42", "score": "0.60701734", "text": "def index\n \n @sections = @day.sections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, { "docid": "f53aad2994576bffe1ecb3ae3bf8cc7d", "score": "0.6058771", "text": "def show\n @man_day = ManDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @man_day }\n end\n end", "title": "" }, { "docid": "cdca1a8440eca42f1c507f49ec10c968", "score": "0.60519767", "text": "def show\n @ctime = Ctime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctime }\n end\n end", "title": "" }, { "docid": "282bc1944f227bc3d9da8401a66b3c55", "score": "0.6051176", "text": "def index\n @calendars = Calendar.all\n render json: @calendars\n end", "title": "" }, { "docid": "fa425f15d0918d9b4acf38ea59af3c28", "score": "0.6049501", "text": "def index\n # @day = Day.find(params[:day_id])\n @pieces = @day.pieces \n render json: @pieces\n # , include: [:day]\n end", "title": "" }, { "docid": "eb0a2c40f5816b4ed9cdfe5dcc705d1c", "score": "0.6044806", "text": "def show\n @daily_diet = DailyDiet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_diet }\n end\n end", "title": "" }, { "docid": "bef52b30950e829f363bf287766cc4d0", "score": "0.604264", "text": "def show\n @lecture_day = LectureDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_day }\n end\n end", "title": "" }, { "docid": "08a4ca7155290590d9d8db148ae1daf2", "score": "0.6039664", "text": "def show\n @crowd_datum = CrowdDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crowd_datum }\n end\n end", "title": "" }, { "docid": "a7ed93e4256d9ee5f54b55e722a39d61", "score": "0.60292375", "text": "def new\n @cigs_per_day = CigsPerDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cigs_per_day }\n end\n end", "title": "" }, { "docid": "3f532c3c82d603b6f32592ce4c9784f5", "score": "0.6026776", "text": "def index\n json_response(@user.calendars)\n end", "title": "" }, { "docid": "d9a9b1dab7c654d223eec7195ad33e6b", "score": "0.602595", "text": "def show\n @section = @day.sections.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section }\n end\n end", "title": "" }, { "docid": "8202ee3ab11b43ad34fc465d7ff57c95", "score": "0.6017525", "text": "def show\n @trial_day = TrialDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trial_day }\n end\n end", "title": "" }, { "docid": "f6e801de273d8a8a9d5a332af9aba153", "score": "0.60157555", "text": "def index\n if params[:day] and params[:day][:day]\n respond_with Repetition.where(date: Date.parse(params[:day][:day]))\n else\n respond_with Repetition.all\n end\n end", "title": "" }, { "docid": "687cb7b7f3f38811b7ec41d6b2c6d6cf", "score": "0.6013209", "text": "def show\n @callist = Callist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @callist }\n end\n end", "title": "" }, { "docid": "8282828e0ddf081c048107432560100f", "score": "0.5994866", "text": "def show\n @day_management = DayManagement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day_management }\n end\n end", "title": "" }, { "docid": "4610cac51bcb75021bab4b439a526346", "score": "0.5986814", "text": "def show\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar }\n end\n end", "title": "" }, { "docid": "74dfd66739d440d87ebb4cfe9f622695", "score": "0.5978945", "text": "def caverne\n self.class.get('/monstre_caverne.json')\n end", "title": "" }, { "docid": "fe20434b36f5188d9f54af1f898f5436", "score": "0.5966596", "text": "def show\n @dayboard = Dayboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayboard }\n end\n end", "title": "" }, { "docid": "76e4886af1535f6c14e6dd71147c085f", "score": "0.59631073", "text": "def show\n @when_day = WhenDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @when_day }\n format.json { render :json => @when_days }\n format.rule { render :rule => @when_days }\n end\n end", "title": "" }, { "docid": "6ae488c87f7e03ecefc4b3a5b1bd884b", "score": "0.59597325", "text": "def show\n @childern.get_by_day_info\n end", "title": "" }, { "docid": "797287f7880e4087ea30911fdecc0272", "score": "0.59487754", "text": "def show\n @sale_day = SaleDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_day }\n end\n end", "title": "" }, { "docid": "92fdf3852d27ca36b26a4559c3ffd321", "score": "0.5948614", "text": "def show\n @calentry = Calentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calentry }\n format.ics { render 'show.ics.erb'}\n end\n end", "title": "" }, { "docid": "80bcdc259e4411d3ae8b59757b353bf5", "score": "0.59437203", "text": "def show\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_day }\n end\n end", "title": "" }, { "docid": "80bcdc259e4411d3ae8b59757b353bf5", "score": "0.59437203", "text": "def show\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_day }\n end\n end", "title": "" }, { "docid": "fd785afa7bf428915197ff6cd07dba99", "score": "0.5934198", "text": "def show\n @coral = Coral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coral }\n end\n end", "title": "" }, { "docid": "e21b72f39cf02fc2d882363755a4095f", "score": "0.5924514", "text": "def show\n @calendar_entry = CalendarEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_entry }\n end\n end", "title": "" }, { "docid": "147fb4bd620c39144a50d2bc2a04d170", "score": "0.5903174", "text": "def index\n @year = params[:year]\n @month = params[:month]\n @day = params[:day]\n calender = Calender.where(year: @year, month: @month).first\n day = calender.days.where(name: @day)\n @work_days = day.first.work_days\n end", "title": "" }, { "docid": "d69c693066e30aa1e58e11c3eaf5184a", "score": "0.5902231", "text": "def calendar\n #we don't prepare any data, all info is requested by the calendar dynamically \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calendar }\n end\n end", "title": "" }, { "docid": "17cc782f3c64020c625c3181d398e204", "score": "0.5901676", "text": "def show\n @days = 30\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end", "title": "" }, { "docid": "add4480ee6171cdcbc8d6fa0b1f3590e", "score": "0.5894196", "text": "def show\n @contract_date = ContractDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_date }\n end\n end", "title": "" }, { "docid": "c5de22a2b01ced295c0a1101ca5db02b", "score": "0.5890205", "text": "def index\n @trial_days = TrialDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trial_days }\n end\n end", "title": "" }, { "docid": "f23ca27eb69f43814ac7b8b921c72d70", "score": "0.5889564", "text": "def index\n @dioceses = Diocese.all\n\n render json: @dioceses\n end", "title": "" }, { "docid": "d93bd0b626854057d78bbcdf06d60ac4", "score": "0.5883836", "text": "def show\n @current_day_route = CurrentDayRoute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_day_route }\n end\n end", "title": "" }, { "docid": "708fe3711c289e11a4d05e31574fd4ec", "score": "0.5883454", "text": "def show\n @aca_datum = AcaDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aca_datum }\n end\n end", "title": "" }, { "docid": "a213135f274ce6ebaeab0f98c93aa87a", "score": "0.5877455", "text": "def show\n @convenio = Convenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @convenio }\n end\n end", "title": "" }, { "docid": "9f2b1cb71bfa4b3bb29c714eec41bb65", "score": "0.5868796", "text": "def index\n @carbon_dioxides = CarbonDioxide.all\n render json: @carbon_dioxides\n end", "title": "" }, { "docid": "8de47386f17449824c47f4b753238c15", "score": "0.58667624", "text": "def index\n @ods = Od.belongs_to_day(params[:day_id])\n end", "title": "" }, { "docid": "1ffec85451019420fc0276663a727096", "score": "0.58648515", "text": "def show\n @aec_datum = AecDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aec_datum }\n end\n end", "title": "" }, { "docid": "b8cbeeb9a014a87e2a5af794c4fc3294", "score": "0.58646494", "text": "def index\n puts 'about to get all crimes'\n @crimes = Crime.all\n puts 'finished with crimes'\n @crimes.to_json\n end", "title": "" }, { "docid": "2e2aa4e74166cee982eb428384f072e6", "score": "0.586064", "text": "def index\n @days = DiasSemanasEmpresaPerfil.select('dias_semanas_empresa_perfils.dias_semana_id').joins(:empresa_perfil).where(empresa_perfils: {empresa_id: params[:q]})\n list = @days.map {|u| Hash[ id: u.dias_semana_id]}\n render json: list\n end", "title": "" }, { "docid": "9e2f42f0332978593ec177e3be5d4242", "score": "0.585994", "text": "def index\n @days = Day.all\n end", "title": "" }, { "docid": "9e2f42f0332978593ec177e3be5d4242", "score": "0.585994", "text": "def index\n @days = Day.all\n end", "title": "" }, { "docid": "50f58b11441da50e4f6a46264dfe1344", "score": "0.5859856", "text": "def citascentro\n @citascetro = Citas.where(centros_medicos_id: params[:centros_medicos_id]).where(fecha: Date.today)\n render json: @citascetro.as_json(include: [:pacientes ,:centros_medicos, :doctores])\n end", "title": "" }, { "docid": "7244397ebc5e0cccd37dd3ad9cb4bce5", "score": "0.58588755", "text": "def show\n @erdate = Erdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @erdate }\n end\n end", "title": "" }, { "docid": "aa1db9f2e3013e51fe9653e25b37fef7", "score": "0.58457446", "text": "def show\n @day = current_account.days.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @day }\n end\n end", "title": "" }, { "docid": "7337744228985d7f3aed935559eecba3", "score": "0.5844264", "text": "def index\n @graces = @day.graces\n end", "title": "" }, { "docid": "6a4c60f6f064657abb86a706140f6e82", "score": "0.5842066", "text": "def show\n @calendar_date_service = CalendarDateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_date_service }\n end\n end", "title": "" }, { "docid": "815cd350c2eff1b8c5da8c0bdbe13d35", "score": "0.5823273", "text": "def show\n @chainentry = @chain.chainentry.find_by_day(params[:id])\n #@chainentry = Chainentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chainentry }\n end\n end", "title": "" }, { "docid": "4e6cbffd90f5b4aa338fba33c6b530b4", "score": "0.5823123", "text": "def show\n @cadena = Cadena.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadena }\n end\n end", "title": "" }, { "docid": "286c133d90e3577bef6bb7ce8998890f", "score": "0.58208245", "text": "def show\n @event = Calendar.find(params[:id])\n render json: @event\n end", "title": "" }, { "docid": "1a6d140526eb2e9e0928db0fd325a120", "score": "0.5816424", "text": "def show\n @crime = Crime.find(params[:id])\n\n render json: @crime\n end", "title": "" }, { "docid": "69d7ab051119777aafe984b7870342a8", "score": "0.58125293", "text": "def show\n @cidade = Cidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cidade }\n end\n end", "title": "" }, { "docid": "07a022d6569bcc678b057e3fe4d6497f", "score": "0.5810247", "text": "def show\n @ciudade = Ciudade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ciudade }\n end\n end", "title": "" }, { "docid": "05b8c15f87cb214c4fad9623dbbafbc8", "score": "0.58027", "text": "def index\n @dates = DateEntry.browse_dates(params[:neighborhood], params[:cap])\n render json: @dates, status: 200\n end", "title": "" }, { "docid": "02030628e016a16478cac856f9096f8b", "score": "0.5801953", "text": "def new\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "02030628e016a16478cac856f9096f8b", "score": "0.5801953", "text": "def new\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @day }\n end\n end", "title": "" }, { "docid": "c4c6ed895b440355af3fcea9073d2d03", "score": "0.57993716", "text": "def show\n @date = Date.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @date }\n end\n end", "title": "" }, { "docid": "257ec1348d35746c744d06a2bb39d0cf", "score": "0.57986075", "text": "def index\n @calendars = Calendar.select('id as calendar_id,name as calendar_name')\n render json: @calendars\n end", "title": "" }, { "docid": "0bd287189030cd0afb73aadb375b1927", "score": "0.5796704", "text": "def index\n @days = Day.all\nend", "title": "" }, { "docid": "5d4919ee96f9254077573215d22cd661", "score": "0.5793766", "text": "def show\n @possible_date = PossibleDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @possible_date }\n end\n end", "title": "" }, { "docid": "2a5747717a345920f3e8302ef425872e", "score": "0.57904816", "text": "def show\n @child_daily = ChildDaily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child_daily }\n end\n end", "title": "" }, { "docid": "d8b1d442b8b2ff391936b65127ebc3d1", "score": "0.57793796", "text": "def index\n @corals = Coral.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @corals }\n end\n end", "title": "" }, { "docid": "bcbedd24e4a25600f218674430334bed", "score": "0.5777745", "text": "def show\n @day = Day.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @day }\n end\n end", "title": "" }, { "docid": "63f43166113b8f1d6f4600e6513c24e2", "score": "0.57749194", "text": "def index\n @cake_days = CakeDay.all\n end", "title": "" }, { "docid": "ce97c0ec09002da45135ad65feee595d", "score": "0.57705116", "text": "def index\n @residenciais = Residencial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @residenciais }\n end\n end", "title": "" }, { "docid": "d87ce1537b1a1e1c3e26a6b081f55dfb", "score": "0.5769403", "text": "def show\n @day = Day.new params_date\n @days = ([@day] + @day.previous_days).map(&:id).reverse\n @sectors = Sector.where(user: current_user)\n @sectors_ids = @sectors.map(&:id)\n @progress = Fragment.progress_for_days(@days, @sectors_ids)\n @subsectors = Subsector.where(sector: @sectors_ids)\n @subsectors_ids = group_relation_ids_by(@subsectors, :sector_id)\n @activities = Activity.where(subsector_id: @subsectors.map(&:id)).counts_for(@day)\n @activities_ids = group_relation_ids_by(@activities, :subsector_id)\n\n respond_to do |format|\n format.html { render 'show' }\n format.json { render partial: 'day', status: :ok }\n end\n end", "title": "" }, { "docid": "93e221f52a1fb29f9fa66aa41392b614", "score": "0.57636744", "text": "def index\n json_response(@calendar.events)\n end", "title": "" }, { "docid": "11ca6ac268c9f26a31bb581d5a8322e1", "score": "0.5743602", "text": "def index\n day = Time.zone.parse(params[:day]).to_date\n @calendar = @location.hours(day..day).default_for_date(day)\n render 'show'\n end", "title": "" }, { "docid": "dce8653c483399087bc79f49fa38bf32", "score": "0.57432055", "text": "def show\n @caffeine = Caffeine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caffeine }\n end\n end", "title": "" }, { "docid": "d04a03b981e5b60c3cdb296a47018863", "score": "0.5742279", "text": "def show\n @cal_course = CalCourse.find(params[:id])\n @times = @cal_course.timeslots\n @semester = @cal_course.semester\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cal_courses }\n end\n end", "title": "" }, { "docid": "3010bf6b24c3c87bd0f4b195cf6d174a", "score": "0.57393414", "text": "def index\n @events = Event.desc(\"event_day\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "f42520df49ffbd7cba5d1839c68ab9a6", "score": "0.5736564", "text": "def show\n @away_calendar = current_user.away_calendars.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @away_calendar }\n end\n end", "title": "" }, { "docid": "24216f9876f89e7ab349e1f2ebbb0cf8", "score": "0.5736118", "text": "def index\n @tecnicas = Tecnica.all\n render json: @tecnicas\n end", "title": "" }, { "docid": "6016bfd146f63aab61a944736b6742b5", "score": "0.573567", "text": "def show\n @daily_regiman = DailyRegimen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_regiman }\n end\n end", "title": "" }, { "docid": "573795645edc4c1b3c72bd258de205f5", "score": "0.5734243", "text": "def show\n @cago = Cago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cago }\n end\n end", "title": "" }, { "docid": "5b53be9d74d4638dc938a49d3a2994ff", "score": "0.57338107", "text": "def show\n @cysteine = Cysteine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cysteine }\n end\n end", "title": "" }, { "docid": "5a2639f031486140d61a559599fed093", "score": "0.57319695", "text": "def show\n @doctor_schedule = DoctorSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doctor_schedule }\n end\n end", "title": "" }, { "docid": "aa9467d5186760f94a93ae5c942c71cf", "score": "0.57317555", "text": "def index\n @client_cashes = ClientCash.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_cashes }\n end\n end", "title": "" }, { "docid": "737edcda74919292b1ec1c6c85026559", "score": "0.5727926", "text": "def index\n @cie10s = Cie10.all\n\n respond_to do |format|\n format.json { render :json => @cie10s }\n end\n\n end", "title": "" } ]
c2bcac70e158112eebe523071d1b6fd2
all nonmine spaces are visible
[ { "docid": "4a54b606c2d1e12ac919ab184f3be580", "score": "0.6649537", "text": "def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end", "title": "" } ]
[ { "docid": "0070083828e3fa187fc52a2392aa1597", "score": "0.65656203", "text": "def all_occupied_spaces\n occupied_spaces('black') + occupied_spaces('white')\n end", "title": "" }, { "docid": "7d0b2fbebf732c29321c412e05b9de56", "score": "0.64989644", "text": "def check_for_open_board\n active_spaces.values.include?(\" \")\n end", "title": "" }, { "docid": "98e1fa96e26b5839d09ddb10747e343c", "score": "0.64065397", "text": "def hidden_ships_grid\n hidden = Array.new(@grid.size) { [] }\n ([email protected]).each do |i|\n ([email protected]).each do |j|\n chit = self[[i, j]] == :S ? :N : self[[i, j]]\n hidden[i] << chit\n end\n end\n hidden\n end", "title": "" }, { "docid": "fbada9283713c83be8cbf473e2d4fa09", "score": "0.633276", "text": "def available_spaces\n @grid.flatten.select {|value| value.class == Fixnum}\n end", "title": "" }, { "docid": "575681a55357515da3a2a7f9c701f673", "score": "0.6310734", "text": "def available_spaces\n open_spaces = []\n @board.first.each_with_index do |element, index|\n open_spaces << index if element == \"\\u26b3\" \n end\n open_spaces\n end", "title": "" }, { "docid": "68d8bb22afe5002e20ab1c04162bf301", "score": "0.6113219", "text": "def visible\n lines.map { |line| line[ox...(ox + bordered_width)] || '' }\n end", "title": "" }, { "docid": "290ba9595ef95a5ed14654490c12b7a4", "score": "0.6019336", "text": "def hidden_ships_grid\n @grid.map do\n |row|\n row.map do\n |el|\n if el == :S\n :N\n else\n el\n end\n end\n end\n end", "title": "" }, { "docid": "9b8adc6c9eea4288629604f6642b80f4", "score": "0.59949666", "text": "def list_unsafe_spaces(player)\n list_moves(player, false)[1]\n end", "title": "" }, { "docid": "dd2dcca3526740c8e46040c1b8411bd2", "score": "0.59687847", "text": "def hide_all()\n\t#images\n\tfor i in 0..3\n\t\tfor j in 0..4\n\t\t\t@computerimages[i][j].path = \"images/54.png\"\n\t\tend\n\tend\n\t#ranks\n\tfor i in 0..3\n\t\t@computerranks[i].text = \"-----\"\n\tend\t\nend", "title": "" }, { "docid": "2b030b6d8454cf6e91082b1825e91857", "score": "0.5963416", "text": "def occupied_spaces\n spaces = []\n return spaces unless @page\n @page.occupied_spaces.each do |coord|\n spaces << [@x + coord[0], @y + coord[1]]\n end\n return spaces\n end", "title": "" }, { "docid": "9f05cea1ef01c57cdbdb90cd4c398182", "score": "0.5960324", "text": "def visibilities; end", "title": "" }, { "docid": "a1d3a2d36bfddc5991a15327333f3e0a", "score": "0.59379435", "text": "def hidden_ships_grid \n @grid.map do |row|\n row.map do |ele|\n if ele == :S \n :N \n else\n ele\n end\n end\n end\n end", "title": "" }, { "docid": "9724cd427c999478a08c37a00ce68935", "score": "0.5857122", "text": "def visible\n\t\tres = []\n\t\ti = 0\n\t\twhile i < @lines.size\n\t\t\tres << i\n\t\t\ti += @lines[i].folded_lines + 1\n\t\tend\n\t\tres\n\tend", "title": "" }, { "docid": "a7e296660ded32c18ca8c27f8ad1c606", "score": "0.58455503", "text": "def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@spaces[8]}\"\n\tend", "title": "" }, { "docid": "6568329b1348383aeed6872c74c5e3e8", "score": "0.58353037", "text": "def spaces; end", "title": "" }, { "docid": "6568329b1348383aeed6872c74c5e3e8", "score": "0.58353037", "text": "def spaces; end", "title": "" }, { "docid": "aa277617beff8ec2845e5a897a88e1b7", "score": "0.5796059", "text": "def show_board\n\t\[email protected] do |space|\n\t\t\tif !(space.class == String)\n\t\t\t\tif (space.type == 'pawn') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2659\" + \" \"\n\t\t\t\telsif (space.type == 'pawn') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265F\" + \" \"\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2656\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265C\" + \" \"\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2658\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265E\" + \" \"\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2657\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265D\" + \" \"\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2655\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265B\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2654\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265A\" + \" \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tprint space\n\t\t\t\tend\n\t\t\telsif !(space == \"\")\n\t\t\t\tprint space + \" \"\n\t\t\telse\n\t\t\t\tputs space + \" \"\n\t\t\tend\n\t\tend\n\t\tputs \"---------------\"\n\tend", "title": "" }, { "docid": "31fe02ab79acbf84daf17ee3f135a0d4", "score": "0.57906735", "text": "def hidden_ships_grid\n new_grid = []\n\n @grid.each_with_index do |arr, i|\n new_grid[i] = arr.map do |ele|\n if ele == :S\n ele = :N\n else\n ele\n end\n end\n end\n\n new_grid\n end", "title": "" }, { "docid": "afe574492396cfc0142e27341ab995a7", "score": "0.5720834", "text": "def show_all\n pop_position if !visible?\n super\n end", "title": "" }, { "docid": "df233c68c5deb59310678650a6bf1da3", "score": "0.5719707", "text": "def spaces?\n coach_spaces? || student_spaces?\n end", "title": "" }, { "docid": "d9ecfaea6393fa825b2ba8526f07b5b6", "score": "0.5719418", "text": "def index\n @safe_spaces = SafeSpace.all\n end", "title": "" }, { "docid": "893f10cedda445b3c2bb54487190eb83", "score": "0.56962514", "text": "def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end", "title": "" }, { "docid": "2906e9cd41b48c92f0873f90ed5eb001", "score": "0.5685337", "text": "def nasa_space_craft; end", "title": "" }, { "docid": "995c8000908791849510ed30af80da78", "score": "0.56772923", "text": "def endgame_render\n self.grid.flatten.each {|space| space.visible = true }\n render\n end", "title": "" }, { "docid": "586220f7927220d93091bfef87417237", "score": "0.56772625", "text": "def space()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "6af7c8169cecf9ba4bcf33f5ebc9a223", "score": "0.5595093", "text": "def open_spaces\n board.map.with_index { |space, index| index if space_open?(index) }.compact\n end", "title": "" }, { "docid": "5b5dbcf166772135d20760a26599da56", "score": "0.55890775", "text": "def invisible?\n false\n end", "title": "" }, { "docid": "f1fab8a8a6ad83dcfc1b455fe60e38f4", "score": "0.558286", "text": "def cat_game?\n\t\t !(@grid.include?(\" \"))\n\t\tend", "title": "" }, { "docid": "448e0765cd8cfc6724aba34b61d9004d", "score": "0.5582515", "text": "def sunk?\n @spaces.each { |position| return true unless position.occupied }\n end", "title": "" }, { "docid": "d5f1813952993f5479ee85cd3c9ad30d", "score": "0.55745316", "text": "def cat_game?\n \[email protected]_value?(\" \") ? false : true\n end", "title": "" }, { "docid": "d75a67b080cd2616ad4385f1565933e6", "score": "0.5566254", "text": "def visibility; end", "title": "" }, { "docid": "d75a67b080cd2616ad4385f1565933e6", "score": "0.5566254", "text": "def visibility; end", "title": "" }, { "docid": "d75a67b080cd2616ad4385f1565933e6", "score": "0.5566254", "text": "def visibility; end", "title": "" }, { "docid": "d75a67b080cd2616ad4385f1565933e6", "score": "0.5566254", "text": "def visibility; end", "title": "" }, { "docid": "d75a67b080cd2616ad4385f1565933e6", "score": "0.5566254", "text": "def visibility; end", "title": "" }, { "docid": "a0f04abd166a874ebfd9db3d403d9b0c", "score": "0.5548955", "text": "def visible_tiles\n frame_x = (((@width - Config::TileWidth) / Config::TileWidth) ).to_i\n frame_y = (((@height - Config::TileHeight) / Config::TileHeight) ).to_i\n \n \n start_x = player.location.x - (frame_x / 2).to_i\n start_y = player.location.y - (frame_y / 2).to_i\n \n if start_x < 0\n start_x = 0\n end\n if start_y < 0\n start_y = 0\n end\n \n tiles = Array.new\n \n frame_x.times do |i|\n frame_y.times do |j|\n if (start_x + i < game.map.width ) && (start_y + j < game.map.height )\n # puts(\"start_x is #{start_x} and start_y is #{start_y} and i is #{i} and j is #{j}\")\n tiles << game.map.locations[start_x + i, start_y + j]\n end\n end\n end\n \n tiles\n \n end", "title": "" }, { "docid": "7280f8b79c82447f018b5003fb22f991", "score": "0.55258554", "text": "def show_move_ranges(show = true)\n $spriteset.show_ranges(false) if show\n @ranges.each{|r|\n r.visible = show\n }\n end", "title": "" }, { "docid": "373ec3d8f2b4d807887e9c25721902d4", "score": "0.55241996", "text": "def hide_info_windows\n @info_window.smooth_move(Graphics.width, @info_window.y)\n @equip_window.smooth_move(Graphics.width, @equip_window.y)\n @keys_window.smooth_move(0, Graphics.height)\n end", "title": "" }, { "docid": "56d29c99481649ff58a077bf57850023", "score": "0.550871", "text": "def print\n Board.print_grid(hidden_ships_grid)\n end", "title": "" }, { "docid": "6ac77007083723b3874b9ada90a8ba72", "score": "0.5499188", "text": "def print\n Board.print_grid(hidden_ships_grid)\n end", "title": "" }, { "docid": "42e81f246085d47ab57c5cc767165226", "score": "0.5488568", "text": "def hidden_ships_grid\n new_grid = @grid.map do |subarray|\n subarray.map do |ele|\n if ele == :S \n ele = :N \n else\n ele\n end\n end \n end\n new_grid\n end", "title": "" }, { "docid": "2f1f8a176e3b912594641b21b1e1fe62", "score": "0.54806197", "text": "def invisible?\n false\n end", "title": "" }, { "docid": "2f1f8a176e3b912594641b21b1e1fe62", "score": "0.54806197", "text": "def invisible?\n false\n end", "title": "" }, { "docid": "beaad574b2978bf15a23244efee77890", "score": "0.54743314", "text": "def show_board\n puts \" \" + board_spaces[1] + \" | \" + board_spaces[2] + \" | \" + board_spaces[3] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[4] + \" | \" + board_spaces[5] + \" | \" + board_spaces[6] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[7] + \" | \" + board_spaces[8] + \" | \" + board_spaces[9] + \" \"\n end", "title": "" }, { "docid": "e6b4e0f6b255ae6f9228309d3340aab3", "score": "0.54737186", "text": "def highlightSpaceUI()\n\t\t#Not implemented due to ui\n\tend", "title": "" }, { "docid": "326cb9d25423ab9257e806137d3322e9", "score": "0.54698175", "text": "def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(100, 40, 40, 40), $data_actors[1])\n uc.visible = false\n uc.draw()\n }\n return true\n end", "title": "" }, { "docid": "4cf6eaa91a60e95e9893c61207726b21", "score": "0.544957", "text": "def display_secret_board hide_secret\n\t\tdisplay_top_separator\n\t\tdisplay_row(get_blank_row) if hide_secret\n\t\tdisplay_row(@secret_board) unless hide_secret\n\t\tdisplay_bottom_separator\n\tend", "title": "" }, { "docid": "14eca7d3f652914c945b7b603ae37d75", "score": "0.54367846", "text": "def available_general_space\n rows = []\n # loop through to find all available general bin space\n self.houses.each do |house|\n rows << [house.house_number, house.street, house.contact_name, house.general_bin_space]\n end\n # Drawing and styling the table\n table = Terminal::Table.new :rows => rows\n table = Terminal::Table.new :title => 'Available General Bin Space'.magenta, :alignment => :center, \n :headings => ['#'.green, 'Street Name'.green, 'Contact'.green, 'General'.green], :rows => rows\n puts table\n end", "title": "" }, { "docid": "e569e40b449e54c5a66144489446ff21", "score": "0.5426117", "text": "def misplaced_space?\n space && (space_id != space.space_id)\n end", "title": "" }, { "docid": "7f565e60a7d4d85d860ae097db639d79", "score": "0.5417872", "text": "def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 500, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.visible = false\n uc.draw()\n }\n return true\n end", "title": "" }, { "docid": "bbbaf2c7515e508df6718196be264d32", "score": "0.5414637", "text": "def spacing; 0; end", "title": "" }, { "docid": "6545ea2377212a7d7b1403f1e8e68c0d", "score": "0.5393025", "text": "def visibilities=(_arg0); end", "title": "" }, { "docid": "3d137d40eb1ce75ef425d30f137a2674", "score": "0.5382879", "text": "def spaces?\n @cells.map{|cell| cell[4] }.include?(0)\n end", "title": "" }, { "docid": "ee0e2c79db9983fa7540ea5354fcba57", "score": "0.5376057", "text": "def show_console(own_board, enemy_board)\n #This method shows the entire player console, with both Ships\n #(friendly waters), and Balistics (enemy waters)\n print \"\\n\\n\"\n print header_row + standard_gap + header_row + \"\\n\"\n own_grid = own_board.visual_grid(:show_ships)\n enemy_grid = enemy_board.visual_grid(:hide_ships)\n y = 0\n 10.times do\n print (\"A\"..\"J\").to_a[y] #Place letter at front of row string\n print \" \" + own_grid[y] + standard_gap\n print (\"A\"..\"J\").to_a[y]\n print \" \" + enemy_grid[y] + \"\\n\"\n y += 1\n end\n print \"\\n\" + ships_title + standard_gap + balistics_title + \"\\n\"\n print \"\\n\" + board_key + \"\\n\\n\"\n end", "title": "" }, { "docid": "29a28d1621ee7b2ac64649ad5c2d6c37", "score": "0.53722817", "text": "def check_space (potential_x_pos, potential_y_pos, battlefield)\r\n whitespace = [[0,1], [1,0], [0,-1], [-1,0], [1,1], [-1,1], [1,-1], [-1, -1]]\r\n if potential_x_pos > 0 && potential_x_pos < 11 && potential_y_pos > 0 && potential_y_pos < 11 && battlefield[potential_x_pos][potential_y_pos] == 0\r\n for i in 0..7\r\n check_x_position = potential_x_pos + whitespace[i][0];\r\n check_y_position = potential_y_pos + whitespace[i][1];\r\n if check_x_position > 0 && check_x_position < 11 && check_y_position > 0 && check_y_position < 11 && battlefield[check_x_position][check_y_position] == 1\r\n return false\r\n end\r\n end\r\n return true\r\n else\r\n return false\r\n end\r\nend", "title": "" }, { "docid": "e199a1ddcdabe9699f0591e426d156c3", "score": "0.5353158", "text": "def hide_elements\n true\n end", "title": "" }, { "docid": "5f8e3f85a816d5ec6285cc394fda12f7", "score": "0.5337436", "text": "def show_all\n\t\[email protected]_all\n\tend", "title": "" }, { "docid": "f18b9b69b2c28115199ac7a9bd9d3de3", "score": "0.53259695", "text": "def is_spacing?(); @type == GRT_SPACING; end", "title": "" }, { "docid": "290dd3bcb3b4b3a88bfd154fcf03b2ae", "score": "0.53254116", "text": "def available_squares\n self.squares.select{|square| square == ' '}\n end", "title": "" }, { "docid": "2c3c518da6c24bf868abab5bff22652a", "score": "0.5324869", "text": "def visible?\n true\n end", "title": "" }, { "docid": "7c5981546dddeaf494a91875fb163188", "score": "0.53169996", "text": "def interactive_box_visible_embeddables\n section_visible_embeddables(INTERACTIVE_BOX)\n end", "title": "" }, { "docid": "3771f81077e86a84f10827917003bb9d", "score": "0.5316375", "text": "def open_space?(spot)\n !@occupied_spaces.key?(spot)\n end", "title": "" }, { "docid": "4dd250e2d671fd1e6065c78fa07327d1", "score": "0.5301633", "text": "def spaces\n\t\t@secret_word.map { \" _ \" }\n\tend", "title": "" }, { "docid": "224e028a97dcef2c22269c77d8c66d6a", "score": "0.52957565", "text": "def spaces\n workflows = WorkflowSeries.accessible_by(@context).\n eager_load(latest_revision_workflow: [user: :org]).\n where.not(scope: [SCOPE_PUBLIC, SCOPE_PRIVATE]).\n unremoved.includes(:taggings).\n map do |series|\n series_wf = series.latest_accessible(@context)\n if series_wf.in_space? && Workflows::WorkflowFilter.\n match(series_wf, params[:filters])\n series_wf\n end\n end.compact\n\n render_workflows_list workflows\n end", "title": "" }, { "docid": "b17f0b4e127972044ba0e41eeb311eb0", "score": "0.52869666", "text": "def show\n authorize @space, :show?\n end", "title": "" }, { "docid": "a56d2505aba9becc833c035ae6740d7e", "score": "0.5285482", "text": "def remove_invisible min_visibility\n return if [:private, :nodoc].include? min_visibility\n remove_invisible_in @method_list, min_visibility\n remove_invisible_in @attributes, min_visibility\n remove_invisible_in @constants, min_visibility\n end", "title": "" }, { "docid": "09eb2ff13eccd6ad9c8948f8c573f9f6", "score": "0.5272072", "text": "def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end", "title": "" }, { "docid": "2bd5dd3b281a76976126821cb5a0301f", "score": "0.5271113", "text": "def loots(wspace=workspace)\n\t\twspace.loots\n\tend", "title": "" }, { "docid": "dabaa21494cabcf2e213080a3f2942c1", "score": "0.52686435", "text": "def display\n\t\t@drawnmaze = fullmaze\n\t\tremovewalls\n\t\[email protected]_index do |index|\n\t\t\tif index % @width2 == 0 and index !=0\n\t\t\t\t\n\t\t\t\tprint \"\\n\" + @drawnmaze[index]\n\t\t\telse\n\t\t\t\tprint @drawnmaze[index]\n\t\t\tend\n\t\tend\n\t\tputs \"\\n\"\n\tend", "title": "" }, { "docid": "985020536723f59c5d716887b26646cb", "score": "0.52670646", "text": "def empty_spaces\n\t\t\tempty_spaces = []\n\n\t\t\[email protected]_with_index do |outer, row|\n\n\t\t\t\touter.each_with_index do |inner, col|\n\n\t\t\t\t\tif inner == fill_char\n\t\t\t\t\t\n\t\t\t\t\t\tspace = [row, col]\n\n\t\t\t\t\t\tempty_spaces <<\tspace\n\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tempty_spaces\n\t\tend", "title": "" }, { "docid": "6d003dd1dc0afe1d469fc14c2e504f6c", "score": "0.52557397", "text": "def get_locations\n\n spaces_with_players = []\n @spaces.each do |space|\n if !space.is_empty\n spaces_with_players.push(space)\n end\n end\n return spaces_with_players\n end", "title": "" }, { "docid": "c484c2caa3c4dd83e549a03a51613f8a", "score": "0.5254155", "text": "def visible?(sx,sy)\n (sx + @width > 0 && sx < Common::SCREEN_X && sy + @height > 0 &&\n sy < Common::SCREEN_Y)\n end", "title": "" }, { "docid": "6b3fc8fd49734bbfd6c137611f37186f", "score": "0.5232154", "text": "def show_blank(p)\r\n set_cursor p\r\n print Normal\r\n print \" \"*@disks + \"|\" + \" \"*@disks\r\n update\r\n end", "title": "" }, { "docid": "2363fbc513a06c00e9d859e01a533727", "score": "0.5232066", "text": "def print_layout_banned_from_landfill\n return if not_waste_producer_water_discount?\n\n { code: :banned_from_landfill, # section code\n key: :title, # key for the title translation\n key_scope: %i[applications slft banned_from_landfill], # scope for the title translation\n divider: true, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :not_banned_waste, lookup: true }] }\n end", "title": "" }, { "docid": "3264296d0a608992cdee8ced645e3d13", "score": "0.523176", "text": "def collect_visible_windows\n scene = SceneManager.scene\n scene.instance_variables.collect do |varname|\n scene.instance_variable_get(varname)\n end.select do |ivar|\n ivar.is_a?(Window) && !ivar.disposed? && ivar.visible\n end\n end", "title": "" }, { "docid": "08b1b9f8859d20e8c694478b8c2f5e67", "score": "0.5222617", "text": "def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(100, 24, 24, 24), 1)\n uc.visible = false\n uc.draw()\n }\n return true\n end", "title": "" }, { "docid": "0f421bd32d88bc659b3c1cc45cacbd21", "score": "0.5221748", "text": "def hideAllWindow\n @window_heroEquipment.opacity = 0\n @window_heroEquipment.contents_opacity = 0\n \n @window_heroSkills1.opacity = 0\n @window_heroSkills1.contents_opacity = 0\n @window_heroSkills2.opacity = 0\n @window_heroSkills2.contents_opacity = 0\n @window_heroSkills3.opacity = 0\n @window_heroSkills3.contents_opacity = 0\n @window_heroSkills4.opacity = 0\n @window_heroSkills4.contents_opacity = 0\n @window_heroSkills5.opacity = 0\n @window_heroSkills5.contents_opacity = 0\n \n @window_gameVs.opacity = 0\n @window_gameVs.contents_opacity = 0\n \n @window_gameBoard.opacity = 0\n @window_gameBoard.contents_opacity = 0\n \n #@window_gameDescription\n \n @Window_EnemyEquipment.opacity = 0\n @Window_EnemyEquipment.contents_opacity = 0\n \n @window_enemySkills1.opacity = 0\n @window_enemySkills1.contents_opacity = 0\n @window_enemySkills2.opacity = 0\n @window_enemySkills2.contents_opacity = 0\n @window_enemySkills3.opacity = 0\n @window_enemySkills3.contents_opacity = 0\n @window_enemySkills4.opacity = 0\n @window_enemySkills4.contents_opacity = 0\n @window_enemySkills5.opacity = 0\n @window_enemySkills5.contents_opacity = 0\n \n @Window_ItemDescription.opacity = 0 if @Window_ItemDescription != nil \n @Window_ItemDescription.contents_opacity = 0 if @Window_ItemDescription != nil \n @Window_SkillDescription.contents_opacity = 0 if @Window_SkillDescription != nil\n @Window_ItemUse.contents_opacity = 0 if @Window_ItemUse != nil\n end", "title": "" }, { "docid": "258fcb4e9c39616c55909b8dde6461af", "score": "0.52209723", "text": "def all_surrounding_spaces(spot)\n to_check = []\n to_check << spot - 1 if (spot % @columns_size != 0)\n to_check << (spot - @columns_size - 1) if (spot % @columns_size != 0)\n to_check << (spot + @columns_size - 1) if (spot % @columns_size != 0)\n\n to_check << spot + 1 if (spot % @columns_size != 6)\n to_check << (spot - @columns_size + 1) if (spot % @columns_size != 6)\n to_check << (spot + @columns_size + 1) if (spot % @columns_size != 6)\n\n to_check << spot + @columns_size\n to_check << spot - @columns_size\n\n to_check.select{ |numero| numero >= 0 && numero < @upper_bound}\n end", "title": "" }, { "docid": "c1f86f65cca5f994edf9590d64ce52c3", "score": "0.5213072", "text": "def skip_tkspace_without_nl\n tokens = []\n\n while (tk = get_tk) and :on_sp == tk[:kind] do\n tokens.push(tk)\n end\n\n unget_tk(tk)\n tokens\n end", "title": "" }, { "docid": "1b5acf167f8a2066efc23c57350f2e11", "score": "0.5209745", "text": "def kill_cells_in_borders\n (0..@long - 1).each do |long|\n (0..@width - 1).each do |width|\n @matriz[long][width] = ' . ' if long.zero? || (long == @long - 1) || width.zero? || (width == @width - 1)\n end\n end\n end", "title": "" }, { "docid": "481de27bd16f1c5ebd25d598be8bca7e", "score": "0.5208043", "text": "def visible?\n end", "title": "" }, { "docid": "ba52ca31999219f4359abde7f431b226", "score": "0.5193546", "text": "def hide_gridlines(option = 1)\n if option == 0\n @print_gridlines = 1 # 1 = display, 0 = hide\n @screen_gridlines = 1\n elsif option == 1\n @print_gridlines = 0\n @screen_gridlines = 1\n else\n @print_gridlines = 0\n @screen_gridlines = 0\n end\n end", "title": "" }, { "docid": "7be0475afacf4fbc3aa621c66b7c69b5", "score": "0.5179891", "text": "def visible?(sx,sy)\n (sx + @width / 2 > 0 && sx - @width / 2 < Common::SCREEN_X && sy + @height / 2 > 0 &&\n sy - @height / 2 < Common::SCREEN_Y)\n end", "title": "" }, { "docid": "a4a528f3ab2610bc74d6efc55ee74ef0", "score": "0.51777035", "text": "def medical_fellowships\n # blank\n end", "title": "" }, { "docid": "38e5fe5d87ca5e37f0be1169cfdecc80", "score": "0.5175498", "text": "def print_space(location_relative_to_msg)\n odd_height_correction = \n (vertical_blank_space.odd? && location_relative_to_msg == :after ? 1 : 0)\n puts \"\\n\" * ((vertical_blank_space / 2) + odd_height_correction)\n end", "title": "" }, { "docid": "41e12c7dad1c8c072807ae910e118534", "score": "0.5167345", "text": "def show_board(spaces)\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "title": "" }, { "docid": "3e134054edb8f9aebab83c9bcdc9d30a", "score": "0.5165167", "text": "def show_board(spaces)\n\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "title": "" }, { "docid": "3e134054edb8f9aebab83c9bcdc9d30a", "score": "0.5165167", "text": "def show_board(spaces)\n\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend", "title": "" }, { "docid": "63e560d763a26c8c231aec76d1a4d763", "score": "0.5163773", "text": "def index\n @spaces = policy_scope(Space.order('name ASC'))\n end", "title": "" }, { "docid": "00211188b2eb87e934d2ccd27a99801b", "score": "0.516296", "text": "def is_visible?\n visibility && ( visibility > 0 )\n end", "title": "" }, { "docid": "9ab8b1c64554dfc081edb2eb6b190568", "score": "0.5161519", "text": "def initialize\n x = 0\n y = 0\n space_array = []\n 42.times do\n space = instance_variable_set(\"@space#{x}#{y}\", Space.new)\n space_array.push(space)\n self.class.send(:attr_accessor, \"space#{x}#{y}\")\n y += 1\n if y == 6\n y = 0\n x += 1\n end\n end\n @space_array = space_array\n @display = \"------------------------------------\\n| #{space05.occupied} | #{space15.occupied} | #{space25.occupied} |\"\\\n \" #{space35.occupied} | #{space45.occupied} | #{space55.occupied} | #{space65.occupied} |\\n\"\\\n \"------------------------------------\\n| #{space04.occupied} | #{space14.occupied} | #{space24.occupied} |\"\\\n \" #{space34.occupied} | #{space44.occupied} | #{space54.occupied} | #{space64.occupied} |\\n\" \\\n \"------------------------------------\\n| #{space03.occupied} | #{space13.occupied} | #{space23.occupied} |\"\\\n \" #{space33.occupied} | #{space43.occupied} | #{space53.occupied} | #{space63.occupied} |\\n\"\\\n \"------------------------------------\\n| #{space02.occupied} | #{space12.occupied} | #{space22.occupied} |\"\\\n \" #{space32.occupied} | #{space42.occupied} | #{space52.occupied} | #{space62.occupied} |\\n\"\\\n \"------------------------------------\\n| #{space01.occupied} | #{space11.occupied} | #{space21.occupied} |\"\\\n \" #{space31.occupied} | #{space41.occupied} | #{space51.occupied} | #{space61.occupied} |\\n\"\\\n \"------------------------------------\\n| #{space00.occupied} | #{space10.occupied} | #{space20.occupied} |\"\\\n \" #{space30.occupied} | #{space40.occupied} | #{space50.occupied} | #{space60.occupied} |\\n\"\\\n \"------------------------------------\\n 1 2 3 4 5 6 7\" \n end", "title": "" }, { "docid": "0c8e9db2e15d19968b81632e91c66003", "score": "0.5160073", "text": "def island; end", "title": "" }, { "docid": "86312a59bc96f049272ede2fee583349", "score": "0.5154383", "text": "def unique_spaces!\n self.gsub!(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end", "title": "" }, { "docid": "b710e3cb75ada9861c9f8972c9d9dcab", "score": "0.51523477", "text": "def clear_board\n @board_spaces = ((1..9).to_a).product([\" \"]).to_h\n end", "title": "" }, { "docid": "55fdf0a3e715fe02c74d19fbc23f8221", "score": "0.51373106", "text": "def spacing\n return SPACING\n end", "title": "" }, { "docid": "55fdf0a3e715fe02c74d19fbc23f8221", "score": "0.51373106", "text": "def spacing\n return SPACING\n end", "title": "" }, { "docid": "4791519cecd63ed0fa187b9cfb210522", "score": "0.513653", "text": "def display()\r\n #final presenter as a string spaced out\r\n presentWord = \"\"\r\n #iterate the shadow word\r\n @shadowWord.each { |x| \r\n #add a space in the letters\r\n presentWord += x + \" \"\r\n }\r\n #remove the trailing spaces as spec\r\n presentWord.rstrip\r\n end", "title": "" }, { "docid": "5380c30edb53b4b0d843c3ed834d10e4", "score": "0.51341534", "text": "def invisible?\n resolved_rules.members.all? {|seq| seq.invisible?}\n end", "title": "" }, { "docid": "86df56e28b7ed3dd95e5a38848c5b85f", "score": "0.51337767", "text": "def show_tabs\n false\n end", "title": "" }, { "docid": "86df56e28b7ed3dd95e5a38848c5b85f", "score": "0.51337767", "text": "def show_tabs\n false\n end", "title": "" } ]
4aa1145dc56b17c89f12fcd239c0b0c5
Publish the draft NLU Domain Version.
[ { "docid": "56c0dc87650ffb7205ab2855bc8aa3bd", "score": "0.5423839", "text": "def post_languageunderstanding_domain_version_publish_with_http_info(domain_id, domain_version_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.post_languageunderstanding_domain_version_publish ...\"\n end\n \n \n # verify the required parameter 'domain_id' is set\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling LanguageUnderstandingApi.post_languageunderstanding_domain_version_publish\" if domain_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'domain_version_id' is set\n fail ArgumentError, \"Missing the required parameter 'domain_version_id' when calling LanguageUnderstandingApi.post_languageunderstanding_domain_version_publish\" if domain_version_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains/{domainId}/versions/{domainVersionId}/publish\".sub('{format}','json').sub('{' + 'domainId' + '}', domain_id.to_s).sub('{' + 'domainVersionId' + '}', domain_version_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NluDomainVersion')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#post_languageunderstanding_domain_version_publish\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "8b6ee16f3cc9a0aac4e55555e3c3ea0c", "score": "0.59028125", "text": "def publish\n fail_with! 'Already published' if version.published?\n\n version.published_at = Time.zone.now\n version.active = true\n\n ActiveRecord::Base.transaction do\n save_or_die! version\n TosVersion.where.not(id: version.id).update_all(active: false)\n end\n\n reset_tos_acceptance\n end", "title": "" }, { "docid": "479789ccb6836da058a5c35ee3d23143", "score": "0.5902712", "text": "def publish!\n self.published = true\n\n # upgrade if necessary\n if upgrade_needed? || current_version.nil?\n upgrade_version!\n else\n save(:validate => false)\n end\n end", "title": "" }, { "docid": "179e85b800d081330a01cd57c01ce291", "score": "0.58440715", "text": "def publish_latest_version \n publish_version(latest_version)\n end", "title": "" }, { "docid": "1ee59712dc3a6fefa662b2de9046ce9b", "score": "0.57094747", "text": "def publish\n @options['date'] ||= read_draft_date || Time.now.iso8601\n\n post_options = {\n 'title' => read_draft_title,\n 'date' => @options['date'],\n 'slug' => publish_slug,\n 'content' => read_draft_content,\n 'dir' => @options['dir'],\n 'type' => 'post from draft'\n }\n\n # Create a new post file\n #\n Post.new(post_options).write\n \n # Remove the old draft file\n #\n FileUtils.rm @options['path']\n\n end", "title": "" }, { "docid": "6f21f4097a0636cac275fb0cd6f7d6f2", "score": "0.5694741", "text": "def publish\n # Make sure it is not already published\n if published_at\n raise Exception.new(\"Cannot publish User Agreement that is already published\");\n end\n published_datetime = Time.now # It's being published now\n transaction do\n versioned_document = VersionedDocument.get_versioned_document\n previous_agreement = versioned_document.published_version\n \n puts \"published_datetime = #{published_datetime.inspect}\"\n \n # Any existing published version will be superceded\n if previous_agreement\n previous_agreement.superceded_at = published_datetime\n previous_agreement.save\n puts \"Saved previous_agreement\"\n end\n self.published_at = published_datetime\n puts \"Saving self = #{self.inspect}\"\n save\n # Record this user agreement as being the published version\n versioned_document.published_version = self\n # This user agreement is no longer the new version (which it presumably was)\n versioned_document.new_version = nil\n puts \"Saving versioned_document = #{versioned_document.inspect}\"\n versioned_document.save\n puts \"All saved.\"\n end\n end", "title": "" }, { "docid": "d09bf05b3e920fed58150ab655c2699d", "score": "0.567287", "text": "def publish!\n self.published = true\n self.downloads = 0\n \n # upgrade if necessary\n if upgrade_needed? || current_version.nil?\n upgrade_version!\n else\n save(:validate => false)\n end\n end", "title": "" }, { "docid": "a9a6cb8f9503396f6154005f8370b7ba", "score": "0.56474376", "text": "def publish\n end", "title": "" }, { "docid": "a9a6cb8f9503396f6154005f8370b7ba", "score": "0.56474376", "text": "def publish\n end", "title": "" }, { "docid": "a9a6cb8f9503396f6154005f8370b7ba", "score": "0.56474376", "text": "def publish\n end", "title": "" }, { "docid": "36e6daa698889b4e614e1b62a6c21473", "score": "0.5604335", "text": "def to_version_domain\n OpenStruct.new(\n id: consumer_version.id,\n number: consumer_version.number,\n pacticipant: consumer,\n tags: consumer_version.tags,\n order: consumer_version.order,\n branch: consumer_version.branch,\n current_deployed_versions: consumer_version.current_deployed_versions,\n current_supported_released_versions: consumer_version.current_supported_released_versions\n )\n end", "title": "" }, { "docid": "746a662e64c67074c208ec8de297f776", "score": "0.55658484", "text": "def publish\n @options['date'] ||= read_post_yaml('date') || Time.now.iso8601\n @options['title'] = read_post_yaml('title')\n\n post_options = {\n 'title' => @options['title'],\n 'date' => @options['date'],\n 'slug' => path_slug(@options['path']),\n 'extension' => File.extname(@options['path']).sub(/^\\./, ''),\n 'content' => read_post_content,\n 'dir' => @options['dir'],\n 'type' => \"post from draft\",\n 'write_message' => \"Published: #{relative_path(path)} →\",\n 'force' => @options['force']\n }\n\n # Create a new post file\n #\n Post.new(site, post_options).write\n \n # Remove the old draft file\n #\n FileUtils.rm @options['path']\n\n end", "title": "" }, { "docid": "f09915e3b62fd82aa11fa66c51ba28f9", "score": "0.55550086", "text": "def post_languageunderstanding_domain_version_publish(domain_id, domain_version_id, opts = {})\n data, _status_code, _headers = post_languageunderstanding_domain_version_publish_with_http_info(domain_id, domain_version_id, opts)\n return data\n end", "title": "" }, { "docid": "2ccdfe363c162abaf1583929d3b92d48", "score": "0.5490211", "text": "def publish\n if self.draft\n self.published_at = nil\n else\n self.published_at ||= DateTime.now\n end\n end", "title": "" }, { "docid": "0beeed054eccebf96a125e5d4f1cd344", "score": "0.54252064", "text": "def publish!\r\n publish\r\n save!\r\n end", "title": "" }, { "docid": "8f86a0a30fa54b48897345d197a2d100", "score": "0.539351", "text": "def publish_me\n # Unpublish all other versions of the survey\n self.survey.survey_versions.published.update_all(:published => false)\n # Publish this version\n self.published = true\n self.locked = true\n self.save\n end", "title": "" }, { "docid": "48ceb76dad1cb7d75db893815ca62fef", "score": "0.5346819", "text": "def published?; end", "title": "" }, { "docid": "48ceb76dad1cb7d75db893815ca62fef", "score": "0.5346819", "text": "def published?; end", "title": "" }, { "docid": "8fabd8ca443ac6237035571ef9e43b24", "score": "0.53091073", "text": "def publish!(public_on:)\n Page.transaction do\n version = public_version(public_on)\n DeleteElements.new(version.elements).call\n\n repository = page.draft_version.element_repository\n ActiveRecord::Base.no_touching do\n Element.acts_as_list_no_update do\n repository.visible.not_nested.each.with_index(1) do |element, position|\n Alchemy::DuplicateElement.new(element, repository: repository).call(\n page_version_id: version.id,\n position: position\n )\n end\n end\n end\n page.update(published_at: public_on)\n end\n\n Alchemy.publish_targets.each { |p| p.perform_later(page) }\n end", "title": "" }, { "docid": "d50f96960e18885c434d8c219e872098", "score": "0.5277484", "text": "def publish\n set_publish(true)\n end", "title": "" }, { "docid": "2aa275885f73e44e63f353dff443bf44", "score": "0.5249584", "text": "def publish!\n publish\n save\n end", "title": "" }, { "docid": "5307e61d844a21a244f08c009a49d6aa", "score": "0.52333075", "text": "def publish(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n end", "title": "" }, { "docid": "8b7b81d4740560152209268eed1eb841", "score": "0.5222903", "text": "def update\n # Call `draft_publication_dependencies` to check if any other drafted\n # records should be published along with this `@draft`.\n @dependencies = @draft.draft_publication_dependencies\n\n # If you would like to warn the user about dependent drafts that would need\n # to be published along with this one, you would implement an\n # `app/views/drafts/update.html.erb` view template. In that view template,\n # you could list the `@dependencies` and show a button posting back to this\n # action with a name of `commit_publication`. (The button's being clicked\n # indicates to your application that the user accepts that the dependencies\n # should be published along with the `@draft`, thus avoiding orphaned\n # records).\n if @dependencies.empty? || params[:commit_publication]\n @draft.publish!\n flash[:notice] = t('.notice')\n redirect_to @draft.item\n else\n # Renders `app/views/drafts/update.html.erb`\n end\n end", "title": "" }, { "docid": "4a62ba82cd73f0512b8e7f29f0e19798", "score": "0.5217542", "text": "def publish!\n raise 'Not implemented!'\n end", "title": "" }, { "docid": "c56ccd1350703bbc579bdd96cdf83dfd", "score": "0.52123874", "text": "def admin_update_publish\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n\n if @guidance_group.update(published: true)\n flash.now[:notice] = _('Your guidance group has been published and is now available to users.')\n\n else\n flash.now[:alert] = failure_message(@guidance_group, _('publish'))\n end\n redirect_to admin_index_guidance_path\n end", "title": "" }, { "docid": "876f9f521687d6e4834972817d4e02d5", "score": "0.52074546", "text": "def publish\n self.published = true\n end", "title": "" }, { "docid": "ef0d9355f506943cab01ee54f59e6d90", "score": "0.5205193", "text": "def test02_publish_article_draft\n\t\tloginPost\n\t\t$browser.goto($patch_article)\n\t\tsleep 2\n\t\tif $post_pick_group.exists?\n \t\t\tpostGroupPop\n \t\t\t$post_article_title.set(\"Article #{random}\")\n \t\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\telse puts \"PD04T02: FAILED! User unable to save draft.\"\n\t\tend\n\t\t\n\t\tif $post_draft_success.exists?\n\t\t\tcancel_delete\n\t\telse puts \"PD04T01: FAILED! Unable to delete draft.\"\n\t\tend\n\tend", "title": "" }, { "docid": "54aedeab7bb94cdda6bffa43a3a6a032", "score": "0.5204505", "text": "def publish\n set_publish_state(Event::PUBLISHED_STATE)\n end", "title": "" }, { "docid": "00358a2a90bdece5bcbb5dc7288ea534", "score": "0.51871324", "text": "def publish!\n self.published = true\n save\n end", "title": "" }, { "docid": "5aedf66595fb264109fc3814efdc5427", "score": "0.51733613", "text": "def publish\n\t\tchanged = !published?\n\t\tself.status = 'published'\n\t\tchanged\n\tend", "title": "" }, { "docid": "96393507f83687cee76582950b689fa5", "score": "0.5165199", "text": "def publish_directly\n publish!\n end", "title": "" }, { "docid": "82518667cd40ce397c3a64872a9b669a", "score": "0.5156237", "text": "def publish\n ZC.standard_request(:post, @links[:publish], zc_id: @zc_id)\n end", "title": "" }, { "docid": "63f05e7160cf709c020d0c47096c0933", "score": "0.5137494", "text": "def publish!\n @new = true if self.private?\n self.status = statuses.public\n self.save!\n end", "title": "" }, { "docid": "d725babbfc83df7e8bec6296f5bb350b", "score": "0.5117008", "text": "def publish!\n self.published = true\n if self.respond_to?(:publish_on)\n self.publish_on ||= Date.today\n end\n self.save\n end", "title": "" }, { "docid": "e1f3c3a53354af9333de2ab104d103f9", "score": "0.5110383", "text": "def publish!\n self.update_attribute(:published, true)\n end", "title": "" }, { "docid": "8533c25470c8d36734adcdc7600773c2", "score": "0.5097893", "text": "def test_04_publish_event_draft\n\t\tloginPost\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\tif $post_pick_group.exists?\n \t\t\tpostGroupPop\n \t\t\t$post_event_title.set(\"Event #{random}\")\n \t\t\t$post_event_calendar_start_text.set(\"2013-12-12\") \n \t\t\t$post_event_time_start_field.click\n \t\t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t\t$post_event_location.set(\"Location #{random}\")\n \t\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\tsleep 2\n\t\telse puts \"PD04T04: FAILED! User able to save draft.\"\n\t\tend\n\t\t\n\t\tif $post_draft_success.exists?\n\t\t\tcancel_delete\n\t\telse puts \"PD04T01: FAILED! Unable to delete draft.\"\n\t\tend\n\tend", "title": "" }, { "docid": "c53c17dfcc2bfb0ca558266857210b1e", "score": "0.508224", "text": "def publish!\n return true if published?\n publish_status!\n end", "title": "" }, { "docid": "650d04aed6fc359e033d5a3ce74b5833", "score": "0.5077714", "text": "def new_domain(domain)\n d = Domain.new\n d.name = domain\n d.type = \"NATIVE\"\n\n d.save\n return d\n end", "title": "" }, { "docid": "8c2bcd4c611f67ed624059bf5ea29694", "score": "0.5066692", "text": "def publish\n jsfl.publish\n execute\n end", "title": "" }, { "docid": "91b00a46149f5a079f6eb16712ae7c29", "score": "0.50559443", "text": "def write_new_draft()\n filename = get_unique_filename\n full_path = File.join(@post_dir, filename)\n File.open(full_path, 'w') do |f|\n f.puts \"---\"\n f.puts \"title: \\\"#{@title}\\\"\"\n f.puts \"layout: default\"\n f.puts @yaml_cat if @yaml_cat != nil\n f.puts \"date: #{@date}\"\n f.puts \"---\"\n f.puts \"\"\n f.puts \"\\# #{@title}\" # Make the heading and title the same as a default\n f.puts @content if @content != nil\n end \n puts \"Post created under \\\"#{full_path}\\\"\"\n full_path\n end", "title": "" }, { "docid": "8446161bc9fa87fcbee67e0a9eaec707", "score": "0.5047671", "text": "def preprocess_autopublish_drafts\n puts \"Beginning pre-process step for drafts.\"\n drafts.each do |d|\n if d.autopublish?\n puts \"Autopublishing draft: #{d.title} / #{d.slug}\"\n d.publish!\n end\n end\n end", "title": "" }, { "docid": "8d807604e66c74d76d085fa4fb183142", "score": "0.5045844", "text": "def draft\n @version_object = PageVersion.find_draft_for_page(self.page)\n\n unless @page_version\n @version_object = PageVersion.create_draft_for_page(self.page)\n end\n \n @version_object\n end", "title": "" }, { "docid": "f41359b452ff1bb15f07de70c241c370", "score": "0.50356895", "text": "def publish\r\n return if published?\r\n self.publish_at = Time.now\r\n self.unpublish_at = nil\r\n end", "title": "" }, { "docid": "576e9686c1ac34d7199b4d6506dd1df0", "score": "0.5015376", "text": "def test02_post_closed_board_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend", "title": "" }, { "docid": "0e7f0eeaa2025f39b4f7397795acd2a7", "score": "0.49914575", "text": "def perform\n\n r = validate\n return r unless r.success?\n\n r = get_published_draft\n return r unless r.success?\n\n success_with_data(success_response_data)\n\n end", "title": "" }, { "docid": "54525851f90935f7926182a9e4a14190", "score": "0.49875057", "text": "def test_04_publish_event_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\t\n\t\tassert $post_pick_group.exists?\n \t\trepostGroupPop\n \t\t$post_event_title.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.set(\"#{next_year}-12-09\") \n \t\t$post_event_time_start_field.click\n \t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t$post_event_location.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$post_save_draft.fire_event(\"onclick\")\n\t\tsleep 2\n\t\t\n\t\tassert $post_draft_success.exists?\n\t\tif $post_draft_success.exists?\n\t\t\tdelete_draft\n\t\tend\n\tend", "title": "" }, { "docid": "04ed029ff6ae0f04a090c614e853c33c", "score": "0.49830922", "text": "def publish_changes\n return unless resource.valid?\n private_publish resource\n end", "title": "" }, { "docid": "2f0f010723f75901c086a96633ee394a", "score": "0.49806648", "text": "def revert!\n published_pid = PidUtils.to_published(pid)\n draft_pid = PidUtils.to_draft(pid)\n\n if self.class.exists? published_pid\n destroy_draft_version!\n deep_copy_fedora_object from: published_pid, to: draft_pid\n end\n end", "title": "" }, { "docid": "124f768dc3856014525d6053cab24e91", "score": "0.49720865", "text": "def publish\n discovery.publish(repo_id, base_dir)\n end", "title": "" }, { "docid": "c4638e49924cdbb27dd2a929e5a166ae", "score": "0.4966675", "text": "def post_languageunderstanding_domain_versions_with_http_info(domain_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstandingApi.post_languageunderstanding_domain_versions ...\"\n end\n \n \n # verify the required parameter 'domain_id' is set\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling LanguageUnderstandingApi.post_languageunderstanding_domain_versions\" if domain_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling LanguageUnderstandingApi.post_languageunderstanding_domain_versions\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/languageunderstanding/domains/{domainId}/versions\".sub('{format}','json').sub('{' + 'domainId' + '}', domain_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NluDomainVersion')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguageUnderstandingApi#post_languageunderstanding_domain_versions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4b72bd45f84ea2528611d35d4cdbff7d", "score": "0.4956781", "text": "def local_version(body)\n _notice(_version)\nend", "title": "" }, { "docid": "c2f85538667b0d195e1cfe055100594d", "score": "0.4943394", "text": "def build_domain \n unless self.domain\n self.domain = URI.parse(self.url).host \n self.save\n end\n end", "title": "" }, { "docid": "69c72a60b96eaa98d9f54f6ebcc964f4", "score": "0.49400762", "text": "def publish_version(version_in_question)\n version_in_question = version_number_to_version(version_in_question)\n raise \"Invalid version\" if version_in_question.nil?\n transaction do\n copy_attributes(version_in_question, self)\n self.version = version_in_question.version\n callback(:before_save)\n update_without_dirty # because changed_attributes is cleared after new version is created, regular update might skip versioned columns\n callback(:after_save)\n end \n end", "title": "" }, { "docid": "cdb34be8bff4031bb7676d8affe6b264", "score": "0.49395046", "text": "def test_05_publish_event_draft_T5\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\t\n\t\tassert $post_pick_group.exists?\n \t\trepostGroupPop\n \t\t$post_event_title.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.set(\"#{next_year}-06-23\") \n \t\t$post_event_time_start_field.click\n \t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t$post_event_location.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$post_draft.click\n\t\t$post_save_draft.fire_event(\"onclick\")\n\t\tsleep 2\n\t\t\n\t\tassert $post_draft_success.exists?\n\t\tif $post_draft_success.exists?\n\t\t\tclose_delete\n\t\tend\n\tend", "title": "" }, { "docid": "a05903340d93f6614b6c8f96e40ee3b8", "score": "0.49378523", "text": "def create\n @domain = DOMAIN.new(params[:domain])\n @domain.current_user = current_user\n\n respond_to do |format|\n if @domain.save\n flash[:notice] = 'Domain was successfully created.'\n format.html { redirect_to(domain_url(@domain.id)) }\n format.xml { render :xml => @domain, :status => :created, :location => domain_url(@domain.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b0701533f5d2443f4b9d23cd76b7f88", "score": "0.49346676", "text": "def test01_publish_note_draft\n\t\tloginPost\n\t\t$browser.goto($patch_note)\n\t\tsleep 2\n\t\tif $post_pick_group.exists?\n \t\t\t$post_pick_group.fire_event(\"onclick\")\n \t\t\tpostGroupPop\n\t\t\t$post_compose_note.set(\"Note field populated by automated test.\")\n\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\telse puts \"PD04T01: FAILED! Unable to save draft.\"\n\t\tend\n\t\t\n\t\tif $post_draft_success.exists?\n\t\t\tcancel_delete\n\t\telse puts \"PD04T01: FAILED! Unable to delete draft.\"\n\t\tend\n\tend", "title": "" }, { "docid": "1b98a88e892ae2d9f7db59da7747d95e", "score": "0.493348", "text": "def test02_post_closed_news_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend", "title": "" }, { "docid": "15b7cf5a494fcfeec0689106c841e269", "score": "0.49324945", "text": "def test_03_publish_event_draft_TC_24300\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\t\n\t\tassert $post_pick_group.exists?\n \t\trepostGroupPop\n \t\t$post_event_title.when_present.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-04-15\") \n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$post_save_draft.when_present.fire_event(\"onclick\")\n\t\tsleep 2\n\t\t\n\t\tassert $post_draft_success.exists?\n\t\tif $post_draft_success.exists?\n\t\t\tpost_draft\n\t\tend\n\tend", "title": "" }, { "docid": "84e3d00fc3c9a1a6ea8124658429d7b9", "score": "0.4928632", "text": "def post_languageunderstanding_domain_versions(domain_id, body, opts = {})\n data, _status_code, _headers = post_languageunderstanding_domain_versions_with_http_info(domain_id, body, opts)\n return data\n end", "title": "" }, { "docid": "5d0f08d0f00e0eb6d63aa08af922e574", "score": "0.49202958", "text": "def draft?; end", "title": "" }, { "docid": "8c57e1421e9d63423841e1e1d8c2f94f", "score": "0.49018738", "text": "def publish\n respond_to do |format|\n if @post.publish!\n format.html { redirect_to blog_post_no_prefix_path(@blog, @post),\n notice: 'Post was successfully published.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1078110b6c7149a51c50c3d3baa20d32", "score": "0.48933432", "text": "def publish\n # Send the message from the form's input box to the \"messages\"\n # queue, via the nameless exchange. The name of the queue to\n # publish to is specified in the routing key.\n HomeController.nameless_exchange(params[:host]).publish params[:message],\n :content_type => \"text/plain\",\n :key => \"messages\"\n # Notify the user that we published.\n flash[:published] = true\n redirect_to home_index_path\n end", "title": "" }, { "docid": "5c34032f8216d5e74474045ade89ce10", "score": "0.48838568", "text": "def publish\n return true if self.published_at\n\n if self.new_record?\n return false unless self.save\n end\n\n self.published_at = Time.now\n self.save\n end", "title": "" }, { "docid": "baac377b56bae96b5632c82872ed0cc3", "score": "0.4882277", "text": "def publish!\n return false unless published_at.nil?\n\n update_column :published_at, Time.zone.now\n end", "title": "" }, { "docid": "97926fe937a7a7eb1488443c47913d8c", "score": "0.4873904", "text": "def enforce_publishing_validation!\n @enforce_publishing_validation = true\n end", "title": "" }, { "docid": "d64ca9a77c57984ffc8f884b208ec310", "score": "0.48551467", "text": "def test_02_publish_event_draft\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_event)\n\t\tsleep 2\n\t\t\n\t\tassert $post_pick_group.exists?\n \t\trepostGroupPop\n \t\t$post_event_title.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.set(\"#{next_year}-12-14\") \n \t\t$post_event_time_start_field.click\n \t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t$post_event_location.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$post_save_draft.fire_event(\"onclick\")\n\t\tsleep 2\n\n\t\tassert $post_draft_success.exists?\n\t\tif $post_draft_success.exists?\n\t\t\tedit_draft\n\t\tend\n\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend", "title": "" }, { "docid": "52b0aa1132d8cbbf83010d54525fa91b", "score": "0.4850474", "text": "def generate_version?\n return self.published\n end", "title": "" }, { "docid": "1d596800de4a6b0a3bc1c4aa6d10519c", "score": "0.4833878", "text": "def publish\n Poll.published.each do |poll|\n poll.archive unless poll.id == self.id\n end\n node.make_visible\n end", "title": "" }, { "docid": "c87497906d8f342d860dbc9ed7b0ddbc", "score": "0.4830421", "text": "def publisher_domain=(value)\n @publisher_domain = value\n end", "title": "" }, { "docid": "3affbbc2508b439d95ace921fdc56f1f", "score": "0.4817174", "text": "def publish!(entry)\n # no-op (for now)\n end", "title": "" }, { "docid": "8aa32650f454d342742600eadef0be35", "score": "0.48090297", "text": "def publish\n load_resource\n resource_instance_variable.public = true\n resource_instance_variable.save\n flash[:notice] = t(\"page_published\", :name => resource_instance_variable.name)\n redirect_back_or_to_default(resources_path)\n end", "title": "" }, { "docid": "896baaafae7547b34f6d90fa263251ba", "score": "0.48055318", "text": "def publish!(timestamp = Time.now)\n ts = timestamp.respond_to?(:xmlschema) ? timestamp.xmlschema : timestamp.to_s\n\n if has_published?\n published.text = ts\n else\n add_child Published.new { |u| u.text = ts }\n end\n\n self\n end", "title": "" }, { "docid": "e09317883a7c7cff30f397c376df9cd2", "score": "0.4805262", "text": "def publish\n @topics = current_organization.topics\n @topics.each do |topic|\n topic.publish!\n end\n record_activity(\"update\", \"actualizó su programa de apertura.\")\n redirect_to new_inventory_path, :notice => \"Muy bien, tu programa de apertura está listo. De cualquier forma siempre puedes regresar a editarlo.<br/>El siguiente paso es subir un inventario de datos.\"\n end", "title": "" }, { "docid": "110b50b7dd4766167ed48fc975d27bb0", "score": "0.48049557", "text": "def test05_DraftEmptyGN\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_article)\n\t\t\tsleep 2\n\t\t\tif $post_now.exists?\n\t\t\t\tsleep 4\n\t\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\telse puts \"PDEVT05: FAILED! Unable to locate draft button.\"\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\tassert $post_draft_error.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PDEVT05: FAILED! User able to save incomplete draft.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9fd8bf5e6f492b077df37c58a9e4962c", "score": "0.4795927", "text": "def publish_version!(params)\n metadata = params.metadata\n\n #if metadata.privacy &&\n # ENV['ENFORCE_PRIVACY'].present? &&\n # ENV['ENFORCE_PRIVACY'] == 'true'\n # errors.add(:base, I18n.t('api.error_messages.privacy_violation'))\n # raise ActiveRecord::RecordInvalid.new(self)\n #end\n\n tarball = params.tarball\n readme = params.readme\n changelog = params.changelog\n\n dependency_names = metadata.dependencies.keys\n existing_extensions = Extension.with_name(dependency_names)\n\n extension_version = nil\n\n transaction do\n extension_version = extension_versions.build(\n extension: self,\n description: metadata.description,\n license: metadata.license,\n version: metadata.version,\n tarball: tarball,\n readme: readme.contents,\n readme_extension: readme.extension,\n changelog: changelog.contents,\n changelog_extension: changelog.extension\n )\n\n\n self.updated_at = Time.now\n\n [:source_url, :issues_url].each do |url|\n url_val = metadata.send(url)\n\n if url_val.present?\n write_attribute(url, url_val)\n end\n end\n\n #self.privacy = metadata.privacy\n save!\n\n metadata.platforms.each do |name, version_constraint|\n extension_version.add_supported_platform(name, version_constraint)\n end\n\n metadata.dependencies.each do |name, version_constraint|\n extension_version.extension_dependencies.create!(\n name: name,\n version_constraint: version_constraint,\n extension: existing_extensions.find { |c| c.name == name }\n )\n end\n end\n\n extension_version\n end", "title": "" }, { "docid": "abb7a81180abc90c036ea958762297d0", "score": "0.4791752", "text": "def publish!\n inform \"Publishing local version to http://chapmanu.github.io/web-components\"\n \n # Production Configuration\n inform \"Building site with production configuration\"\n Jekyll::Site.new(Jekyll.configuration({\n \"source\" => \".\",\n \"destination\" => \"_site\"\n })).process\n\n Dir.mktmpdir do |tmp|\n FileUtils.cp_r \"_site/.\", tmp\n \n pwd = Dir.pwd\n Dir.chdir tmp\n\n cmd \"git init\"\n cmd \"git add .\"\n message = \"Site updated at #{Time.now.utc}\"\n cmd \"git commit -m #{message.inspect}\"\n cmd \"git remote add origin [email protected]:#{GITHUB_REPONAME}.git\"\n cmd \"git push origin master:refs/heads/gh-pages --force\"\n\n Dir.chdir pwd\n end\n inform \"Publish successful\"\n end", "title": "" }, { "docid": "66946797f184601f158b8020fd49e380", "score": "0.47885996", "text": "def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create_additional_records\n puts '########## RENDERING DATA TO CLIENT##########'\n show_domain\n end", "title": "" }, { "docid": "a6d5e5e0b2b782fe8505862fa1158b27", "score": "0.47841007", "text": "def test02_pre_closed_board_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_boards_pre_closed_article_new)\n\t\t\n \t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend", "title": "" }, { "docid": "3bee108263e0ae5f0accee59e0ad832e", "score": "0.4783357", "text": "def unpublished; end", "title": "" }, { "docid": "1f15939835cca1cdd56e4a6ddf81ea88", "score": "0.47816247", "text": "def publish\n update!(email_status: \"verified\", published_at: Time.now.utc)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.47709727", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.47709727", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.47709727", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.47709727", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "340b0c72d08ce100b8646b8ce6a4097d", "score": "0.47703767", "text": "def build_version(yaml_root, version)\n # yaml_dump = File.join(yaml_root, version.commit.gsub(\"/\", \"-\"))\n # return if File.exist? yaml_dump\n\n version.build\n version.clean\n #File.open(yaml_dump, \"w\") { |f| f.write(Psych.dump(version)) }\n #exit\nend", "title": "" }, { "docid": "88f227928a4152cece014c5a067ebd83", "score": "0.4766371", "text": "def create\n authorize! :create, BudgetDomain\n service = BudgetDomainCreator.call(create_params)\n @budget_domain = service.budget_domain\n if service.status == :ok\n redirect_to @budget_domain, notice: 'Budget domain was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "e8ef0a7878ac9cdcf066fc2b12a32a82", "score": "0.47530124", "text": "def publish(_ = nil)\n publish_answers\n\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n self.awarder = User.stamper || User.system\n self.awarded_at = Time.zone.now\n if persisted? && !assessment.autograded? && submission_graded_email_enabled?\n execute_after_commit { Course::Mailer.submission_graded_email(self).deliver_later }\n end\n end", "title": "" }, { "docid": "436408ebaeb68ac25989300a82cc236d", "score": "0.47521397", "text": "def publish\n\t\[email protected]!\n\t\tredirect_to @article\n\tend", "title": "" }, { "docid": "999cfbe51278dc6e8622ee4f7a857c74", "score": "0.4751466", "text": "def published!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "b39195345e464d3acd5981cf97d03e35", "score": "0.47454008", "text": "def publish\n status_id = STATUSES.index('published')\n set_published_at\n end", "title": "" }, { "docid": "2856bd29db1105eb5e23b287abddd1a2", "score": "0.473317", "text": "def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end", "title": "" }, { "docid": "81e42b9e0dd8e18a3338bacc53ff0a1f", "score": "0.4733085", "text": "def drafts; end", "title": "" }, { "docid": "6fe05305dcd52934581aae645091b822", "score": "0.4719973", "text": "def publish_description # :norobots:\n pass_query_params\n if draft = find_description(params[:id].to_s)\n parent = draft.parent\n old = parent.description\n type = parent.type_tag\n old_partial = old.unique_partial_format_name if old\n draft_partial = draft.unique_partial_format_name\n\n # Must be admin on the draft in order for this to work. (Must be able\n # to delete the draft after publishing it.)\n if !draft.is_admin?(@user)\n flash_error(:runtime_edit_description_denied.t)\n redirect_to(:action => parent.show_action, :id => parent.id,\n :params => query_params)\n\n # Can't merge it into itself!\n elsif old == draft\n flash_error(:runtime_description_already_default.t)\n redirect_to(:action => draft.show_action, :id => draft.id,\n :params => query_params)\n\n # I've temporarily decided to always just turn it into a public desc.\n # User can then merge by hand if public desc already exists.\n else\n draft.source_type = :public\n draft.source_name = ''\n draft.project = nil\n draft.admin_groups.clear\n draft.admin_groups << UserGroup.reviewers\n draft.writer_groups.clear\n draft.writer_groups << UserGroup.all_users\n draft.reader_groups.clear\n draft.reader_groups << UserGroup.all_users\n draft.save\n parent.log(:log_published_description, :user => @user.login,\n :name => draft.unique_partial_format_name, :touch => true)\n parent.description = draft\n parent.save\n Transaction.send(\"put_#{type}_description\",\n :id => draft,\n :set_source_type => draft.source_type,\n :set_source_name => draft.source_name,\n :set_project => draft.project,\n :set_admins => draft.admin_groups,\n :set_writers => draft.writer_groups,\n :set_readers => draft.reader_groups\n )\n redirect_to(:action => parent.show_action, :id => parent.id,\n :params => query_params)\n end\n end\n end", "title": "" }, { "docid": "bc3c75d71206f09a97bedaead989090c", "score": "0.4716496", "text": "def publish(revision, content=nil, &block)\n Spontaneous::Publishing::Revision.patch(self, revision, content, &block)\n end", "title": "" }, { "docid": "ea01424216638da57a97b3f9b47ada1e", "score": "0.4713451", "text": "def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end", "title": "" }, { "docid": "8e9bbdbdd0e2fd1910ea4894456c5a5a", "score": "0.47129896", "text": "def publish\n # fetching page via before filter\n @page.publish!\n flash[:notice] = _t(:page_published, :name => @page.name)\n redirect_back_or_to_default(admin_pages_path)\n end", "title": "" }, { "docid": "c4e4cdb43678c2f4388ad9f8267af30b", "score": "0.47044966", "text": "def publish\n # fetching page via before filter\n @page.save\n flash[:notice] = _(\"page_published\") % {:name => @page.name}\n redirect_back_or_to_default(admin_pages_path)\n end", "title": "" }, { "docid": "24d6180fa1bbceac8c19744fa163090d", "score": "0.46912155", "text": "def republish(content_id, options = {})\n optional_keys = %i[locale previous_version]\n\n params = merge_optional_keys({}, options, optional_keys)\n\n post_json(republish_url(content_id), params)\n end", "title": "" }, { "docid": "174dc7a0eebb68879adb04331b09d1cf", "score": "0.46850845", "text": "def release!\n version = Origen.app.version\n body = { version: version.to_s }\n if version.production?\n body[:type] = :production\n else\n body[:type] = :development\n end\n post(\"plugins/#{Origen.app.name}/release\", body: body)\n end", "title": "" }, { "docid": "6bd716cf6f1aa6100eef05084565d9a1", "score": "0.4684183", "text": "def send_version_message\n message = Message.create(\n :version,\n @node.host, @node.port, @node.services,\n \"0.0.0.0\", Client::LISTEN_ON_PORT, Client::SERVICES_PROVIDED, # The :src_ip will be ignored by our peer.\n @client.nonce\n )\n send_data message\n end", "title": "" }, { "docid": "dc2d4f8e0da56f590f17d02f89a655a1", "score": "0.4678907", "text": "def test04_pre_open_blog_publish_article_draft_TC_24309\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_blogs_pre_open_article_new)\n\t\t\n\t\tcreate_article_draft \"Article for Draft #{random}\"\n\t\tdelete_draft\n\tend", "title": "" } ]
d9a06e1f555bbf19950d9ae22a53fe76
GET /targeted_muscles GET /targeted_muscles.json
[ { "docid": "3e81a44d1da49e4d70fb9af8cf87307a", "score": "0.7734318", "text": "def index\n @targeted_muscles = TargetedMuscle.all\n end", "title": "" } ]
[ { "docid": "4f9c89504742eb7d4e85c43aee7c2f4b", "score": "0.7441265", "text": "def set_targeted_muscle\n @targeted_muscle = TargetedMuscle.find(params[:id])\n end", "title": "" }, { "docid": "25617ccfd623d685a6d96f36793fef59", "score": "0.726036", "text": "def set_target_muscle\n @target_muscle = TargetMuscle.find(params[:id])\n end", "title": "" }, { "docid": "95d2517e28b6090e9f1f06d82b297b25", "score": "0.6713304", "text": "def create\n @targeted_muscle = TargetedMuscle.new(targeted_muscle_params)\n\n respond_to do |format|\n if @targeted_muscle.save\n format.html { redirect_to @targeted_muscle, notice: 'Targeted muscle was successfully created.' }\n format.json { render :show, status: :created, location: @targeted_muscle }\n else\n format.html { render :new }\n format.json { render json: @targeted_muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8ff362ae5c191d8a92adec7f07bba42", "score": "0.64664185", "text": "def targeted_muscle_params\n params.require(:targeted_muscle).permit(:exercise_id, :muscle_id, :primary)\n end", "title": "" }, { "docid": "0b4cd37e90bc356331b6af875e555fb1", "score": "0.646264", "text": "def destroy\n @targeted_muscle.destroy\n respond_to do |format|\n format.html { redirect_to targeted_muscles_url, notice: 'Targeted muscle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f1998c53a755f509b2e49d20d5845ddc", "score": "0.6273607", "text": "def target_muscle_params\n params.require(:target_muscle).permit(:name, :image, :description, :muscle_group_id)\n end", "title": "" }, { "docid": "e4fd14d4e7161f1ddcd3f0dbd1f0169b", "score": "0.62411964", "text": "def update\n respond_to do |format|\n if @targeted_muscle.update(targeted_muscle_params)\n format.html { redirect_to @targeted_muscle, notice: 'Targeted muscle was successfully updated.' }\n format.json { render :show, status: :ok, location: @targeted_muscle }\n else\n format.html { render :edit }\n format.json { render json: @targeted_muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c107700c0fd4d8f4c5bacac936ea07d", "score": "0.6238271", "text": "def destroy\n @target_muscle = TargetMuscle.find(params[:id])\n @target_muscle.destroy\n\n respond_to do |format|\n format.html { redirect_to(target_muscles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "df07f075b1009a68a9f5da92de6944ee", "score": "0.61715806", "text": "def show\n @target_muscle = TargetMuscle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @target_muscle }\n end\n end", "title": "" }, { "docid": "9dc7c2912035a5ae97225d3dea1f352f", "score": "0.60000765", "text": "def create\n @target_muscle = TargetMuscle.new(params[:target_muscle])\n\n respond_to do |format|\n if @target_muscle.save\n flash[:notice] = 'TargetMuscle and Exercises where successfully created.'\n format.html { redirect_to(@target_muscle) }\n format.xml { render :xml => @target_muscle, :status => :created, :location => @target_muscle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @target_muscle.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff820023dbe36b17540bf479aa163c33", "score": "0.5882686", "text": "def index\n @muscles = Muscle.all\n end", "title": "" }, { "docid": "35c35b2ce1f746626a405f72e49c244a", "score": "0.58823913", "text": "def set_muscle\n @muscle = Muscle.find(params[:id])\n end", "title": "" }, { "docid": "134a714bc2bdbfc5c104459eab14407b", "score": "0.582817", "text": "def show\n @muscle = Muscle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @muscle }\n end\n end", "title": "" }, { "docid": "8fa6e651113512b4421a260fccb4559b", "score": "0.569655", "text": "def target_objects\n @target_objects = Array(@attrs['target_objects']).map do |list|\n Twitter::List.new(list)\n end\n end", "title": "" }, { "docid": "cd2ec12dbf4d5b4600cb5950d8df2b51", "score": "0.5664571", "text": "def target_objects\n @target_objects = Array(@attrs[:target_objects]).map do |list|\n Twitter::List.new(list)\n end\n end", "title": "" }, { "docid": "9fce0ec3aeffe96de6176709c3c9d8bd", "score": "0.5566238", "text": "def index\n @targets = Target.all.includes(:measure).page(params[:page]).per(20)\n end", "title": "" }, { "docid": "d78c4ec9ea383f7a4bc5323c7ef8bc5a", "score": "0.55518043", "text": "def show\n @target = Target.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target }\n end\n end", "title": "" }, { "docid": "b62fa626ce57fc2de01a6ab491133281", "score": "0.54740274", "text": "def set_meddling_target\n @meddling_target = MeddlingTarget.find(params[:id])\n end", "title": "" }, { "docid": "57662dba3329f5e22886541fa6812db3", "score": "0.5449357", "text": "def target_get_all()\n\t\t\tbegin\n\t\t\t\tstatus, status_text, resp = omp_request_xml(\"<get_targets/>\")\n\n\t\t\t\tlist = Array.new\n\t\t\t\tresp.elements.each('//get_targets_response/target') do |target|\n\t\t\t\t\ttd = Hash.new\n\t\t\t\t\ttd[\"id\"] = target.attributes[\"id\"]\n\t\t\t\t\ttd[\"name\"] = target.elements[\"name\"].text\n\t\t\t\t\ttd[\"comment\"] = target.elements[\"comment\"].text\n\t\t\t\t\ttd[\"hosts\"] = target.elements[\"hosts\"].text\n\t\t\t\t\ttd[\"max_hosts\"] = target.elements[\"max_hosts\"].text\n\t\t\t\t\ttd[\"in_use\"] = target.elements[\"in_use\"].text\n\t\t\t\t\tlist.push td\n\t\t\t\tend\n\t\t\t\t@targets = list\n\t\t\t\treturn list\n\t\t\trescue \n\t\t\t\traise OMPResponseError\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "dc3319b3f54ed70610e05a7d68111fa4", "score": "0.5449275", "text": "def target\n self.result[0][\"target\"]\n end", "title": "" }, { "docid": "72b7ededee51194749df35145a456bf0", "score": "0.5446781", "text": "def index\n @muscle_masses = MuscleMass.all\n end", "title": "" }, { "docid": "3df607739c7e0b046c7c1e59e9056317", "score": "0.5445912", "text": "def get_target_list()\n list = @targets_list\n return list\n end", "title": "" }, { "docid": "13ae9486ab0673b038a54137da1be4fc", "score": "0.54203844", "text": "def new\n @target_muscle = TargetMuscle.new\n @target_muscle.exercises.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @target_muscle }\n end\n end", "title": "" }, { "docid": "c2bf8531bc313c0208c9ed042147dbcb", "score": "0.54108393", "text": "def target_objects\n @target_objects = Array(@attrs[:target_objects]).map do |tweet|\n Twitter::Tweet.new(tweet)\n end\n end", "title": "" }, { "docid": "6fb8ba2c53c134b95824a37fd75cdcfc", "score": "0.5410272", "text": "def destroy\n @muscle = Muscle.find(params[:id])\n @muscle.destroy\n\n respond_to do |format|\n format.html { redirect_to muscles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "435210144378ed30451781b8ac5fa722", "score": "0.5403571", "text": "def index\r\n @muscle_diaries = MuscleDiary.all\r\n end", "title": "" }, { "docid": "d48d7130a7180edd3df673240872cfdd", "score": "0.5394279", "text": "def show\n @search = Measure.where('measure_targets && ARRAY[?]::varchar[]', @measure_target.id).search(params[:q])\n @target_measures = @search.result.paginate(page: params[:page], per_page: 100)\n end", "title": "" }, { "docid": "a58674570c185180980672b3fe9328ff", "score": "0.5388198", "text": "def index\n @move_muscles = MoveMuscle.all\n end", "title": "" }, { "docid": "12affb45658dd5ef203da290de947dea", "score": "0.5358886", "text": "def index\n @musics = current_api_user.musics.select(:title,:id)\n render json: @musics\n end", "title": "" }, { "docid": "cc44b41ec0f1a11c78a8655a392d92c2", "score": "0.5351681", "text": "def create\n @muscle = Muscle.new(params[:muscle])\n\n respond_to do |format|\n if @muscle.save\n format.html { redirect_to @muscle, notice: 'Muscle was successfully created.' }\n format.json { render json: @muscle, status: :created, location: @muscle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3ae6ec6565f564aa945c8717c9c9a7a", "score": "0.5340429", "text": "def create\n @muscle = Muscle.new(muscle_params)\n\n respond_to do |format|\n if @muscle.save\n format.html { redirect_to @muscle, notice: 'Muscle was successfully created.' }\n format.json { render :show, status: :created, location: @muscle }\n else\n format.html { render :new }\n format.json { render json: @muscle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "026810527c8016b90ee8aad6712fcb0d", "score": "0.53241825", "text": "def set_muscle_diary\r\n @muscle_diary = MuscleDiary.find(params[:id])\r\n end", "title": "" }, { "docid": "0ac6d5fc7cf611965892a2db77f694c4", "score": "0.5314044", "text": "def index\n @moulds = Mould.all\n end", "title": "" }, { "docid": "9c457d40d434f6fffa032e0d488b6a76", "score": "0.53023905", "text": "def show\n @target = Target.find_by!(name: params[:id])\n @lexical_index_request = @target.lexical_index_request\n @connection_index_request = @target.connection_index_request\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target }\n end\n end", "title": "" }, { "docid": "6794f68623201ad57a0a9d59e485b7e0", "score": "0.5271288", "text": "def new\n @muscle = Muscle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @muscle }\n end\n end", "title": "" }, { "docid": "0aac825b122a6b12d6b826834ea26829", "score": "0.52642614", "text": "def index # GET /targets -> targets_path\n @targets = Target.paginate(page: params[:page])\n end", "title": "" }, { "docid": "d4b8e4fc87536b4dcabcce985b3042a5", "score": "0.5241992", "text": "def targets(actor)\n valid = {}\n @valid_targets.each do |target_type, values|\n target_objects = []\n if(target_type == :possession)\n if(values.include?('all'))\n target_objects = actor.character_possessions\n else\n actor.character_possessions.each do |character_possession|\n if(values.include?(character_possession.possession_id))\n target_objects << character_possession\n end\n end\n end\n elsif(target_type == :knowledge)\n if(values.include?('all'))\n # Only pull from knowledges ACTUALLY known.\n target_objects = actor.knowledges\n else\n actor.knowledges.each do |character_knowledge|\n if(values.include?(character_knowledge.knowledge_id))\n target_objects << character_knowledge\n end\n end\n end\n elsif(target_type == :idea)\n if(values.include?('all'))\n # Only pull from knowledges considered but not yet known.\n target_objects = actor.ideas\n else\n actor.ideas.each do |character_knowledge|\n if(values.include?(character_knowledge.knowledge_id))\n target_objects << character_knowledge\n end\n end\n end\n elsif(target_type == :character)\n if(values.include?('all'))\n target_objects = actor.world.characters\n end\n elsif(target_type == :condition)\n if(values.include?('all'))\n target_objects = actor.character_conditions\n else\n actor.character_conditions.each do |character_condition|\n if(values.include?(character_condition.condition_id))\n target_objects << character_condition\n end\n end\n end\n elsif(target_type == :body)\n if(values.include?('all'))\n target_objects = actor.character_body_parts\n end\n else\n raise \"Invalid target type '#{target_type.inspect}' for Action: valid targets\"\n end\n valid[target_type]=target_objects\n end\n return valid\n end", "title": "" }, { "docid": "3a4cf34c075238544537b991a83c7143", "score": "0.5234433", "text": "def reveal\n render :json => @game.target_id\n end", "title": "" }, { "docid": "f8f7c40ba4acec24296a774a2b4e23e2", "score": "0.5223347", "text": "def targets\n @targets\n end", "title": "" }, { "docid": "ac75c68a2b52a9087205f951f423374b", "score": "0.5222428", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |tweet|\n Twitter::Tweet.new(tweet)\n end\n end", "title": "" }, { "docid": "3c52d069ba165448378c1b579f81172b", "score": "0.5220897", "text": "def set_target\n @target = Target.find(params[:id])\n end", "title": "" }, { "docid": "256d4fd337504097c74d2b7cf7284570", "score": "0.5208595", "text": "def targets \n Array(redis.smembers(:targets))\n end", "title": "" }, { "docid": "a938ca7a37c57cdd32255a91370081bc", "score": "0.52009463", "text": "def set_move_muscle\n @move_muscle = MoveMuscle.find(params[:id])\n end", "title": "" }, { "docid": "c32a76309141c6566d8bd2834c6fe8df", "score": "0.5200291", "text": "def index\n @targets = Target.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @targets }\n end\n end", "title": "" }, { "docid": "f2ee9d53d4beb314a8e48149a358daf8", "score": "0.5194606", "text": "def show\n @target = Target.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target }\n end\n end", "title": "" }, { "docid": "1ae2b99819542fd577edc97251987783", "score": "0.517806", "text": "def get_target_by_uuid (uuid)\n\t\tinner_proxy = InnerProxy.new\n\t\turl = inner_proxy.conceptwiki_ep_get + \"?uuid=#{uuid}\"\n\n\t\tresponse = LibUtil.request(url, [])\n\t\tif response.code.to_i != 200\n\t\t\tputs \"ConceptWiki get service not working properly right now!\"\n\t\t\tnil\n\n\t\telse\n\t\t\tjson_hash = JSON.parse(response.body)\n\t\t\tresult = Hash.new\n\t\t\tresult[:uuid] = json_hash['uuid']\n\n\t\t\tlabels = json_hash['labels']\n\t\t\tpref_label = labels.select { |lb| lb['type'] == 'PREFERRED' }\n\t\t\tresult[:pref_label] = pref_label[0]['text']\n\n\t\t\turls = json_hash['urls']\n\t\t\tuniprot_url = urls.select { |url| url['value'] =~ /uniprot/ } rescue []\n\t\t\tresult[:uniprot_url] = uniprot_url[0]['value'] rescue ''\n\n\t\t\tresult\n\t\tend\n\tend", "title": "" }, { "docid": "6ff08150c2deea5a7253930884bdf75b", "score": "0.5176926", "text": "def targets\n Array(redis.smembers(:targets))\n end", "title": "" }, { "docid": "abfd5adb140ecac1b1db33c6e2fdce64", "score": "0.51738864", "text": "def new\n @target = current_user.targets.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @target }\n end\n end", "title": "" }, { "docid": "1e9b37b9c9fadc4ee74d44bed3b7b06a", "score": "0.5158884", "text": "def fetch_targets\n @targets.uniq\n end", "title": "" }, { "docid": "02d101f7b730303ae8bffa7e74caa876", "score": "0.5148075", "text": "def target( **query )\r\n if query.key?(:argument)\r\n argument = query[:argument]\r\n if argument\r\n arg_q = argument.to_query\r\n query.merge!({\r\n :offset => arg_q.offset || query[:offset],\r\n :quantity => arg_q.quantity || query[:quantity],\r\n :keywords => arg_q.keywords\r\n })\r\n else # nil keywords!\r\n return []\r\n end\r\n end\r\n targets = []\r\n if query.key?(:list)\r\n targets = query[:list].reject(&:nil?) # got a crash here once but don't know why - maybe a bad list passed in?\r\n if query.key?(:type)\r\n types = [query[:type]].flatten\r\n targets.reject! do |target| \r\n !types.any? { |type| target.is_a?(type) }\r\n end\r\n end\r\n elsif query.key?(:type)\r\n query[:type] = [query[:type]].flatten\r\n targets += @areas.values if query[:type].to_a.include? Area\r\n targets += @continents.values if query[:type].to_a.include? Continent\r\n targets += @players if query[:type].to_a.include? Player\r\n targets += @items.to_a if query[:type].to_a.include? Item\r\n targets += @mobiles.to_a if query[:type].to_a.include? Mobile\r\n\r\n else\r\n targets = @areas.values + @players + @items.to_a + @mobiles.to_a\r\n end\r\n\r\n targets = targets.select { |t| query[:affect].to_a.any?{ |affect| t.affected?( affect.to_s ) } } if query.key?(:affect)\r\n targets -= query[:not].to_a if query.key?(:not)\r\n targets = targets.select { |t| query[:attacking].to_a.include? t.attacking } if query.key?(:attacking)\r\n targets = targets.select { |t| t.fuzzy_match( query[:keywords] ) } if query.key?(:keywords)\r\n targets = targets.select { |t| query[:visible_to].can_see? t } if query.key?(:visible_to) && !query[:visible_to].nil?\r\n targets = targets.select { |t| query[:where_to].can_where? t } if query.key?(:where_to)\r\n targets = targets[0...query[:limit].to_i] if query.key?(:limit)\r\n\r\n query[:offset] == \"all\" || query[:offset].nil? ? offset = 0 : offset = [0, query[:offset].to_i - 1].max\r\n query[:offset] == \"all\" || query[:quantity] == \"all\" || query[:quantity].nil? ? quantity = targets.length : quantity = [1, query[:quantity].to_i].max\r\n\r\n targets = targets[ offset...offset+quantity ].to_a\r\n\r\n return targets\r\n end", "title": "" }, { "docid": "a5ffd0c77f28ed36c51b8bbeb0f7bd99", "score": "0.51464206", "text": "def target_get_all (p={})\n\t\t\tbegin\n\t\t\t\txr=target_get_raw(p)\n\t\t\t\tlist=Array.new\n\t\t\t\txr.elements.each('//get_targets_response/target') do |target|\n\t\t\t\t\ttd=Hash.new\n\t\t\t\t\ttd[\"id\"]=target.attributes[\"id\"]\n\t\t\t\t\ttd[\"name\"]=target.elements[\"name\"].text\n\t\t\t\t\ttd[\"comment\"]=target.elements[\"comment\"].text\n\t\t\t\t\ttd[\"hosts\"]=target.elements[\"hosts\"].text\n\t\t\t\t\ttd[\"max_hosts\"]=target.elements[\"max_hosts\"].text\n\t\t\t\t\ttd[\"in_use\"]=target.elements[\"in_use\"].text\n\t\t\t\t\tlist.push td\n\t\t\t\tend\n\t\t\t\treturn list\n\t\t\trescue \n\t\t\t\traise OMPResponseError\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "d54e753f3ee42226a5fa99d0dd69a930", "score": "0.5133403", "text": "def target\n @target\n end", "title": "" }, { "docid": "7fce23fdc8fdf8bfd01a0ed00be3ed90", "score": "0.5130481", "text": "def set_target\n @target = Target.find(params[:id])\n end", "title": "" }, { "docid": "7fce23fdc8fdf8bfd01a0ed00be3ed90", "score": "0.5130481", "text": "def set_target\n @target = Target.find(params[:id])\n end", "title": "" }, { "docid": "7fce23fdc8fdf8bfd01a0ed00be3ed90", "score": "0.5130481", "text": "def set_target\n @target = Target.find(params[:id])\n end", "title": "" }, { "docid": "dba9ec6cb0c47f674a6f41420c442e5c", "score": "0.5127228", "text": "def target\n meta[:target]\n end", "title": "" }, { "docid": "f84bfd407df4db0deec704869e7cb5de", "score": "0.5124643", "text": "def tbltargets\n @targets = Target.where(delete_at: [nil]).order(:goal_id)\n if params[:goal] != \"\"\n @targets = @targets.where(goal_id: params[:goal])\n end\n\n render :partial => 'tbltarget'\n end", "title": "" }, { "docid": "ebcbda4e28e68bc169cecaea586e8531", "score": "0.51168895", "text": "def meddling_target_params\n params.require(:meddling_target).permit(:result_no, :generate_no, :e_no, :card_id, :chain, :target_id, :count)\n end", "title": "" }, { "docid": "8e1d09797842ab297361b37b7b835352", "score": "0.5112258", "text": "def set_target\n @target = Target.where(id: params[:id]).first\n end", "title": "" }, { "docid": "5266169892748c15ce3af541e2a757a3", "score": "0.51101387", "text": "def find_musing\n @musing = Musing.find(params[:id])\n end", "title": "" }, { "docid": "9740f4acb89c588244eaabbc1cf7417c", "score": "0.5106918", "text": "def index\n @q = params[:q] || params[:qs]\n @qs = params[:qs]\n q_search = params[:q].present? ? \"%#{params[:q]}\" : params[:qs]\n total_entries = Target.count if q_search.blank?\n @targets = Target.order(order_string).includes(:species, :validations, :antibodies => :source).search(q_search, :page => params[:page], :per_page => 20, :total_entries => total_entries)\n\n respond_to do |format|\n if params[:id].present?\n @target = Target.find(params[:id])\n format.html { redirect_to(@target) }\n else\n format.html # index.html.erb\n format.xml { render :xml => @targets }\n end\n end\n end", "title": "" }, { "docid": "3eaff3011f10e8efd73fbca31e0ba010", "score": "0.51038915", "text": "def set_target\n @target = Target.find(params[:id])\n end", "title": "" }, { "docid": "29c0f8878d987560411e62cae399d49a", "score": "0.5097815", "text": "def retrieve_target(target_id)\n date_timestamp = Time.now.httpdate\n target_id_url = TARGETS_URL + '/' + target_id\n target_id_suburl = '/targets' + '/' + target_id\n signature = self.build_signature(target_id_suburl, nil, 'GET', date_timestamp)\n raise ArgumentError.new('Signature returned nil. Aborting...') if signature == nil\n authorization_header = \"VWS \" + @accesskey + \":\" + signature\n begin\n RestClient.get(target_id_url, :'Date' => date_timestamp,\n :'Authorization' => authorization_header)\n rescue => e\n e.response\n end\n end", "title": "" }, { "docid": "b6b7acd970d77b20efe89d4bc74a1e66", "score": "0.50969136", "text": "def destroy\n @target = @user.targets.find(params[:id])\n @target.destroy\n\n respond_to do |format|\n format.html { redirect_to targets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "260f73e5010e06da0e590d4bfac3adb7", "score": "0.5081379", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |status|\n Twitter::Status.fetch_or_new(status)\n end\n end", "title": "" }, { "docid": "cfcb1c66a1b113006a408a342c90c860", "score": "0.5078019", "text": "def target\n puts \"\"\n puts \"For a list of missions by target, enter target:\"\n puts \"Examples: 'Earth,' 'Mars', 'Universe', 'moon' etc.\"\n puts \"\"\n process_input(\"find_by_target\")\n end", "title": "" }, { "docid": "2e72854402af1528c79ce0d1edfa2cbe", "score": "0.5077526", "text": "def targets\n @targets = Array(@attrs['targets']).map do |status|\n Twitter::Status.new(status)\n end\n end", "title": "" }, { "docid": "f8166fca9ea09ade4760bcb2831bcc08", "score": "0.50746214", "text": "def mutual_match_user_ids\n likes = Like.where(user_id: current_user.id).where(target_id: mutual_matches).map(&:target_id)\n end", "title": "" }, { "docid": "b6b287dc54adadc43eeae12483a32c0e", "score": "0.50736785", "text": "def set_muscle_mass\n @muscle_mass = MuscleMass.find(params[:id])\n end", "title": "" }, { "docid": "937b472e167dcfc76e9ae601661ffa35", "score": "0.5063874", "text": "def destroy\n @muscle_mass.destroy\n respond_to do |format|\n format.html { redirect_to muscle_masses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a601ee8d152f361b3ccdade163b16aa2", "score": "0.50628835", "text": "def target\n get_or_make_reference(@data['target_type'], @data, 'target_id')\n end", "title": "" }, { "docid": "bf53be026e23b8f8432d185571e1867a", "score": "0.5060958", "text": "def targets\n @targets = Array(@attrs['targets']).map do |user|\n Twitter::User.new(user)\n end\n end", "title": "" }, { "docid": "39e419cda82b536933c6a926d2d6618d", "score": "0.50533384", "text": "def target *targets\n target = acquire *targets\n follow target\n end", "title": "" }, { "docid": "d5fbdffed147e05535ec3da01a914c75", "score": "0.50486594", "text": "def destroy\n @target = Target.find(params[:id])\n @target.destroy\n\n respond_to do |format|\n format.html { redirect_to targets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0edb90dba930bbd171265197f96140c1", "score": "0.50461096", "text": "def get_target_keywords(target_id = nil, campaign_id = nil)\n exec_get(\"#{@base_path}/api/v2/customers/target_keywords.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "ca4c60bb982e36d4f82ebfe37bc0eb30", "score": "0.5041424", "text": "def target_ids\n target.send(target_attribute) || Set.new\n end", "title": "" }, { "docid": "b01eb5275568fd507d73e9e595da3a6d", "score": "0.5040964", "text": "def kids_musical\n fetch('show.kids_musical')\n end", "title": "" }, { "docid": "6325a53f4c14fea112e00269f417f3df", "score": "0.50322026", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |user|\n Twitter::User.new(user)\n end\n end", "title": "" }, { "docid": "6325a53f4c14fea112e00269f417f3df", "score": "0.50322026", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |user|\n Twitter::User.new(user)\n end\n end", "title": "" }, { "docid": "6325a53f4c14fea112e00269f417f3df", "score": "0.50322026", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |user|\n Twitter::User.new(user)\n end\n end", "title": "" }, { "docid": "6325a53f4c14fea112e00269f417f3df", "score": "0.50322026", "text": "def targets\n @targets = Array(@attrs[:targets]).map do |user|\n Twitter::User.new(user)\n end\n end", "title": "" }, { "docid": "4168699a47a6d70c244292709ed6fe36", "score": "0.5028259", "text": "def targets\n target_series.collect do |s|\n data[s][target_idx]\n end\n end", "title": "" }, { "docid": "827b79962f678ee429ffbebf65299cf5", "score": "0.5026883", "text": "def get_mutant(m_id)\n\n get_request = API_URL + \"mutants/#{m_id}\"\n @response = RestClient.get(get_request){|response, request, result| response }\n\n @parsed_response = JSON.parse(@response)\n @parsed_response[\"status\"] ? @parsed_response.merge(\"code\" => @parsed_response[\"status\"]) : parse_mutant(@parsed_response)\n return\nend", "title": "" }, { "docid": "e7c363ee4d81d9ad6427505cfd29f24e", "score": "0.50247127", "text": "def index\n @targets = @user.targets.all\n @numTargets = @targets.length\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @targets }\n end\n end", "title": "" }, { "docid": "a80ea9cd1d34ad7e64cef6c6c000a095", "score": "0.50166523", "text": "def index\n @metrics_targets = MetricsTarget.all\n File.open('metrics_targets.json', 'w') { |file| file.write(@metrics_targets.to_json) }\n end", "title": "" }, { "docid": "efbc88920bb905542a6b032eac470be5", "score": "0.5012988", "text": "def index\n @ref_meds = RefMed.all\n end", "title": "" }, { "docid": "e88abd01a237aa2fde54f70e38839249", "score": "0.5011845", "text": "def index\n @target_pages = TargetPage.all\n end", "title": "" }, { "docid": "d99b8af83f060c36d359ea23b4dee782", "score": "0.5011612", "text": "def targeted(opts = {})\n validate_loaded\n params = {}.merge!(opts)\n TargetedTailoredAudience.load(account, id, params)\n end", "title": "" }, { "docid": "4d0025373d39494a8e5940e221ba04a8", "score": "0.50023794", "text": "def create\n @target = @borrower.targets.new(target_params)\n flash[:notice] = 'Target was successfully created.' if @target.save \n respond_with(@borrower, @target, :location => borrower_targets_url(@borrower))\n end", "title": "" }, { "docid": "64a98d87eda9c4f6e3dbf9416c2deec7", "score": "0.49991226", "text": "def index\n respond_to do |format|\n format.html do\n query = params[:query]\n @user = User.find_by_twid(query) if query.present?\n redirect_to @user if @user\n end\n format.json do\n @users = User.all\n nodes = @users.map{|u| {:name => u.twid, :value => u.tweeted.count}}\n links = []\n @users.each do |user|\n links += user.knows.map {|other| { :source => nodes.find_index{|n| n[:name] == user.twid}, :target => nodes.find_index{|n| n[:name] == other.twid}}}\n end\n render :json => {:nodes => nodes, :links => links}\n end\n end\n end", "title": "" }, { "docid": "27bb0840b4923411231735ed39edb9ed", "score": "0.4992104", "text": "def retrive_ml_tubes\n show do\n title \"Wait and then retrieve all aliquoted 1.5 mL tubes\"\n \n timer initial: { hours: 0, minutes: 10, seconds: 0}\n \n check \"Retrive all aliquoted 1.5 mL tubes from the styrofoam box at M80.\"\n note \"Put back into M80C boxes according to the next release pages.\"\n end\n end", "title": "" }, { "docid": "48825727ff20ad6e3320e8f8d851d7f6", "score": "0.4991572", "text": "def action_nucleotides\n @reader.genome.nucleotide_facts\n end", "title": "" }, { "docid": "89035148a50df86c398b5a9d5fc968b4", "score": "0.498925", "text": "def target\n @target\n end", "title": "" }, { "docid": "ff69ee5002c3393aa09bc3a60812b977", "score": "0.49831304", "text": "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to targets_url, notice: t(:target_deleted) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea2dc86c118ffbdfa4facbb14b75b585", "score": "0.49819046", "text": "def myTargets\n return [] if targetID.nil?\n #raise targetID.inspect\n myTargets = Target.where(\"configuration LIKE ?\", \"%OSVIP%=%#{targetID[:target]}%\" ).map{|i| i}\n #raise myTargets.inspect\n end", "title": "" }, { "docid": "91a8e29a5b9aecd45f884d5b790efaf7", "score": "0.49744305", "text": "def create\n @target = Target.new(target_params.merge(user_id: current_user.id))\n \n respond_to do |format|\n if @target.save\n format.html { redirect_to @target, notice: 'Target was successfully created.' }\n format.json { render :show, status: :created, location: @target }\n else\n format.html { render :new }\n format.json { render json: @target.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff4399e1f13d3af3976cb2decc3976b8", "score": "0.49718577", "text": "def target\n @target\n end", "title": "" }, { "docid": "ff4399e1f13d3af3976cb2decc3976b8", "score": "0.49718577", "text": "def target\n @target\n end", "title": "" }, { "docid": "ff4399e1f13d3af3976cb2decc3976b8", "score": "0.49718577", "text": "def target\n @target\n end", "title": "" }, { "docid": "ff4399e1f13d3af3976cb2decc3976b8", "score": "0.49718577", "text": "def target\n @target\n end", "title": "" } ]
4065a0b7017cf300342f265c4c13dd40
Returns the column they drop the token into
[ { "docid": "0208ad12a87ddc71460ac9b9830be37a", "score": "0.0", "text": "def get_move_column\r\n move = (0..6).to_a.sample\r\n move\r\n end", "title": "" } ]
[ { "docid": "aefca7f7175dd9ef966af2f9c2a48518", "score": "0.73496026", "text": "def token_drop column_index, token\n column = get_column(column_index)\n\n column.each do |cell|\n if cell.value == \" \"\n @board[cell.coordinate].set_value(token)\n return @board[cell.coordinate]\n end\n end\n end", "title": "" }, { "docid": "ed74cda584d54175d87795686d3f2a56", "score": "0.6799679", "text": "def current_column; end", "title": "" }, { "docid": "aa4d1135a6ff524bf325ce798a171f0c", "score": "0.6616443", "text": "def col\n pos[1]\n end", "title": "" }, { "docid": "add1e9e1d4e45d0b6f7668dda76c1a95", "score": "0.6571299", "text": "def getColumn()\n return @column\n end", "title": "" }, { "docid": "952a4ce943cccd56d1856e94b4e71374", "score": "0.65393835", "text": "def last_column\n @expression.last_column\n end", "title": "" }, { "docid": "7de200b8379ae6dd85f6bac076129771", "score": "0.64637524", "text": "def col\n @col-1\n end", "title": "" }, { "docid": "44773e8af9bc8e84cfa3f71be7042716", "score": "0.64579713", "text": "def drop_token_in(column)\n # Get start and end indexes for the column in the board array\n start_index = column_start_index(column)\n end_index = start_index + rows - 1 # range operator is inclusive of the end_index\n\n (start_index..end_index).each do |index|\n # skip until we find the first empty spot\n next unless board[index].nil?\n\n # insert token into spot for current player\n board[index] = current_player\n\n # no sense in going further. Return index\n return index\n end\n\n # If there are no empty spots, the move is invalid\n raise Game::ColumnFull\n end", "title": "" }, { "docid": "18d9729b30220f5c7046b87677711420", "score": "0.64048433", "text": "def column\n \"\"\n end", "title": "" }, { "docid": "96d44b8cf8fbef313975cb10ad606a66", "score": "0.6397829", "text": "def last_in_column(column_index)\n token_row_coordinate = nil\n @board.each_with_index do |row, index|\n if !row[column_index].occupied?\n token_row_coordinate = index\n end\n end\n token_row_coordinate\n # since column index is given, returns only the row index of\n # where the token 'drops' for the column\n end", "title": "" }, { "docid": "639a13f7168c389aca52299f5fd9b238", "score": "0.6340419", "text": "def column_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 185 )\n return_value = ColumnNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n column_name_start_index = @input.index\n\n root_0 = nil\n sql_identifier1027 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 989:4: sql_identifier\n @state.following.push( TOKENS_FOLLOWING_sql_identifier_IN_column_name_6203 )\n sql_identifier1027 = sql_identifier\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_identifier1027.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\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__, 185 )\n memoize( __method__, column_name_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "e89f1d4c1493b27e141dfd91320a88ce", "score": "0.6336032", "text": "def column(n)\n columns[n]&.rtrim!\n end", "title": "" }, { "docid": "8061442790f82feda41ea0a6be418cc1", "score": "0.63083214", "text": "def measure_column\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 122 )\n return_value = MeasureColumnReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n measure_column_start_index = @input.index\n\n root_0 = nil\n column_name782 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 716:4: column_name\n @state.following.push( TOKENS_FOLLOWING_column_name_IN_measure_column_4587 )\n column_name782 = column_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, column_name782.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\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__, 122 )\n memoize( __method__, measure_column_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "fac2efaeac9ffe2c42e0a3d37782f926", "score": "0.6281997", "text": "def last_column; end", "title": "" }, { "docid": "fac2efaeac9ffe2c42e0a3d37782f926", "score": "0.6281997", "text": "def last_column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "30d9ee12dd0fe393a2b7b5e51e1cad89", "score": "0.6258471", "text": "def column; end", "title": "" }, { "docid": "d3a6c5222dfdae99d49cd9b5f4370c63", "score": "0.62455195", "text": "def current_col\n @table.current_col\n end", "title": "" }, { "docid": "655c6cf88b6d4212af87abf14c6aefed", "score": "0.6232058", "text": "def column\n @expression.column\n end", "title": "" }, { "docid": "d905b0f3041c1295a168c5f76aa2e8bf", "score": "0.62159705", "text": "def get_column(column_index); end", "title": "" }, { "docid": "7fcb8fa24da79750e06d1ab712e91276", "score": "0.61571217", "text": "def column_name\n return @column_name\n end", "title": "" }, { "docid": "70fbd776dc1569ef4602fd7f5ac360e6", "score": "0.61321914", "text": "def current_column\n line = line_counts[lineno - 1]\n line[column].to_i - line.start\n end", "title": "" }, { "docid": "f7c87b23143e7f6fae76c5d05edcc234", "score": "0.610569", "text": "def remove_column(name); end", "title": "" }, { "docid": "928621e7d3f02e335e0c78948a4966ec", "score": "0.60908115", "text": "def counter_drop_position(column)\n case ' |'\n when @board[5][column]\n @board[5]\n when @board[4][column]\n @board[4]\n when @board[3][column]\n @board[3]\n when @board[2][column]\n @board[2]\n when @board[1][column]\n @board[1]\n when @board[0][column]\n @board[0]\n end\n end", "title": "" }, { "docid": "7360e0c78e36df6a2f0cf9f379f6fe21", "score": "0.6072536", "text": "def last_column\n Thread.current[:arel_visitors_to_sql_last_column]\n end", "title": "" }, { "docid": "ff3c3b43ac6743f7fe58ffc58970d9c9", "score": "0.60536885", "text": "def column(index)\n end", "title": "" }, { "docid": "a74149a16683c6be67ce92de5b815855", "score": "0.6051831", "text": "def column\n @__column__\n end", "title": "" }, { "docid": "ef956d4a170b96514251f13e55e22741", "score": "0.6029315", "text": "def column(x); end", "title": "" }, { "docid": "7363f8a53c1bb4f922e68430b89cf6a5", "score": "0.60110253", "text": "def find_column name; name &&= name.to_s.sub(/\\?$/, ''); columns.find { |c| name == c.name }; end", "title": "" }, { "docid": "5bef5a973e17a724d37bfcb52bc5d74c", "score": "0.6005736", "text": "def cursor_column\n line, col = @window.cursor\n col\n end", "title": "" }, { "docid": "788e5d0c2f66787b2be4b3e96cd7e77d", "score": "0.59924185", "text": "def column_number\n env(:column_number).to_i - 1\n end", "title": "" }, { "docid": "788e5d0c2f66787b2be4b3e96cd7e77d", "score": "0.59924185", "text": "def column_number\n env(:column_number).to_i - 1\n end", "title": "" }, { "docid": "788e5d0c2f66787b2be4b3e96cd7e77d", "score": "0.59924185", "text": "def column_number\n env(:column_number).to_i - 1\n end", "title": "" }, { "docid": "7f4e7a463f25069b50d722181135035e", "score": "0.5986927", "text": "def columns\n @content[0]\n end", "title": "" }, { "docid": "f3b156f72ff521278abed95384fd6732", "score": "0.5970633", "text": "def column_index\n return @column_index\n end", "title": "" }, { "docid": "2aa072c95a261eac0dc0e2e163f72804", "score": "0.5961797", "text": "def column_for_position(position); end", "title": "" }, { "docid": "a6b11e368e0b5e8ddae833f5e4bc1c31", "score": "0.5952657", "text": "def column()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "1c86335cb31eb06f085cd8bb4536ad58", "score": "0.59473157", "text": "def column(n)\n first_line.split(\"\\t\")[n-1]\n end", "title": "" }, { "docid": "c3345cb8dbfcf73ca9ce530e24eae83b", "score": "0.5940997", "text": "def get_column column\n cell_list = []\n @board.each do |(coordinate, cell)|\n if coordinate[1] == column\n cell_list.append(cell)\n end\n end\n cell_list.reverse!\n end", "title": "" }, { "docid": "36256e8d70279339929edec8513c3fbf", "score": "0.5940173", "text": "def column\n lbreak = @data.rindex(?\\n, gap_start-1)\n lbreak.nil? ? gap_start : (gap_start-(lbreak+1))\n end", "title": "" }, { "docid": "d560cb56b95185b251ffae245d7b4c81", "score": "0.59248954", "text": "def right_col_name\n acts_as_hausdorff_space_options[:right_column]\n end", "title": "" }, { "docid": "eaef94d7731f35bb6f1883b743cf3843", "score": "0.5921217", "text": "def column_delta; end", "title": "" }, { "docid": "3ddafc4d8583c80800f6c58d24e108d2", "score": "0.59171593", "text": "def get_column_name(part, splitter = \" \")\n part.downcase.split(splitter)[0].strip\n end", "title": "" }, { "docid": "1681076196c86bd3b9614d9f5835ad61", "score": "0.59082067", "text": "def get_column_value(column)\n column = column.to_s.sub(/@/, '')\n unless column.index('_').nil?\n column = column.split('_')[1]\n end\n column\n end", "title": "" }, { "docid": "7d00d6026ae3b8d72c3a69b8962a1f05", "score": "0.5904634", "text": "def column_name(column)\r\n end", "title": "" }, { "docid": "1ea1c1a88f2474f59b278d326031d60e", "score": "0.5899724", "text": "def last_column(str)\n column_of(str, str.length)\n end", "title": "" }, { "docid": "81f1d669863fc0207c71f7676d9684b1", "score": "0.5887904", "text": "def get_column(board, column)\n\treturn board.transpose[column]\nend", "title": "" }, { "docid": "2aeca32a1e38d512c7653231eee275f6", "score": "0.5884035", "text": "def column()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "c7704f6de90fcd26cc886dd040997e4e", "score": "0.58828217", "text": "def column_break\n self.store(CommandNode.new(self, '\\column', nil, false))\n nil\n end", "title": "" }, { "docid": "d6262576f9440e46009268aaf9677ee0", "score": "0.5869843", "text": "def get_column_data( matrix )\n return matrix.drop(1)\nend", "title": "" }, { "docid": "eb295a621dfa86a18f730e3ecabba2dc", "score": "0.5864148", "text": "def get_column(column,board)\n board.collect {|num| num[column]}.inspect\nend", "title": "" }, { "docid": "b87b2dd9a9931b56d19a457c758b1b14", "score": "0.58627594", "text": "def effective_column(range)\n if range.line == 1 &&\n @processed_source.raw_source.codepoints.first == BYTE_ORDER_MARK\n range.column - 1\n else\n range.column\n end\n end", "title": "" }, { "docid": "9d42a75577e353ef3397bf86d2966c23", "score": "0.58594453", "text": "def get_column\n gets.chomp.to_i\n end", "title": "" }, { "docid": "3d8da7a179f2c876a93787363180860c", "score": "0.5854567", "text": "def character\n @column\n end", "title": "" }, { "docid": "0e6aad38de3d749e71fc9d99c286c97a", "score": "0.5854565", "text": "def column_name\n name\n end", "title": "" }, { "docid": "0e6aad38de3d749e71fc9d99c286c97a", "score": "0.5854565", "text": "def column_name\n name\n end", "title": "" }, { "docid": "23fa1226d336a422841ddc2e623868b7", "score": "0.58542556", "text": "def column column = nil\n @column = column.to_sym if column\n @column\n end", "title": "" }, { "docid": "cf6ad2b7b87b453da571eeba3b988b95", "score": "0.58465415", "text": "def delta_column\n (destination.column - origin.column)\n end", "title": "" }, { "docid": "baa976ab9dca05084faf61f6294b2a3d", "score": "0.58454424", "text": "def drop\n Statements::DropColumn.new(context: self)\n end", "title": "" }, { "docid": "c9d5c3f084e2882cb5d77e1b8dc93197", "score": "0.5843663", "text": "def column_index identifier\n @columns.each_with_index {|c, i| return i if c.identifier == identifier }\n return nil\n end", "title": "" }, { "docid": "2c7587094a61268e216ea1df43bbdecc", "score": "0.583325", "text": "def get_col(col)\n\t\[email protected][col]\n\tend", "title": "" }, { "docid": "c369e384faa75be984a3193fd441372d", "score": "0.58292633", "text": "def get_col(col)\n\ttranspose_board = $boggle_board.transpose\n\treturn transpose_board[col]\nend", "title": "" }, { "docid": "1ef4c974056e4048e5d78b4e9112cc51", "score": "0.582737", "text": "def columnIndexOfName(columnName)\n end", "title": "" }, { "docid": "1bb8c57fa6c999aa31072f2ce51f0a8c", "score": "0.5826142", "text": "def col col\n\t\treturn @cols[col]\n\tend", "title": "" }, { "docid": "b0244e21e9bba932bb9add87b4903c9b", "score": "0.5824373", "text": "def getColumn(indexOrName)\n\tend", "title": "" }, { "docid": "c7c577a9add0e3ab3198df464b6ba2cb", "score": "0.5822851", "text": "def start_column; end", "title": "" }, { "docid": "6d347bb40f9b1f595d8ba03fe278b6de", "score": "0.5795003", "text": "def column_number()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "73fe63d772d6454fcf31ab4055c15ad5", "score": "0.5790317", "text": "def left_col_name\n acts_as_hausdorff_space_options[:left_column]\n end", "title": "" }, { "docid": "78b783f800dbd44cf16dd2713dfa8d71", "score": "0.57891554", "text": "def get_move_column\n \n end", "title": "" }, { "docid": "d6d74fcd214a9a47e923bd89c5cdc852", "score": "0.57877165", "text": "def column(pos = T.unsafe(nil)); end", "title": "" }, { "docid": "ee9ebd9c10ff97d73b18b4eafb0f7990", "score": "0.5784741", "text": "def clear_token(column)\n self[column] = nil\n\n column_split = column.to_s.split\n if column_split[-1] == \"token\"\n sent_at = column_split[0..-2].append(\"sent_at\").join('_').to_sym\n\n if User.column_names.include? sent_at.to_s\n self[sent_at] = nil\n end\n end\n end", "title": "" }, { "docid": "ee9ebd9c10ff97d73b18b4eafb0f7990", "score": "0.5784741", "text": "def clear_token(column)\n self[column] = nil\n\n column_split = column.to_s.split\n if column_split[-1] == \"token\"\n sent_at = column_split[0..-2].append(\"sent_at\").join('_').to_sym\n\n if User.column_names.include? sent_at.to_s\n self[sent_at] = nil\n end\n end\n end", "title": "" }, { "docid": "c3302431b6144e30f439b6b559cf259b", "score": "0.57825696", "text": "def column(j)\n column = []\n @board.each do |row|\n column << row[j]\n end\n return column.select { |e| e != :_ }\n end", "title": "" }, { "docid": "71840fc99fac8d38b3ecbc5e1112e8e2", "score": "0.5779214", "text": "def cursor_col; col + 1; end", "title": "" }, { "docid": "80bd95470bd2af394cfc16e38b179900", "score": "0.5772201", "text": "def end_column(node)\n node.source_range.end_pos\n end", "title": "" }, { "docid": "13994d8b8ccb84371901f27e2bd15c21", "score": "0.57343996", "text": "def get_col(col)\n return $boggle_board.transpose[col]\nend", "title": "" }, { "docid": "513278778a2b9dd82f7144b315271190", "score": "0.5725037", "text": "def getColumnName\n\t\t\n\t\t\t\t\treturn @columnName\n\t\t\t\n\t\t\t\tend", "title": "" }, { "docid": "66166eb7e7b2c51dc3dfaa3eba22b6ed", "score": "0.5720849", "text": "def column pos = self.pos\n return 1 if pos <= 0\n pos - (binary_string.rindex(?\\n, pos - 1) || -1)\n end", "title": "" }, { "docid": "2a71d3a61c840e4a96574fc0cafd5bb1", "score": "0.57172495", "text": "def free_cols(col)\n @board.transpose[col].each_with_index.chunk {|x,i| x==\".\"}.map do |flag, arr|\n [flag, arr.first[1], arr.last[1] - arr.first[1] + 1]\n end\n end", "title": "" }, { "docid": "a1ee94bcc5a36cfc01d8b146b4898762", "score": "0.5714082", "text": "def starting_column \n 0 \n end", "title": "" }, { "docid": "717fd5163549094666b8173cc7ceac1e", "score": "0.5712574", "text": "def previous_column\n return false if column == Board::COLUMNS.first\n index = Board::COLUMNS.index(column)\n Board::COLUMNS.at(index - 1)\n end", "title": "" }, { "docid": "5f8015b48ec46559d4c59488eb4f7fa3", "score": "0.57012963", "text": "def column_name s, i\n result = s[0..i-1]\n re = Regexp.new(/(lower_|upper_)/)\n result.gsub!(re) { |s| '' }\n result\n end", "title": "" }, { "docid": "53445d3d44102d8cbc4d2254d0c9e289", "score": "0.5699933", "text": "def delete_column(colname)\n deleteVariable(colname)\nend", "title": "" }, { "docid": "56d944e7834962baeace74481cf35338", "score": "0.5693537", "text": "def column_name(index)\r\n end", "title": "" }, { "docid": "0f1b44bcf30438262850c2c8b4a86e6b", "score": "0.5690949", "text": "def column_of(range)\n source = range.source.strip\n if source.include?(\"\\n\")\n previous_code_line(range.line + source.count(\"\\n\") + 1) =~ /\\S/\n else\n display_column(range)\n end\n end", "title": "" }, { "docid": "08a77ff314b8f7dcc27b79a6db31f313", "score": "0.568646", "text": "def cursor_col(col)\n\t@t_col = col\n\tti_hpos(col)\n end", "title": "" }, { "docid": "1f4bd7c08357ad4473e32ff0a06c2732", "score": "0.5678273", "text": "def bottom(column)\n index = column.last(12).index(0)\n if index == 0\n return nil\n end\n return index\n end", "title": "" }, { "docid": "13845b03bc814e97c25c227f04f47599", "score": "0.567161", "text": "def feature_column_list_new\n colums = COLUMN_NAME[\"column_resetting\"]\n return colums\n end", "title": "" }, { "docid": "85e0cb9f37a2eb73261b0d46fd1b842f", "score": "0.5670067", "text": "def get_Column()\n \t return @outputs[\"Column\"]\n \tend", "title": "" }, { "docid": "199bb0a7953658d518a37bf7219ede1f", "score": "0.5668878", "text": "def real_column; end", "title": "" }, { "docid": "39a95baeb017a59a660678f702241f61", "score": "0.5653678", "text": "def get_column(column)\n return get_column_indices(column).map { |r| @board[r] }\n end", "title": "" }, { "docid": "2f871a317733338f082ac2f9d139f6b2", "score": "0.5642703", "text": "def start_column(node)\n node.source_range.begin_pos\n end", "title": "" }, { "docid": "2f871a317733338f082ac2f9d139f6b2", "score": "0.5642703", "text": "def start_column(node)\n node.source_range.begin_pos\n end", "title": "" }, { "docid": "feb5935edcdd2c748123c0b319e15f6f", "score": "0.5641756", "text": "def column\n column = []\n @rows.each do |block_row|\n block_row.each do |block_sub_row|\n column << block_sub_row[block_column][block_sub_column]\n end\n end\n column\n end", "title": "" }, { "docid": "ee84565b984a99c5d455b47da6b9c029", "score": "0.5641527", "text": "def column_of(cell)\n @columns_by_cell[cell]\n end", "title": "" }, { "docid": "19753e639ff0579324f6cae89eb51ed7", "score": "0.56391263", "text": "def get_col(col)\n\ttrans_board = @boggle_board.transpose\n\treturn trans_board[col]\nend", "title": "" } ]
3d71a4c0389213f251e98726724cf3e0
DELETE /players/1 DELETE /players/1.json
[ { "docid": "278411a3f43ea7a6f84bab3a92066c5e", "score": "0.74481", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "221858579afa4f11746f587f4bfaf259", "score": "0.77819896", "text": "def delete\n\n thePlayer = Player.find(@player_id)\n render :json => thePlayer.destroy, :except => [:password_digest]\n\n end", "title": "" }, { "docid": "d88b1d645b1bfaa512d198cd8c5e12a2", "score": "0.7646331", "text": "def delete\n\t\trender json: Player.delete(params[\"id\"])\n\tend", "title": "" }, { "docid": "d866dd8021a627b02e509af02a6e8555", "score": "0.76241577", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d3c20977b6402ad362668a730d75ff4d", "score": "0.75942695", "text": "def destroy\n # @player = Player.find(params[:id])\n # @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2da97152d85e3f20f9cbb47dd1c19326", "score": "0.75851995", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af80ad6f63c535244242f2cd9064cda7", "score": "0.75591815", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e98bbfcf96cadf3dc53ea1ea09e3200", "score": "0.73855096", "text": "def destroy\r\n @player = Player.find(params[:id])\r\n @player.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(players_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b71702477bae661e0cb4dc3565b38269", "score": "0.731946", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9aa1fa4696f1038e98ffc5336e5d7899", "score": "0.7310612", "text": "def destroy\n @player.destroy!\n\n render json: {deleted: \"Player has been deleted successfully\"}\n\n end", "title": "" }, { "docid": "6b5cbc1f49318689c9f277912f226803", "score": "0.728244", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n end\n end", "title": "" }, { "docid": "9c358f4ae24aa635c7796301cae009ad", "score": "0.7278479", "text": "def destroy\n @lineupplayer = Lineupplayer.find(params[:id])\n @lineupplayer.destroy\n\n respond_to do |format|\n format.html { redirect_to lineupplayers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "860c2b6bd72422694400da6ce850cf19", "score": "0.726795", "text": "def destroy\n @game_player.destroy\n respond_to do |format|\n format.html { redirect_to game_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "015ccabe7dcdc2cdc44f158df73de29d", "score": "0.72556233", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31c444e9cf924f62bd761c832848876d", "score": "0.7255449", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: \"Player was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31c444e9cf924f62bd761c832848876d", "score": "0.7254735", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: \"Player was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c3c1d7b77f559c1274e37f1e3ad96c2", "score": "0.72189665", "text": "def destroy\n\n #@player = Player.find(params[:id])\n #@team = @player.post\n @player.destroy\n #binding.pry\n respond_to do |format|\n format.html { redirect_to team_players_path, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9b3553d8610d34aa0db852ebfedcbce4", "score": "0.72068924", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n respond_with @player\n end", "title": "" }, { "docid": "fbce752e95c68451024c9a4ae9246beb", "score": "0.72040373", "text": "def destroy\n @admin_player.destroy\n respond_to do |format|\n format.html { redirect_to admin_players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6fc7bd050b0c784a4a2227f784dbc38f", "score": "0.71950334", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to round_url(@player.round_id), notice: \"Player was successfully removed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b55ebb0c64c607a53acc839a6f858ea5", "score": "0.7193876", "text": "def destroy\n @team_player = TeamPlayer.find(params[:id])\n @team_player.destroy\n\n respond_to do |format|\n format.html { redirect_to team_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "18fb5137090de90bf343bb51a5540670", "score": "0.719061", "text": "def destroy\r\n @player.destroy\r\n respond_to do |format|\r\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "2149b52eb5508439f48a90e3f1a92c4d", "score": "0.7184895", "text": "def destroy\n @player = Player.find params[:id]\n @player.destroy\n redirect_to players_path\n end", "title": "" }, { "docid": "4144570f5fc173114be7567705f71240", "score": "0.7178167", "text": "def destroy\n @live_player.destroy\n respond_to do |format|\n format.html { redirect_to live_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f7c3cd56e0eb1de147792f924d106df", "score": "0.7165283", "text": "def destroy\n @hurdle_player = HurdlePlayer.find(params[:id])\n @hurdle_player.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c104020d5d4ad9c81292e862dce67bb6", "score": "0.7163163", "text": "def destroy\n @type_player.destroy\n respond_to do |format|\n format.html { redirect_to type_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b28cf580081ad67829245eb883a38d56", "score": "0.7139467", "text": "def destroy\n @game.players.each do |p|\n p.destroy\n end\n\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1107120c422de56061a34470e790ef56", "score": "0.7132994", "text": "def destroy\n @matchplayer = Matchplayer.find(params[:id])\n @matchplayer.destroy\n\n respond_to do |format|\n format.html { redirect_to matchplayers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8ad4c8df5381484cbe3552adcfb26b51", "score": "0.7128203", "text": "def destroy\n @userplayer.destroy\n respond_to do |format|\n format.html { redirect_to userplayers_url, notice: 'Userplayer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "06075f8538660b10c020629aca28d840", "score": "0.7123506", "text": "def destroy\n DB.execute(\"DELETE FROM players WHERE id = #{@id}\")\n end", "title": "" }, { "docid": "5793e38e9bb95a3f4e2c6faaa7c52be3", "score": "0.71093935", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to team_players_url(current_team), notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b42b45546ab2e1cb92a047cc6e51e248", "score": "0.7098923", "text": "def destroy\n\n if @player.destroy\n\n render json: {player: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @player.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "title": "" }, { "docid": "00431a271a615d8457414c4ce3c896a8", "score": "0.7094746", "text": "def destroy\n @game_player = GamePlayer.find(params[:id])\n @game_player.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e902277ae517c5f8cb6e620d1bd09131", "score": "0.7088312", "text": "def destroy\n @playername.destroy\n respond_to do |format|\n format.html { redirect_to playernames_url, notice: 'Playername was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "84ec2912211b3a7ee599c701b451021e", "score": "0.7069408", "text": "def destroy\n @game_award_player.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "78452c912fbc997c7aed5140edf4adcb", "score": "0.706828", "text": "def destroy\n @player.destroy\n\n respond_to do |format|\n flash[:success] = 'Player was successfully destroyed.'\n\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d4e027ca4c8ca97de462e73cd27b25dd", "score": "0.7065457", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to team_path(@team), notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b9e43d3d4c423c44252822fe0b402828", "score": "0.7059924", "text": "def destroy\n @user_team_player.destroy\n respond_to do |format|\n format.html { redirect_to players_url, notice: \"Player #{@user_team_player.player.name} is removed from team.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e6bfa9231fcbd8723bee8f1d144e8f9a", "score": "0.70514256", "text": "def destroy\n @players_profile = PlayersProfile.find(params[:id])\n @players_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to players_profiles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1269e39f2616d95c64835b8263b3c4ec", "score": "0.70460653", "text": "def destroy\n @team_player = TeamPlayer.find(params[:id])\n @team_player.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1296bc8c2153655cc76af1f538f42856", "score": "0.7037887", "text": "def destroy\n @nfl_player = NflPlayer.find(params[:id])\n @nfl_player.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5b3bf2ba9eeee935617abc1dfefacf54", "score": "0.7025162", "text": "def destroy\n @player = Player.find(params[:id])\n\n if @player.access_key == params[:access_key] then\n @player.destroy\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n else\n head :unauthorized\n end\n\n\n end", "title": "" }, { "docid": "f8385b263a0b70098ebc5eb916013e96", "score": "0.7024277", "text": "def destroy\n #@player = Player.find(params[:id])\n team_id = @player.team_id\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_players_url(team_id)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "bbeaa90b5551af04c4956cddbd1ed201", "score": "0.7020777", "text": "def destroy\n @gameplayer.destroy\n respond_to do |format|\n format.html { redirect_to gameplayers_url, notice: 'Gameplayer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c808d72029072f0c03906840d5ed7e1", "score": "0.7014029", "text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to admin_players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d97f402e9f68b166affa6cd001d6178", "score": "0.7013425", "text": "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n respond_to do |format|\n format.html { redirect_to session.delete(:return_to), notice: \"Player now pending\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1fc7bc82a2c017a077638311a9f182ea", "score": "0.7012002", "text": "def destroy\n @enabled_player.destroy\n respond_to do |format|\n format.html { redirect_to enabled_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2ed936d94b13ed571895bddfe23cc042", "score": "0.69991076", "text": "def destroy\n @eplayer.destroy\n respond_to do |format|\n format.html { redirect_to eplayers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0b2bcdbce52cd4f3cefe6ba538d73c5a", "score": "0.6988543", "text": "def destroy\n @ok_player = OkPlayer.find(params[:id])\n @ok_player.destroy\n\n respond_to do |format|\n format.html { redirect_to(ok_players_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c331826f6c8e836228dfa418016c2ce3", "score": "0.69830614", "text": "def destroy\n @player_stat = PlayerStat.find(params[:id])\n @player_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to player_stats_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc98bd50357f3b725745dea1699e9abc", "score": "0.69824445", "text": "def destroy\n @branches_player = BranchesPlayer.find(params[:id])\n @branches_player.destroy\n\n respond_to do |format|\n format.html { redirect_to branches_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d33ac582b20d975330153180f6ff66c1", "score": "0.6976945", "text": "def destroy\n @wattball_player = WattballPlayer.find(params[:id])\n @wattball_player.destroy\n\n respond_to do |format|\n format.html { redirect_to wattball_players_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fd4eb511cd5e957a76d59b08b0244ce9", "score": "0.69634366", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7a0e69d4b1958684e5ebe80d49ead9e9", "score": "0.6963434", "text": "def destroy\n http_api.delete(\"clients/#{@name}\")\n end", "title": "" } ]
ae4fa4ab30874e18d9698454d9f3b906
Returns a random token
[ { "docid": "89b52412e34ab608eae513f90ca581fd", "score": "0.0", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" } ]
[ { "docid": "e94c754e7cb05e18572d244168bd16f1", "score": "0.8688152", "text": "def random_token\n rand(36**11).to_s(36).upcase[0,6]\n end", "title": "" }, { "docid": "abc2b2e068eb56448a592733b89781b8", "score": "0.8532833", "text": "def random_token\n rand(36**8).to_s(36)\n end", "title": "" }, { "docid": "011936337ceb4cf00fac932fcaeca413", "score": "0.8456743", "text": "def random_token\n\t\tself.class.random_token\n\tend", "title": "" }, { "docid": "fc658c795315dd19cf1b0ab68d6462d8", "score": "0.8294003", "text": "def generate_token\n self.token ||= Tokenizer.random_token(16)\n end", "title": "" }, { "docid": "0731e9a1dee0dca3a5474fd66c6a16ff", "score": "0.8233348", "text": "def random_token\n chance_symbol = 80 # +, -, *, /, etc\n chance_input = 40 # i40, i21, etc\n chance_number = 20\n\n total = chance_symbol + chance_input + chance_number\n stick = rand() * total\n\n token = nil\n if stick < chance_symbol\n token = [\"+\", \"-\", \"*\", \"/\", \"log\", \"log10\", \"tanh\"].sample\n elsif stick < chance_symbol + chance_input\n token = \"i\" + (rand() * TrainingDatum::NUM_FEATURES).to_i.to_s\n else\n token = (rand() * 2 - 1).to_s\n end\n\n return token\n end", "title": "" }, { "docid": "234fb80ce887451f997767d64f4b3cd4", "score": "0.80137396", "text": "def random_token\n SecureRandom.urlsafe_base64(32)\n end", "title": "" }, { "docid": "89dba43893cb07fc8f062211eb4ad7dd", "score": "0.7989033", "text": "def generate_token\n\t\to = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n self.token = (0...10).map{ o[rand(o.length)] }.join\n\tend", "title": "" }, { "docid": "fc6df4a5c27115dcc235024567baeb31", "score": "0.79543096", "text": "def generate_token\n chars = ['A'..'Z', 'a'..'z', '0'..'9'].map{|r|r.to_a}.flatten\n Array.new(50).map{chars[rand(chars.size)]}.join\n end", "title": "" }, { "docid": "32ceea48535b988ee3dc8876700f8e27", "score": "0.7862062", "text": "def generateToken()\n while true\n token = rand(2**512)\n return token unless $tokens.include?(token)\n end\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.78548497", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.78548497", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "65b911435ff3d21bd4e3a63b06ff6aee", "score": "0.78548497", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end", "title": "" }, { "docid": "6cd9b0b792e68215b0f81902b2011920", "score": "0.7821509", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{rand}--\")\n end", "title": "" }, { "docid": "88a066cd1b78f7ed7bb4140784fbcd1c", "score": "0.7776707", "text": "def generate_random_token\n SecureRandom.urlsafe_base64(\n sorcery_config.token_randomness\n ).tr('lIO0', 'sxyz')\n end", "title": "" }, { "docid": "f06aa28de688e97a0b4b4be5e74b5d67", "score": "0.772491", "text": "def generate_random_token\n SecureRandom.hex(15)\n end", "title": "" }, { "docid": "2b6376d6d1805054b1171868cea4fd50", "score": "0.772105", "text": "def token\n @token ||= SecureRandom.hex(16)\n end", "title": "" }, { "docid": "2f37f9a7242cb486fd18c53ba3f5ad29", "score": "0.7672772", "text": "def make_token\n \"#{RandomGenerator.make_string(4)}-#{RandomGenerator.make_string(4)}\".upcase\n end", "title": "" }, { "docid": "b390d71c296f3a6904a51c80a72eec27", "score": "0.76447654", "text": "def ensure_token\n return if self.token.present?\n length = 10\n self.token = (36**(length-1) + rand(36**length - 36**(length-1))).to_s(36)\n end", "title": "" }, { "docid": "840135a6a57595fee0ec1371ae793420", "score": "0.7633236", "text": "def make_token\n \"#{rand(0..9)}#{SecureRandom.hex(SECURE_HEX_SIZE)}#{rand(0..9)}\"\n end", "title": "" }, { "docid": "dbfab4aa6a5996c0bdd97cb8cccb35f6", "score": "0.7599851", "text": "def generate_token\n UUIDTools::UUID.random_create.hexdigest\n end", "title": "" }, { "docid": "352f548df63be7a00d9d6b81cda94bac", "score": "0.7597931", "text": "def friendly_token\n ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete(\"\\n\")\n end", "title": "" }, { "docid": "84b626682378de6f5bfea4f1cad46bdc", "score": "0.7578905", "text": "def crappy_token_generator\n (rand * 10).floor\n end", "title": "" }, { "docid": "24f3e9200ae3a685de87d0b1a989988b", "score": "0.7576475", "text": "def new_token\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n string = (0...50).map { o[rand(o.length)] }.join\n end", "title": "" }, { "docid": "52f588cc859bffdff50ec3b571006d34", "score": "0.75676", "text": "def get\n sync do\n 10.times do\n t = SecureRandom.hex(20)\n next if tokens.has_key?(t)\n\n tokens[t] = true\n return t\n end\n end\n\n fail 'unable to generate a unique token'\n end", "title": "" }, { "docid": "0b195d43361a36c008695d47d523d30d", "score": "0.7562729", "text": "def generate_token\n\tbegin\n\t\tself.token = SecureRandom.hex(64)\n\tend while Alfa::Token.find_by_token(self.token)\n end", "title": "" }, { "docid": "0be8dafdc74e993d634c995f3c741053", "score": "0.7562366", "text": "def regenerate_token\n random_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n self.update_attribute(:token, random_string)\n end", "title": "" }, { "docid": "84fe8f108cdaddc82d4535e844b173fc", "score": "0.7545033", "text": "def make_a_token\n\t\t\treturn Digest::SHA1.hexdigest([Time.now, rand].join)[0..5]\n\t\tend", "title": "" }, { "docid": "ff4ba86db2a3a6a12a1352ab4571a8ce", "score": "0.7540025", "text": "def generate_token\n SecureRandom.hex(10)\n end", "title": "" }, { "docid": "db7c1950b399c6ba024c5786dbfcfca6", "score": "0.7524806", "text": "def generate_token\n SecureRandom.hex(10)\n end", "title": "" }, { "docid": "2508ad04f254ca96edfcf081b054775e", "score": "0.7517143", "text": "def generate_token\n SecureRandom.hex(32)\n end", "title": "" }, { "docid": "6291abdb5b1a468fbd859bc73fd2a1e7", "score": "0.74469316", "text": "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "title": "" }, { "docid": "6291abdb5b1a468fbd859bc73fd2a1e7", "score": "0.74469316", "text": "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "title": "" }, { "docid": "91cddb2bf916c98fc08089d285986fcf", "score": "0.74427295", "text": "def generate_token\n SecureRandom.hex\n end", "title": "" }, { "docid": "32841fa6c49ee603187fea5cfce62f26", "score": "0.7438207", "text": "def friendly_token\n SecureRandom.base64(15).tr('+/=lIO0', 'pqrsxyz')\n end", "title": "" }, { "docid": "d94a9692e25e78e9ea95b304002fa427", "score": "0.742705", "text": "def create_token\n self.token = 'IMGRY'+Digest::SHA1.hexdigest(rand().to_s + Time.new.to_s)[0, 32].upcase!\n end", "title": "" }, { "docid": "8c88cf35eff2c3ddfbe0fc76e919adce", "score": "0.7425739", "text": "def friendly_token\n SecureRandom.base64(15).tr('+/=lIO0', 'pqrsxyz')\n end", "title": "" }, { "docid": "6bafc72e0269521c6f2dfcd000fcbe8e", "score": "0.7418041", "text": "def generate_token\n self.token = SecureRandom.hex(32)\n end", "title": "" }, { "docid": "4caf0bc10377150a691282fe27736385", "score": "0.741458", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.team_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "2491e4a93cb6400fc421cb55c005f166", "score": "0.74137115", "text": "def generate_token\n\n # Generate random token untill is unique\n begin\n new_token = SecureRandom.base64(64)\n tokens = Session.all.map{ |t| t.token}\n end while tokens.include? new_token\n\n return new_token\n end", "title": "" }, { "docid": "f8c35175bce82788439ecfe2b1acb74f", "score": "0.740323", "text": "def make_token\n require 'digest/md5'\n Digest::MD5.hexdigest(\"#{inspect}#{Time.now}#{rand}\")\n end", "title": "" }, { "docid": "cf574dc27bfafca62b3e0e7242cede1f", "score": "0.7358938", "text": "def valid_token\n ct_array = Figaro.env.client_tokens.split(',')\n token = ct_array.blank? ? \"No_valid_token_found\" : ct_array[rand(0...ct_array.length)]\n \"Token token=#{token}\"\n end", "title": "" }, { "docid": "1fad6c4a9e8f706038b595c9e2303ad2", "score": "0.73585516", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "22c1a9a5aacd56b7749935169a68e57f", "score": "0.7352445", "text": "def token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "d34720ff6e010bfcaee0e4ab25959a7f", "score": "0.7351094", "text": "def make_token\n secure_digest(Time.now, (1..10).map { rand.to_s })\n end", "title": "" }, { "docid": "814372a36f1dc2f994485efe321e98e4", "score": "0.7349222", "text": "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "title": "" }, { "docid": "857d061f160c594a6ab81950894b1923", "score": "0.7338888", "text": "def token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "b35e6487383cf62bd54c691b7df6a3c1", "score": "0.7330235", "text": "def generate_token\n SecureRandom.hex(64)\nend", "title": "" }, { "docid": "b35e6487383cf62bd54c691b7df6a3c1", "score": "0.7330235", "text": "def generate_token\n SecureRandom.hex(64)\nend", "title": "" }, { "docid": "aebaeee5e22d6123247c567ab3aa519d", "score": "0.73298067", "text": "def generate_token\n update_attribute(:token, Digest::MD5.hexdigest(login + Time.now.to_i.to_s + rand(999999).to_s)[0..4])\n end", "title": "" }, { "docid": "aa4e03f97d3013e0d6c5e5055a5f23e8", "score": "0.73250157", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "4879e7fd330b19d36d96e0155f318ef4", "score": "0.73204786", "text": "def generate_token\n token = \"\"\n for i in 1..MiniCaptcha.token_length do\n token += \"#{MiniCaptcha.token_charset[rand(MiniCaptcha.token_charset.length),1]}\"\n end\n token\n end", "title": "" }, { "docid": "cd8788be286eca6288475c3772380ab8", "score": "0.7313208", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "title": "" }, { "docid": "91e0b97f3547d037d87a2ec863b80e4e", "score": "0.73079556", "text": "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "title": "" }, { "docid": "7350f1f10d2d7c704ea806f61d63646d", "score": "0.72938216", "text": "def token\n tokens.count > 0 ? tokens.first : generate_token\n end", "title": "" }, { "docid": "c02d586d3c1210e5dfc268da94095dd4", "score": "0.72872496", "text": "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n toekn_gen\n end", "title": "" }, { "docid": "a8482e716adc60447a792a342cf76305", "score": "0.7265948", "text": "def generate_token\n\t\tself.token = Digest::SHA1.hexdigest([self.group_id, Time.now, rand].join)\n\tend", "title": "" }, { "docid": "2aa9bc6d1d13f058bd367697f16a625c", "score": "0.72648406", "text": "def generate_token\n SecureRandom.urlsafe_base64(nil, false)\n end", "title": "" }, { "docid": "cd40cacb5445164819aafb95f0743bf3", "score": "0.7263555", "text": "def get_token\n token\n end", "title": "" }, { "docid": "835d8b9d9fb7286133e7fc65beea3221", "score": "0.72593564", "text": "def generate_token\n self.token = SecureRandom.uuid if token.blank?\n end", "title": "" }, { "docid": "55118424fa2773dec4227446d412b866", "score": "0.7244821", "text": "def generate_token\n self.token = SecureRandom.hex(16)\n end", "title": "" }, { "docid": "3a409624352e0171d5ccdcd528f1b35f", "score": "0.7244133", "text": "def generate_token\n self.token ||= SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "2065b46bedddec722cf05dc743a5e618", "score": "0.72408915", "text": "def generate_token(name = '')\n # TODO: replace with a real token generator\n \"#{name}_token\"\nend", "title": "" }, { "docid": "761bb9549aefe262fb47efaed1c4d1de", "score": "0.7237521", "text": "def generate_token\n self.token = SecureRandom.hex\n end", "title": "" }, { "docid": "9d05386ac8cd081d3c4d519f4619a968", "score": "0.7226883", "text": "def generate_token\n DecimalConverter.decimal_to_sexagesimal(Random.new.rand(2846806779661..167961599999999))\n end", "title": "" }, { "docid": "a2d21f307865adf87d3508daa7f55910", "score": "0.72260314", "text": "def generate_token\n\t\ttoken_gen = SecureRandom.hex\n\t\tself.token = token_gen\n\t\ttoken_gen\n\tend", "title": "" }, { "docid": "a2d21f307865adf87d3508daa7f55910", "score": "0.72260314", "text": "def generate_token\n\t\ttoken_gen = SecureRandom.hex\n\t\tself.token = token_gen\n\t\ttoken_gen\n\tend", "title": "" }, { "docid": "7127a84d2d0584a5106e30add46291fb", "score": "0.7207927", "text": "def token\n if require_token_generation?\n @token_generation_mutex.synchronize do\n # Double check if we need to regenerate the token.\n # This could happen if two threads try to concurrently access\n # the token after it has expired (or before initial generation).\n if require_token_generation?\n @last_generated = time\n @token = generate_token\n end\n end\n end\n\n @token\n end", "title": "" }, { "docid": "d5093a131f2a1ecf0253d1e58776fbed", "score": "0.72001046", "text": "def generate_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "d5093a131f2a1ecf0253d1e58776fbed", "score": "0.72001046", "text": "def generate_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "d5093a131f2a1ecf0253d1e58776fbed", "score": "0.72001046", "text": "def generate_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "6d08cf49d9a3dd01af33c7ae145661f8", "score": "0.71963245", "text": "def generate_unique_token\n token = SecureRandom.hex(3)\n while Link.find_by(token: token)\n token = SecureRandom.hex(3)\n end\n token\n end", "title": "" }, { "docid": "499dc30ffb72ada7aa41f82a21ee80b6", "score": "0.71950525", "text": "def generate_token\n return SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5c4fa3252d6e310efb97f962824fe564", "score": "0.71947676", "text": "def generate_token\n return SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "afb57b98cdd31ea3ad37bca18201ed8d", "score": "0.7171801", "text": "def generate_token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: token)\n end", "title": "" }, { "docid": "578e957f285915e5c63306dcb07971a4", "score": "0.71368474", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.trip_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "c8ace6452583c53fd884f998e02238ea", "score": "0.71171933", "text": "def generate_token\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(token: token)\n end\n end", "title": "" }, { "docid": "abeba9c54b959c53b7cbe0a38c4ac474", "score": "0.7109527", "text": "def friendly_token(length = 20)\n rlength = (length * 3) / 4\n SecureRandom.urlsafe_base64(rlength).tr('lIO0', 'sxyz')\n end", "title": "" }, { "docid": "acab836b0ac6942bb63e2f1696a1d62f", "score": "0.7097944", "text": "def generate_token\n UUID.new.generate :compact\n end", "title": "" }, { "docid": "e3f6c9681c5ade9138b8cdd1a59f4ed7", "score": "0.7087043", "text": "def token; uuid; end", "title": "" }, { "docid": "f41d4ffbe04cde7f3f5af8a0b66e4aa4", "score": "0.70861065", "text": "def create_token\n # Generate a random endpoint for the customer\n endpoint = (0...13).map { ('a'..'z').to_a[rand(26)] }.join\n @token = generate_token endpoint\n end", "title": "" }, { "docid": "423053aebd29f58d8d6aeaeb3c58e742", "score": "0.70858634", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.trip_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "7b093482d9fe6e3c04e6874da732f9be", "score": "0.70851076", "text": "def generate_token\r\n self.token = SecureRandom.base64(15).tr('+/=lIO0', OAUTH_CONSUMER_SECRET)\r\n end", "title": "" }, { "docid": "4ad5b31f958e9bff6eb2e644505a0965", "score": "0.7084644", "text": "def secret_token\n SecureRandom.hex(30)\n end", "title": "" }, { "docid": "5d478abe37ac3e4dc5c3b238ff2c60ff", "score": "0.7079689", "text": "def unique_token\n SecureRandom.uuid.gsub('-', '')\n end", "title": "" }, { "docid": "660603475f1b8f3c317406f7696cb65e", "score": "0.70547307", "text": "def getRandomSymbol\n\t\t\t@symbols[rand(4)]\n\t\tend", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "5dfdfb80ca53f2b5e7280b2b04122bbe", "score": "0.70423436", "text": "def new_token\n SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "ab25f4936b701466a5a95f2fcb855440", "score": "0.7032069", "text": "def generate_token\n self.token = loop do\n random_token = SecureRandom.urlsafe_base64(32)\n break random_token unless !User.where(token: random_token).blank?\n end\n end", "title": "" }, { "docid": "a294f0641ce78fd6f80edb73bd487552", "score": "0.7004537", "text": "def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"PARRAIN-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end", "title": "" }, { "docid": "1b9366dd529a0b301516a3dc4fa85439", "score": "0.69989413", "text": "def token\n \"#{id}.#{digest}\"\n end", "title": "" } ]
9f3c12d79eb129d443515d81c9f7fa46
it returns hash (only the item that has the highest_standard_deviation) key => highest_standard_deviation, value = the instance of it
[ { "docid": "9f9e1af09b78ece37237f8533b5d2235", "score": "0.8971339", "text": "def highest_standard_deviation\n highest_standard_deviation_hash = {}\n analytics_hash = self.get_std_all_items\n highest_standard_deviation = analytics_hash.keys.max\n highest_standard_deviation_instance = analytics_hash[highest_standard_deviation]\n highest_standard_deviation_hash[highest_standard_deviation] = highest_standard_deviation_instance\n highest_standard_deviation_hash\n end", "title": "" } ]
[ { "docid": "7982d46371ea9ea315ff65f1c7c8d4c7", "score": "0.66108096", "text": "def find_highest_value(hash)\n highest_value = hash.max_by {|driver, value| value}[0]\nend", "title": "" }, { "docid": "17d84776c6246512f46855f068e9d7e2", "score": "0.6401809", "text": "def best_hash\n db.get(KEY_PREFIX[:best])\n end", "title": "" }, { "docid": "09f97582a9d531f31b5ae8d6db3d4581", "score": "0.63139105", "text": "def biggest_shoe\r\n player_name= []\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n obj=value.max_by {|key, value| value[:shoe]}\r\n player_name<< obj.first\r\n end\r\n end\r\n end\r\n player_name.first\r\nend", "title": "" }, { "docid": "d473b046ba35ce26a812058cc6d26ad6", "score": "0.61668295", "text": "def find_highest_sell(sells)\n (sells.max_by{|k,v| v})\nend", "title": "" }, { "docid": "a6d088065a27fea021fd6f8edde3cc4b", "score": "0.6156063", "text": "def player_w_biggest_feet\n all_players[1].max_by { |stats| stats[:shoe] }\n end", "title": "" }, { "docid": "5aaefe588abcccf61ffa10f3cc75c8aa", "score": "0.61475694", "text": "def highest_score\n sort\n all.first.score\n end", "title": "" }, { "docid": "695b2c94fd150f0df074dd39233f9545", "score": "0.61330926", "text": "def greatest_key_by_val(hash)\nend", "title": "" }, { "docid": "86f141ce67a0d57a0928702004a36beb", "score": "0.6118779", "text": "def high_calorie_name (a)\n a.key(a.values.max) \nend", "title": "" }, { "docid": "03d6fd12c8a4d4f2448adae09b6e236a", "score": "0.60981363", "text": "def biggestShoes\n players.max_by do|name, stats|\n stats[:shoe]\n end\nend", "title": "" }, { "docid": "d59c621952743fffd0eff61a37d8f85e", "score": "0.60954183", "text": "def biggest_investment\n big_investment = 0\n big_round = {}\n self.funding_rounds.each do |funding_round|\n if funding_round.investment > big_investment\n big_investment = funding_round.investment\n big_round = funding_round\n end\n end\n big_round\n end", "title": "" }, { "docid": "d8cd6cc048938de8784ef83abdd11371", "score": "0.60819674", "text": "def get_std_all_items\n analytics_hash = {}\n self.items.each do |item|\n analytics_hash[item.stats.standard_deviation] = item\n end\n analytics_hash\n end", "title": "" }, { "docid": "f615fc1b9ea3740fbd754201d1c4cacd", "score": "0.6079555", "text": "def find_max(data, item)\n max = 0\n data.each_pair do |driver, data|\n if data[item] > max\n max = data[item]\n end\n end\n return max\nend", "title": "" }, { "docid": "03983e230d401159d9e6c9049d619668", "score": "0.6076944", "text": "def winner\n @hash.key(@hash.values.max)\n end", "title": "" }, { "docid": "cad568e06d9ff438840aa68e27792896", "score": "0.60636485", "text": "def highest(hash, key)\n highest_total = 0\n\n hash.each do |driverkey, driver_array_value|\n if driver_array_value.last[key] > highest_total\n highest_total = driver_array_value.last[key]\n end\n end\n\n hash.each do |driverkey, driver_array_value|\n if driver_array_value.last[key] == highest_total\n return driverkey\n end\n end\nend", "title": "" }, { "docid": "48604e0517e9a6abed6e5956ef5b5b8a", "score": "0.60223895", "text": "def driver_with_highest_rating(average_rating)\n return average_rating.max_by { |driver_rating| driver_rating[:avg_rating]}\nend", "title": "" }, { "docid": "8b48f0e7dd89e468c5aec295038f8a71", "score": "0.6008683", "text": "def highest_fitness(sample_group)\n best_fitness = 0\n best_person = nil\n sample_group.each do |person|\n if person.get_energy_level > best_fitness\n best_person = person\n best_fitness = person.get_energy_level\n end\n end\n best_person\n end", "title": "" }, { "docid": "1e554c34aac7f95ae387d0ba6384df61", "score": "0.5997476", "text": "def getMostProfitableStock(weeklyValues)\n max = -1.0/0.0 \n mostProfitableStock = \"\"\n weeklyValues.each do |row| # Traverses through array of hashes to find maximum value\n if row[:difference] > max\n max = row[:difference]\n mostProfitableStock = row[:stock]\n end\n end\n mostProfitableStock\n end", "title": "" }, { "docid": "86d53d22c82b1ee91bb79c4ef4a28390", "score": "0.59882003", "text": "def stock_picker stock_prices\n coll = Hash.new \n stock_prices.each_index do |i|\n stock_prices.map.with_index(i) do |e, j|\n if stock_prices[j] && stock_prices[j] > stock_prices[i]\n coll[[i, j]] = stock_prices[j] - stock_prices[i]\n end\n end\n end\n\n coll = coll.key(coll.values.max)\n puts \"Buy on day:\\t#{coll[0]} \\nSell on day:\\t#{coll[1]}\"\n puts \"Profit ($):\\t#{stock_prices[coll[1]] - stock_prices[coll[0]]}\"\nend", "title": "" }, { "docid": "f8c2ba65f1ca00e0b93687889459a18e", "score": "0.5965041", "text": "def output_highest_average_rating(list_of_average_ratings)\n highest = list_of_average_ratings.max_by do |rating|\n rating[:average_rating]\n end\n\n puts \"\\nDriver with the highest average rating is #{highest[:driver_id]}.\"\nend", "title": "" }, { "docid": "4082c7d9f5a4664661b97475f13a1dc8", "score": "0.59605366", "text": "def most_steals\r\n result={}\r\n game_hash.each do |k, v|\r\n v.each do| p, d|\r\n if p==:players\r\n d.each do |t, s|\r\n result[t]=s[:steals]\r\n end\r\n end\r\n end\r\n end \r\n result.max_by {|name, steal| steal}[0]\r\nend", "title": "" }, { "docid": "b419f6d49d4731e5e4cba3ffd34295c4", "score": "0.5948174", "text": "def greatest_key_by_val(hash)\n# receive a hash of integers as values (what is the key in the input?)\n\n# finds max integer from all values\n max = hash.max\n\n# returns the key with the largest value\n puts \"{ '#{max[0]}' => #{max[1]} }\"\n\nend", "title": "" }, { "docid": "000f5c9aa8e7b2c9c4da0603c3697879", "score": "0.5936156", "text": "def biggest_investment\n self.funding_rounds.max_by do |round|\n round.startup.uniq \n end\n end", "title": "" }, { "docid": "06778289392486f920fe2dd5c1a76bf4", "score": "0.59191227", "text": "def mostSteals\n players.max_by do|name, stats|\n stats[:steals]\n end\nend", "title": "" }, { "docid": "6b70f7d8111f3223b2430329a0472609", "score": "0.5918489", "text": "def big_shoe_rebounds\n all_players = game_hash[:home][:players].merge(game_hash[:home][:players])\n big_object = all_players.max_by do |key,value|\n value[:shoe]\n end \n big_object[1][:rebounds]\nend", "title": "" }, { "docid": "a005ea7bb5ab601ce69d11ea41ccf8ae", "score": "0.5880766", "text": "def max_sg_value\n @l.values.max\n end", "title": "" }, { "docid": "09e073b0a3341ebbc6abd592b91d25b0", "score": "0.5875575", "text": "def return_driver_who_had_highest_ave_rating(drivers_average_ratings)\n highest_rating = drivers_average_ratings.each_value.max\n driver_with_highest_average_rating = \"\"\n drivers_average_ratings.each do |driver, ave_rating|\n if ave_rating == highest_rating\n driver_with_highest_average_rating = driver\n end\n end\n driver_with_highest_average_rating\nend", "title": "" }, { "docid": "d240e928bdca44823511a0a0e500a855", "score": "0.58602047", "text": "def greatest_key_by_val(hash)\n hash.sort_by {|key, value| value}.last.first\nend", "title": "" }, { "docid": "41a2f1d6792c13818dac50e3da903018", "score": "0.58409446", "text": "def most_points_scored\n max = nil\n name = nil \n game_hash.each do |team, team_values|\n team_values[:players].each do |player|\n if max == nil || player[:points] > max\n max = player[:points]\n name = player[:player_name]\n end\n end\n end\n name\nend", "title": "" }, { "docid": "766ab0425e0771d79544e1c551517ddb", "score": "0.5834594", "text": "def largest(restaurant_menu)\n mas_caro = restaurant_menu.max_by{|k,v| v}\n puts \"El plato mas caro es el #{mas_caro[0]}\"\nend", "title": "" }, { "docid": "5b39ff37ed8164c0c15e403e9856999d", "score": "0.58341837", "text": "def highest_price\n # CARYN SAYS:the way you describe this above is incorrect! Reread the README\n # It should be the integer price for the most expensive listing of this recipe \n Recipe.all.max { |recipe_a, recipe_b| recipe_a.average_price <=> recipe_b.average_price }\n end", "title": "" }, { "docid": "348a3c75c68f24253a6ece0408121a6b", "score": "0.58233744", "text": "def greatest_val_key(hash)\n \n\twords_and_values = Hash.new 0 \n\t\n\thash.each do |word|\n\t\twords_and_values[word] = word.length\n\tend\n\n\tnew_hash = words_and_values.sort_by { |key, value| value }.reverse\n\tputs Hash[*new_hash.first]\n\nend", "title": "" }, { "docid": "c7cda93ae73db35ca7b60def8e3650cc", "score": "0.5816551", "text": "def greatest_key_by_val(hash)\n hash.sort_by { |k, v| v }.last.first\nend", "title": "" }, { "docid": "4f435dc2a989abe148df9f0fe19ee736", "score": "0.58153534", "text": "def find_max\n\t# Use method: stu_max = @students_list.max_by{|x| x.avg}\n\t max =0\n\t for i in 0..(@students_list.length-1) \n\t\tif @students_list[i].avg > max\n\t\t max = @students_list[i].avg\n\t\t stu_max = @students_list[i]\n\t\tend\n\t end\n\t puts \"Student who has max avg\".center(30)\n\t puts \"Name: #{stu_max.name}\".rjust(20)\n\t puts \"Birthday: #{stu_max.birthday}\".rjust(20)\n\t puts \"Math: #{stu_max.math}\".rjust(20)\n\t puts \"Literature: #{stu_max.liter}\".rjust(20)\n\t puts \"English: #{stu_max.eng}\".rjust(20)\n\t puts \"AVG: #{stu_max.avg}\".rjust(20)\n\tend", "title": "" }, { "docid": "99c81c3e1054be378664796d0ba4fc78", "score": "0.5809875", "text": "def largest_value\n values.max\n end", "title": "" }, { "docid": "5e3f46fd880dfc78d87236b1c1a4c004", "score": "0.57984763", "text": "def most_points_scored\n\tpoints_array = []\n\tgame_hash.each do |location, team_data|\n\t\tteam_data[:players].each do |attribute, data|\t\n\t\t\tdata.each do |type, amount|\n\t\t\t\tif type == :points\n\t\t\t\t\tpoints_array << amount\n\t\t\t\tend \n\t\t\tend\n\t\tend\n\tend\n\tgame_hash.each do |l, data|\n\t\tdata[:players].each do |a, d|\n\t\t\td.each do |t, amt|\n\t\t\t\tif t == :points && points_array.max == amt\n\t\t\t\t\treturn a\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "title": "" }, { "docid": "fd5bf1972813977563348cba8a6b500e", "score": "0.5796745", "text": "def highestfrequency\r\n #@counts.group_by { |x| x }.map { |element, matches| [ element, matches ] }.to_h\r\n #@counts.each_with_object({}) { |item, memo| memo[item] ||= 0; memo[item] += 1 }\r\n ##@counts.uniq.map { |x| [x, @counts.count(x)] }.to_h\r\n #freq = @counts.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\r\n @counts.max_by { |k,v| v }\r\n end", "title": "" }, { "docid": "3858d14f9c75e9a56a99ecc1d3fb7b30", "score": "0.57921356", "text": "def highest_average_rating(all_rides)\n all_ratings = drivers_average_rating(all_rides)\n highest_rating = all_ratings.values.max\n driver = all_ratings.key(highest_rating)\n puts \"#{driver} has the highest average rating: #{highest_rating.round(2)}\"\nend", "title": "" }, { "docid": "7f88c3cf3bfafe1c4f971e4eff2dba1e", "score": "0.5791938", "text": "def greatest_key_by_val(hash)\n hash.sort_by { |keys, values| values }.last[0]\nend", "title": "" }, { "docid": "d8b513ea4aaeb3d5550df2089a03bf08", "score": "0.5789003", "text": "def stock_picker (stocks = Array.new(7) { rand(02..40) })\n# stocks1 = stocks.each_with_index.to_h.invert\nstocks2 = Array.new(7) { rand(2..40) }\nminpick = stocks.each_with_index.min\nminHash = Hash[*minpick]\n\nminpick[1].include? 6\n\n maxpick = stocks2.each_with_index.max\n# maxHash = Hash[*maxpick]\nelse\n # if maxpick[1] < stocks.index(minpick[1]) then\n # next\n # else\n # maxpick = stocks.each_with_index.max\n # maxHash = Hash[*maxpick]\n # end\n\nend", "title": "" }, { "docid": "5814e3829b54c3dfad6ff232219f8216", "score": "0.5775749", "text": "def big_shoe_rebounds\n game_hash.values.each do |attribute|\n hash = attribute[:players]\n hash.values.each do |h|\n h.select { |k, v| k == :shoe }.sort.max\n return h[:rebounds]\n end\n end\nend", "title": "" }, { "docid": "1e25ee45934ce36976abade3e0e3a6b3", "score": "0.57644564", "text": "def mostPoints\n players.max_by do|name, stats|\n stats[:points]\n end\nend", "title": "" }, { "docid": "f845dbee2ba2b56b8a39fb77771fda23", "score": "0.57632816", "text": "def highest_match_value\n values = @hand.select { |dice| @hand.count(dice) == highest_match_count }\n values.max\n end", "title": "" }, { "docid": "dbb0836aa40d8d7d659431bf1ae0a567", "score": "0.57460356", "text": "def get_largest_freq(freq_arr)\n\tlargest = freq_arr[0][\"value\"]\n\tfor freq in freq_arr\n\t\tif freq[\"value\"] > largest\n\t\t\tlargest = freq[\"value\"]\n\t\tend\n\tend\n\treturn largest.to_s\nend", "title": "" }, { "docid": "c2f0e4fdcc12be11af8d6078af3e7d41", "score": "0.57402486", "text": "def get_hash_max(hash)\n hash.each { |k,v| return k if v == hash.values.max }\nend", "title": "" }, { "docid": "31c5b25440430e33daabd12a4717fb3c", "score": "0.5738974", "text": "def greatest_key_by_val(hash)\n hash.sort_by {|k, v| v}.last.first\nend", "title": "" }, { "docid": "9a7cdaf97d5ab298aa818974c7b5e4e2", "score": "0.5736935", "text": "def driver_with_highest_income(all_rides)\n all_income = total_income_per_driver(all_rides)\n highest_income = all_income.values.max\n driver = all_income.key(highest_income)\n puts \"#{driver} made the most money, earning $#{'%.2f' % highest_income}\"\nend", "title": "" }, { "docid": "7a89900055fa0f6c4129fb11d3dda567", "score": "0.5722892", "text": "def largest_hash_key(hash)\n hash.max_by{|key, value| value}\nend", "title": "" }, { "docid": "2a0382189f32e6c0b95f26b383c3d0ea", "score": "0.57228345", "text": "def big_shoe_rebounds_2\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n\n game_hash.dig(:home, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n\n end\n end\n end\n end\n end\nend\n\n puts highest_rebounds\n return highest_rebounds\nend", "title": "" }, { "docid": "e70453fb02199ac492cf32964df4ecfb", "score": "0.57167053", "text": "def determine_highest_single(array)\n return if array.blank?\n value = -1\n highest = ''\n array.each do |cl|\n if CLASSIFICATIONS.index(cl) > value\n value = CLASSIFICATIONS.index(cl)\n highest = cl\n end\n end\n highest\n end", "title": "" }, { "docid": "1f5f76db38e3952a9563fddd2543c97a", "score": "0.57123667", "text": "def highest_rated\n joins(:ratings).group('rateable_id').order('avg(ratings.value) desc').first\n end", "title": "" }, { "docid": "9fc15360d5057d68dae38d016874226f", "score": "0.57092917", "text": "def greatest_key_by_val(hash)\n hash.each {|key, value| return key if value == hash.values.max}\nend", "title": "" }, { "docid": "7b47f5ee199d944fb730112562e53114", "score": "0.5705155", "text": "def best_option\n ab_test_options.reject { |opt| opt.value_times_rate.nan? }.max_by(&:value_times_rate)\n end", "title": "" }, { "docid": "b46ef94ea755b20df1cc8d02819c7855", "score": "0.57032716", "text": "def highest_price\n menu_items.map {|item| item.price}.max\n end", "title": "" }, { "docid": "ee7445efa840d68a8451cdc72eaf96cc", "score": "0.56989664", "text": "def greatest_key_by_val(hash)\n nested_array = hash.sort_by {|k,v| v}\n nested_array[-1][0]\nend", "title": "" }, { "docid": "77dc13dde2d0ef096faf13b9f2600cdb", "score": "0.5698545", "text": "def get_max_score(list)\n max = list[0].value\n list.each do |l|\n max = l.value if l.value > max\n end\n return max\n end", "title": "" }, { "docid": "03245cd39db9f2666771b0bd8d1e4672", "score": "0.56906724", "text": "def highest_rated(drivers)\n # hash data for the highest rated driver\n highest_earner_data = drivers.max { |a, b| a[:average_rating] <=> b[:average_rating] }\n # extract the driver ID\n highest_rated = highest_earner_data[:driver_id]\n return highest_rated\nend", "title": "" }, { "docid": "158fa0f1692ba076f728edc99b115c9c", "score": "0.5689119", "text": "def greatest_key_by_val(hash)\n sorted_thing = hash.sort_by { |k, v| v }\n sorted_thing[-1][0]\nend", "title": "" }, { "docid": "962650176eb2daf4f431c5bded9b92fe", "score": "0.5689037", "text": "def find_highest_earners(input_arr)\n # look through drivers array to find driver hash with greatest\n # total earnings -> apply max_by to the hash of drivers to find\n # the greatest value associated with the [:total_earn] key\n # -> set max_earn_val to the value identified from the returned\n # max_by hash\n max_earn_val = input_arr.max_by { |k| k[:total_earn] }[:total_earn]\n # p max_earn_val\n # handle multiple top earners\n # create an array that selects driver_hash(es) that match the\n # established max earn value\n top_earn_arr = input_arr.select { |k| k[:total_earn] == max_earn_val }\n .map { |h| h[:driver_id] }\n return top_earn_arr\nend", "title": "" }, { "docid": "a0e7a90285656212465855ed7a2c933e", "score": "0.56885076", "text": "def most_steal\n steals_array = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n steals_array << element[:steals]\n end\n end\n steals_array.max\nend", "title": "" }, { "docid": "3293c30c374c8ec8429a9e80e4bf942a", "score": "0.5670603", "text": "def find_highest_rating(drivers)\n maximum = 0\n max = {}\n driver = \"Default\"\n drivers.each do |driver_data|\n driver_data.each do |driver_id, rides|\n average = find_average_rating(rides)\n if maximum < average\n maximum = average\n driver = driver_id\n end\n end\n max[:driver_id] = driver\n max[:max_rating] = maximum\n end\n return max\nend", "title": "" }, { "docid": "2f7d990a4962a10c4e6dd79eba5a3d57", "score": "0.56689984", "text": "def best_defense\n teams_total_goals_allowed = total_goals_allowed_helper\n teams_total_games = total_games_helper\n\n best_team_goals_allowed_avg = 100\n best_defense_team_id = 0\n this_team_goals_allowed_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals_allowed.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_allowed_avg = (goals_value / games_value.to_f)\n if this_team_goals_allowed_avg < best_team_goals_allowed_avg\n best_team_goals_allowed_avg = this_team_goals_allowed_avg\n best_defense_team_id = games_key\n end\n end\n end\n end\n\n team_with_best_defense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == best_defense_team_id\n team_with_best_defense = team_obj.team_name\n end\n end\n team_with_best_defense\n end", "title": "" }, { "docid": "222f3a6fe83d715718c51fed5400d5b0", "score": "0.5664407", "text": "def most_points_scored_helper\n point_array = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n point_array << element[:point]\n end\n end\n point_array.max\nend", "title": "" }, { "docid": "00ad8dcaa6d3b897b0ee00e1abc6c60e", "score": "0.56426966", "text": "def greatest_key_by_val(hash)\n hash.sort_by { |k, v| v}[-1][0]\nend", "title": "" }, { "docid": "17b2f0314f799069d937a8f09ddb8972", "score": "0.5637017", "text": "def report_fitness_species\n {\n best: nil,\n worst: nil,\n }\n end", "title": "" }, { "docid": "45535fb86b03bec499bf9babf87c338a", "score": "0.56345755", "text": "def most_expensive_painting \n paintings.max_by {|p| p.price}\n end", "title": "" }, { "docid": "b34b2a043aca27f7d147f7186b080950", "score": "0.5633824", "text": "def largest_area_pair(input_array)\n max_pair = nil\n max = 0\n #loop through input_array\n #calculate area at each item \n #compare to max\n #when you find max value, need to pair that matches this value\n #check if input_array is empty\n if input_array.length == 0\n return nil\n end\n \n input_array.each do |item|\n #check if any values in pair are negative\n if (item[0] > 0) && (item[1] > 0)\n area = item[0] * item [1] # 1*2\n if area > max\n max = area\n max_pair = item\n end\n end\n end\n return max_pair\n end", "title": "" }, { "docid": "7c3a7ff74c425ebc7d67dddf367eab71", "score": "0.5633054", "text": "def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end", "title": "" }, { "docid": "4fcbfa63663306591227866518763983", "score": "0.563213", "text": "def highest_predicted_localization\n @score_hash.max{ |a,b|\n a[1] <=> b[1]\n }[0]\n end", "title": "" }, { "docid": "1e13c548288aafc29dc4456a26cef909", "score": "0.56302476", "text": "def max\n if self.root.right_child.nil?\n return {self.root.title => self.root.score}\n else\n recursive_max(self.root.right_child)\n end\n end", "title": "" }, { "docid": "54597afaf65429eea1fbe8ca06d8000a", "score": "0.56261456", "text": "def standard_deviation\n StandardDeviation.new(self)\n end", "title": "" }, { "docid": "ae106ad1348370fd98c1a842a5629541", "score": "0.56231654", "text": "def highest_value\n @values.inject { |highest, val| highest = (val < 21 && val > highest) ? val : highest }\n end", "title": "" }, { "docid": "e59b996891574b7c1bfa8edd434a9325", "score": "0.5617013", "text": "def top_students(grade_hash, number_of_students)\n averages = averages(grade_hash)\n\n result = averages.sort_by do |key, value|\n value\n end\n\n students = result.map do |key, value|\n key\n end\n\n non_reversed = students.last(number_of_students)\n\n reversed = non_reversed.reverse\nend", "title": "" }, { "docid": "0bf6be4607692d4ce746197412684a7d", "score": "0.5605667", "text": "def driver_who_earned_most(earnings_hash)\n driver_who_earned_most = \"\"\n most_earned_so_far = 0\n earnings_hash.each do |driver, total_earnings|\n if total_earnings > most_earned_so_far\n most_earned_so_far = total_earnings\n driver_who_earned_most = driver\n end\n end\n driver_who_earned_most\nend", "title": "" }, { "docid": "c960b2e17e314a7b7b22667bdef99871", "score": "0.559908", "text": "def find_max_cost(all_data)\n all_data.each_pair do |driver, data|\n \n data[:max_cost] = 0\n data[:max_cost_day] = {}\n \n # find max cost before populating the list of days\n # which have that max cost\n data[:cost_per_day].each_pair do |date_of_year, cost_per_day|\n if cost_per_day > data[:max_cost]\n data[:max_cost] = cost_per_day\n end\n end\n data[:cost_per_day].each_pair do |date_of_year, cost_per_day|\n if cost_per_day == data[:max_cost] \n data[:max_cost_day][date_of_year] = cost_per_day\n end\n end\n \n end\n return all_data\nend", "title": "" }, { "docid": "59a0c96d1b7d2bdbeb9c5a955f4b3dbf", "score": "0.55981874", "text": "def greatest_key_by_val(hash)\n hash.sort_by {|k, v| v}[-1][0]\nend", "title": "" }, { "docid": "52af22e6d68272bf452448b6d63e7e85", "score": "0.5589571", "text": "def highest_scoring_visitor\n @teams.max_by { |team| team.average_away_goals }.team_name\n end", "title": "" }, { "docid": "6e8fed8256d033d18d019777d2dbe34d", "score": "0.5586278", "text": "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_avg = 1000\n worst_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_avg = (goals_value / games_value.to_f)\n if this_team_goals_avg < worst_team_goals_avg\n worst_team_goals_avg = this_team_goals_avg\n worst_offense_team_id = games_key\n end\n end\n end\n end\n\n team_with_worst_offense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == worst_offense_team_id\n team_with_worst_offense = team_obj.team_name\n end\n end\n team_with_worst_offense\n end", "title": "" }, { "docid": "2b0ab58340332a64f1d1b2bfbc603b40", "score": "0.55833614", "text": "def most_duplicates\r\n highest = 0\r\n @seminarians.each {|s| highest = s.duplicate_days if s.duplicate_days > highest}\r\n return highest\r\n end", "title": "" }, { "docid": "bdf60ea5fd27b065061c933096f0365a", "score": "0.5580777", "text": "def biggest_investment\n biggest_amount = 0\n funding_instance = 0\n\n funding_rounds.map do |funding| \n if funding.investment > biggest_amount\n biggest_amount = funding.investment\n funding_instance = funding\n end\n end\n\n funding_instance\n end", "title": "" }, { "docid": "f491306910d97441c4444d04a2e0b11b", "score": "0.5576844", "text": "def most_points_scored\n mostPoints[0]\nend", "title": "" }, { "docid": "0f3390929849df0bf391316f124dec12", "score": "0.5573278", "text": "def get_max_value()\n temp = @symtable.values\n temp.keep_if { |x| x.to_i < 16384 }\n temp.max\n end", "title": "" }, { "docid": "67bd8cc0d2087eb33bb59543e050e585", "score": "0.5568094", "text": "def largest_hash_key(hash)\n hash.max_by{|k,v| v}\nend", "title": "" }, { "docid": "fc2ab893cec3c9592e7d7a9220c46ac2", "score": "0.5554797", "text": "def worst_defense\n teams_total_goals_allowed = total_goals_allowed_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_allowed_avg = 0\n worst_defense_team_id = 0\n this_team_goals_allowed_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n\n teams_total_goals_allowed.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_allowed_avg = (goals_value / games_value.to_f)\n if this_team_goals_allowed_avg > worst_team_goals_allowed_avg\n worst_team_goals_allowed_avg = this_team_goals_allowed_avg\n worst_defense_team_id = games_key\n end\n end\n end\n end\n team_with_worst_defense = team_name_finder_helper(worst_defense_team_id)\n\n team_with_worst_defense\n end", "title": "" }, { "docid": "51c4a76a05052b4ef1e5ff109cf81faf", "score": "0.5554735", "text": "def stock_picker(stock_array)\n\n day_hash = Hash.new(0)\n day_index = 0\n stock_array.each { |day_number|\n day_hash[day_index] = day_number\n day_index += 1\n }\n\n day_hash_sell = day_hash.clone\n profit_best = Hash.new(0)\n profit_best_counter = nil\n day_hash.each do |key, value|\n\n buy = -value \n day_hash_sell.each do |key_sell, value_sell|\n\n #ensure day is only in futue\n if key_sell <= key then \n next\n end\n\n profit = buy + value_sell \n if profit_best_counter == nil || profit > profit_best_counter then \n #reset hash to ensure only 1 answer given\n profit_best = Hash.new(0)\n\n #track best days to buy/sell in array\n profit_best[key] = key_sell\n\n #keep track of best profit so far\n profit_best_counter = profit\n end \n end \n end\n puts profit_best\nend", "title": "" }, { "docid": "f0e82d6e50564bf46756b623e4d8c8e4", "score": "0.5553257", "text": "def highest_attack_power_weapon\n weapon = self.weapons.sort_by do |weapon|\n weapon.attack_power\n end.last\n weapon\n end", "title": "" }, { "docid": "16b2e0ebe69334b7aa1c3b5bb23025d3", "score": "0.5552301", "text": "def high_card\n high_value = 0\n @grip.each do |card|\n new_value = FACE_VALUES.find_index(card.value)\n if new_value > high_value\n high_value = new_value\n end\n end\n FACE_VALUES[high_value]\n end", "title": "" }, { "docid": "a91a0e629c93bee09acf2802f5e6632f", "score": "0.55522704", "text": "def best(pop)\r\n\t\t@score_pop = Hash.new\r\n\t\tpop.each do |snek|\r\n\t\t\t@game_snek = Game.new(@display, true, snek)\r\n\t\t\tputs \"[SNEK][DEBUG][best] On joue avec : #{snek}\" if @debug\r\n\t\t\t# On joue jusqu'à la mort\r\n\t\t\t@game_snek.next_frame one_move until @game_snek.game_over?\r\n\r\n\t\t\tputs \"[SNEK][DEBUG][best] Score du snek #{snek.id} : #{@game_snek.score}\" if @debug\r\n\t\t\t# le snek est mort, l'ajouter à la hash map\r\n\t\t\t@score_pop[snek.id] = @game_snek.score\r\n\t\tend\r\n\t\tsickestest_sneks = sickestest pop\r\n\t\treturn sickestest_sneks\r\n\tend", "title": "" }, { "docid": "672c10e88157ea2beb59c38cc618247c", "score": "0.55484337", "text": "def highest_average_rating_method(tallies_array_of_hashes)\n return tallies_array_of_hashes.max_by { |tally_hash| tally_hash[:average_rating] }[:driver_id]\nend", "title": "" }, { "docid": "a06d0dfc681bf4421eb1772af989db8d", "score": "0.55463105", "text": "def worst\n @heap.top\n end", "title": "" }, { "docid": "28262889a55feced7d7e06e52fed2ab1", "score": "0.55390906", "text": "def best\n { bid: best_bid, ask: best_ask }\n end", "title": "" }, { "docid": "f50ffb6ff0ee3feed10998f2c8b0996f", "score": "0.5535868", "text": "def greatest_key_by_val(hash)\n hash.each do |k, v|\n max = hash.values.max\n return k if v == max\n end\nend", "title": "" }, { "docid": "77d34a9dc8347170fa8ad17899bf77d6", "score": "0.55342215", "text": "def stock_picker(array)\n best_days = Hash.new(0)\n\n array.each_with_index do |buy_price, idx1|\n buy_day = idx1\n (idx1 + 1...array.length).each do |idx2|\n sell_day = idx2\n sell_price = array[idx2]\n if buy_price <= sell_price\n best_days[[buy_day, sell_day]] = sell_price - buy_price\n end\n end\n end\n result = greatest_value_in_hash(best_days)\n\n # Days start at 0, wchich is the very first day of the prices\n return \"Best day to buy: #{result[0]}\\nBest day to sell: #{result[1]}\\nProfit: $#{result[2]}\"\nend", "title": "" }, { "docid": "84473e85b560f753f66e817b953531c4", "score": "0.5522344", "text": "def highest_earner(drivers)\n # hash data for the highest earning driver\n highest_earner_data = drivers.max { |a, b| a[:total_earned] <=> b[:total_earned]}\n # extracts the driver ID\n highest_earner = highest_earner_data[:driver_id]\n return highest_earner\nend", "title": "" }, { "docid": "685db27e0e8bd0f0791d6f624004673e", "score": "0.55187774", "text": "def highest_scoring_home_team\n @teams.max_by { |team| team.average_home_goals }.team_name\n end", "title": "" }, { "docid": "95dce4d8db0db6b3cb5582d2ef17626b", "score": "0.5518099", "text": "def largest_hash_key(hash)\n current_highest_id = \"\"\n current_highest = 0\n hash.each do |k,v|\n if v > current_highest\n current_highest = v\n current_highest_id = k\n end\n end\n current_highest_id\n end", "title": "" }, { "docid": "d4959f0a67acb9df18a6a6111a969709", "score": "0.55140513", "text": "def big_shoe_rebounds\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n game_hash.each do |location, team_info|\n game_hash.dig(location, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n end\n end\n end\n end\n end\n end\n end\n puts highest_rebounds\n return highest_rebounds\nend", "title": "" }, { "docid": "52f349fca206d58a9ca7953e2b960e94", "score": "0.5512269", "text": "def worst type = :rmse\r\n\t\tsafeSort(type).last\r\n\tend", "title": "" }, { "docid": "68b99861b9738487f4daabb74a0c95b8", "score": "0.551164", "text": "def highest_ranked(hash)\n max_rank = hash.values.max\n hash.keys.find_all {|cell| hash[cell] == max_rank}\n end", "title": "" }, { "docid": "a1a66cdb10323d4b412132edd4f64942", "score": "0.55098397", "text": "def makeStandardInstanceHash(array_of_detailed_instances, stripped_state_int)\n\tinstanceHash = Hash.new\n\tfor entry in array_of_detailed_instances\n\t\tinst = entry[\"name\"]\n\t\trun = entry[\"run\"]\n\t\tinstanceHash[inst] = {\"runs\"=>0, \"rest\"=>entry[\"rest\"], \"result\"=>[]} unless instanceHash.key?(inst)\n\t\tinstanceHash[inst][\"runs\"] += 1\n\t\tcensortimes = entry[\"resultForState\"][stripped_state_int].keys\n#\t\tp censortimes\n#\t\tp censortimes.max\n\t\tinstanceHash[inst][\"result\"] << entry[\"resultForState\"][stripped_state_int][censortimes.max]\n\tend\n\treturn instanceHash\nend", "title": "" }, { "docid": "eac4a7aeed3912e6653bf93d789e4578", "score": "0.55060196", "text": "def minMax(node)\n hash = { }\n value = []\n for child in node.getChild(@player) ##max è il primo che gioca\n\n\t\n\tutility = min_value(child)\n\t\n \thash[utility] = child\n \tvalue << utility\n\n end\n \n return hash[max_vector(value)]\n \n \n end", "title": "" } ]
20b6b8047c5c729f9103ff19228de1eb
Saves block and figures out the current main chain. For those blocks that get connected to the main chain, extra transaction verification is performed. Vaguely similar to ActivateBestChainStep() in bitcoind.
[ { "docid": "705507c2f5150c175810f076ec17c44c", "score": "0.6260961", "text": "def add_block(block, state)\n start_time = Time.now\n\n mainchain_tip_hash = @storage.mainchain_tip_hash\n thischain_tip_hash = block.prev_block_hex\n\n mainchain_tip = @storage.block_header_for_hash(mainchain_tip_hash)\n thischain_tip = @storage.block_header_for_hash(thischain_tip_hash)\n\n # If the new work does not exceed the main chain work, stash this block away in a \"side branch\".\n # No further validations will be performed.\n if !thischain_tip.is_more_work?(mainchain_tip, block.hash, block.block_work)\n # This can only be possible on the sidechain, so we simply store the block without further validations.\n # Outputs will be validated when/if this block will become a part of the mainchain (see below).\n @storage.load_output_cache(block.tx)\n return persist_block_on_side_branch(block,\n @storage.height_for_block_header(thischain_tip) + 1,\n @storage.total_work_up_to_block_header(thischain_tip))\n end\n\n # New work is greater. Find the common ancestor block to rebuild the chain from there.\n # Scan both chains up to the common (minimum) height.\n # Then scan from there simultaneously until we hit the same hash.\n\n mainchain_ancestor = mainchain_tip\n thischain_ancestor = thischain_tip\n\n block_hashes_to_disconnect = []\n block_hashes_to_connect = []\n\n # 1. Scan each chain until the common min_height\n min_height = [ @storage.height_for_block_header(mainchain_ancestor),\n @storage.height_for_block_header(thischain_ancestor) ].min\n\n while @storage.height_for_block_header(mainchain_ancestor) > min_height\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n end\n\n while @storage.height_for_block_header(thischain_ancestor) > min_height\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # 2. Scan both chains simultaneously until we get to the same common ancestor\n while !(thischain_ancestor == mainchain_ancestor)\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # Finally we arrive at the common ancestor.\n # Now we need to attempt to disconnect old mainchain blocks and connect new thischain blocks.\n common_ancestor = mainchain_ancestor\n\n # 1. Disconnect the blocks on the mainchain to move them into the sidechain\n # We start from the latest hash and move on to the one right before the common ancestor.\n # Most of the time this array is empty, so no blocks are being disconnected.\n block_hashes_to_disconnect.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n if !self.disconnect_block(b, state)\n return false\n end\n end\n end\n\n # 2. Connect the blocks to form the new mainchain.\n # If any block is actually invalid (double-spends some outputs or has an invalid script),\n # this will fail and we would have to abort DB transaction to rollback all changes.\n block_hashes_to_connect.reverse.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(b, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(b)\n @output_cache.flush\n raise ex\n end\n end\n end\n\n measure_method(:add_block, start_time)\n log_raw_block_events(block.hash, \"add_block processing time: #{(Time.now - start_time).to_f}\")\n\n # Connect this new block too.\n @storage.load_output_cache(block.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(block, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(block)\n @output_cache.flush\n raise ex\n end\n end\n\n return true\n end", "title": "" } ]
[ { "docid": "7220c12b4ff517eceb8c58d538b4290c", "score": "0.6777248", "text": "def save_block_on_main_branch(block, height, prev_work = 0)\n @block_index.insert_block(block, height, prev_work)\n !!Toshi::Models::Block.create_from_block(block, height, Toshi::Models::Block::MAIN_BRANCH, @output_cache, prev_work)\n @output_cache.flush\n end", "title": "" }, { "docid": "77f7d5db1fdfbd18cbbb69323085304d", "score": "0.6617685", "text": "def store_block blk\n log.debug { \"new block #{blk.hash}\" }\n\n existing = get_block(blk.hash)\n if existing && existing.chain == MAIN\n log.debug { \"=> exists (#{existing.depth}, #{existing.chain})\" }\n return [existing.depth]\n end\n\n prev_block = get_block(blk.prev_block.reverse_hth)\n unless @config[:skip_validation]\n validator = blk.validator(self, prev_block)\n validator.validate(rules: [:syntax], raise_errors: true)\n end\n\n if !prev_block || prev_block.chain == ORPHAN\n if blk.hash == Bitcoin.network[:genesis_hash]\n log.debug { \"=> genesis (0)\" }\n return persist_block(blk, MAIN, 0)\n else\n depth = prev_block ? prev_block.depth + 1 : 0\n log.debug { \"=> orphan (#{depth})\" }\n return [0, 2] unless (in_sync? || Bitcoin.network_name =~ /testnet/)\n return persist_block(blk, ORPHAN, depth)\n end\n end\n depth = prev_block.depth + 1\n\n checkpoint = @checkpoints[depth]\n if checkpoint && blk.hash != checkpoint\n log.warn \"Block #{depth} doesn't match checkpoint #{checkpoint}\"\n exit if depth > get_depth # TODO: handle checkpoint mismatch properly\n end\n if prev_block.chain == MAIN\n if prev_block == get_head\n log.debug { \"=> main (#{depth})\" }\n if !@config[:skip_validation] && ( [email protected]? || depth > @checkpoints.keys.last )\n if self.class.name =~ /UtxoStore/\n @config[:utxo_cache] = 0\n @config[:block_cache] = 120\n end\n validator.validate(rules: [:context], raise_errors: true)\n end\n res = persist_block(blk, MAIN, depth, prev_block.work)\n push_notification(:block, [blk, *res])\n return res\n else\n log.debug { \"=> side (#{depth})\" }\n return persist_block(blk, SIDE, depth, prev_block.work)\n end\n else\n head = get_head\n if prev_block.work + blk.block_work <= head.work\n log.debug { \"=> side (#{depth})\" }\n return persist_block(blk, SIDE, depth, prev_block.work)\n else\n log.debug { \"=> reorg\" }\n new_main, new_side = [], []\n fork_block = prev_block\n while fork_block.chain != MAIN\n new_main << fork_block.hash\n fork_block = fork_block.get_prev_block\n end\n b = fork_block\n while b = b.get_next_block\n new_side << b.hash\n end\n log.debug { \"new main: #{new_main.inspect}\" }\n log.debug { \"new side: #{new_side.inspect}\" }\n\n push_notification(:reorg, [ new_main, new_side ])\n\n reorg(new_side.reverse, new_main.reverse)\n return persist_block(blk, MAIN, depth, prev_block.work)\n end\n end\n end", "title": "" }, { "docid": "5cd3631aff1b2a4524bf892327388423", "score": "0.65525115", "text": "def persist_block_on_main_branch(block, height, prev_work=0)\n start_time = Time.now\n result = false\n @storage.transaction(auto_savepoint: true) do\n result = @storage.save_block_on_main_branch(block, height, prev_work)\n end\n measure_method(:persist_block_on_main_chain, start_time)\n msg = \"persist_block processing time: #{(Time.now - start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n msg = \"process_block total time: #{(Time.now - @processing_start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n result\n end", "title": "" }, { "docid": "cbeafe2f773b7b23759526ce231b95d6", "score": "0.62977934", "text": "def append_block(block)\n valid = block.transactions.all? do |tx|\n tx.coinbase? || verify_transaction?(tx)\n end\n\n unless valid\n puts \"Verify block failed!\"\n return\n end\n\n pow = ProofOfWork.new(block)\n catch :not_found do\n result = pow.run!\n nonce, hash = result.values_at(:nonce, :hash)\n puts \"Mining done - #{hash}\"\n block.hash = hash\n block.nonce = nonce\n save_block(block)\n\n self.hash = hash\n end\n end", "title": "" }, { "docid": "9e967aedb85da5c49a97565136460bde", "score": "0.61742926", "text": "def connect_block(block, state)\n start_time = Time.now\n\n # Check it again in case a previous version let a bad block in\n if !self.check_block(block, state)\n return false\n end\n\n # Special case for the genesis block, skipping connection of its transactions\n # (its coinbase is unspendable because since the beginning it wasn't included in UTXO index)\n if block.hash == Bitcoin.network[:genesis_hash]\n # We do not store the block as it is already stored early in the processing.\n return true\n end\n\n # Let the storage know about the current block (as it can spent its own transactions)\n # This way, when we request outputs, we'll be able to get them from the current block.\n # This block is reset when transaction completes/rollbacks or when we process another block.\n @storage.current_block = block\n\n # This block may not be stored in the chain yet, so refer to its parent to get the height and add 1.\n height = 1 + @storage.height_for_block(block.prev_block_hex)\n\n # Skip scripts evaluation before the last checkpoint to speed up download process.\n #\n check_scripts = (@execute_all_scripts || @checkpoints_disabled || height >= self.max_checkpoint_height)\n\n # Enforce BIP30 - disallow overwriting transactions that were not completely spent yet.\n if !self.enforce_BIP30(block, height, state)\n return false\n end\n\n # BIP16 (P2SH scripts) didn't become active until Apr 1 2012.\n bip16_switch_time = 1333238400\n strict_p2sh = (block.time >= bip16_switch_time)\n\n # TODO: implement the flags.\n #unsigned int flags = SCRIPT_VERIFY_NOCACHE |\n # (fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE);\n\n verify_dersig = false\n\n # Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded:\n if block.ver >= 3\n prev_block_header = @storage.block_header_for_hash(block.prev_block_hex)\n # if 750 of the last 1,000 blocks are version 3 or greater (51/100 if testnet)\n if ((!is_testnet? && verify_block_version_super_majority(3, prev_block_header, 750, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(3, prev_block_header, 51, 100)))\n # DER signature is required.\n # See: https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki\n verify_dersig = true\n end\n end\n\n # Will count total fees (to verify block balance)\n fees = 0\n\n # Will count signature operations to prevent DoS.\n sigops = 0\n\n block.tx.each do |tx|\n # This is already counted in check_block(), but we have to add P2SH signature counts to it as well.\n # (And P2SH sigops can't be discovered until we actually attempt to connect unspent outputs.)\n sigops += tx.legacy_sigops_count\n\n if sigops > Bitcoin::MAX_BLOCK_SIGOPS\n # DoS 100\n raise BlockValidationError, \"ConnectBlock() : too many sigops\"\n return false\n end\n\n if !tx.is_coinbase?\n # Check if there are unspent outputs for this tx's inputs\n # aka view.HaveInputs() - but with only a view of pcoinsTip.\n if !self.verify_inputs_are_available(tx)\n raise BlockValidationError, \"ConnectBlock() : inputs missing/spent\"\n return false\n end\n\n if strict_p2sh\n # Add in sigops done by pay-to-script-hash inputs;\n # this is to prevent a \"rogue miner\" from creating\n # an incredibly-expensive-to-validate block.\n\n sigops += self.p2sh_sigops_count(tx);\n\n if sigops > Bitcoin::MAX_BLOCK_SIGOPS\n # DoS 100\n raise BlockValidationError, \"ConnectBlock() : too many sigops\"\n return false\n end\n end\n\n # Compute fees:\n # nFees += view.GetValueIn(tx)-tx.GetValueOut();\n\n # Note: we don't validate that each transaction does not spend more than on its inputs.\n # The balances are checked only per-block, so it's possible for some transactions to have negative fees\n # (provided some other transactions in the block have positive fees to compensate for that).\n fees += tx_value_in(tx) - tx_value_out(tx)\n\n # Actually check scripts. See CheckInputs() in bitcoind.\n if !self.check_inputs(block, tx, state, check_scripts, strict_p2sh, include_memory_pool=false, verify_dersig)\n return false\n end\n\n end # not a coinbase\n\n # UpdateCoins - mark inputs as spent and add new outputs as unspent.\n self.update_unspent_outputs(tx)\n\n end # each tx in block\n\n # Verify that coinbase pays no more than fees + block reward.\n coinbase_out_value = tx_value_out(block.tx[0])\n max_value = Bitcoin.block_creation_reward(height) + fees\n if coinbase_out_value > max_value\n # DoS 100\n raise BlockValidationError, (\"ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)\" % [coinbase_out_value, max_value])\n end\n\n measure_method(:connect_block, start_time)\n log_raw_block_events(block.hash, \"ConnectBlock processing time: #{(Time.now - start_time).to_f}\")\n\n # Save the block on \"main branch\"\n self.persist_block_on_main_branch(block, height, @storage.total_work_up_to_block_hash(block.prev_block_hex))\n\n # update outputs and remove txs last as they'll lock the affected rows\n # and block queries for the transaction processor. concurrency is hard.\n\n # This lock protects previous outputs as well.\n # We should take care to make this scope as tight as possible to not\n # unnecessarily block the transaction processor. It is released automatically\n # after the wrapping db transaciton completes\n @mempool.lock\n\n # Optimized method for marking existing outputs in the database in bulk\n @storage.update_outputs_on_connect_block(block)\n\n # mempool.removeForBlock() normally done in ConnectTip()\n @mempool.remove_for_block(block)\n\n # Flush this now\n @output_cache.flush\n\n return true\n end", "title": "" }, { "docid": "b8200f8d771201c1ba144f2b71b6c6f3", "score": "0.6127975", "text": "def process_block_internal(block, raise_errors=false, current_time=nil)\n @current_time = current_time\n @processing_start_time = Time.now\n logger.debug{ \"ProcessBlock(): starting %s\" % [block.hash] }\n\n # Check for duplicate.\n # Bitcoind checks all blocks: mainchain, sidechain, orphans.\n if @storage.is_block_processed?(block.hash)\n b = @storage.processed_block_for_hash(block.hash)\n logger.debug{ \"ProcessBlock() : already have block %s\" % [b.hash] }\n return true\n else\n # Store the raw block for later use.\n # This is not the same as AcceptBlock in bitcoind.\n # In fact, the raw block may already be there before processing because it was received from other nodes.\n @storage.store_raw_block(block)\n end\n\n # This will track the reasons of failure and DoS penalties.\n state = ValidationState.new\n\n # Preliminary checks\n if !check_block(block, state)\n return false\n end\n\n # Load the latest mainchain block\n mainchain_tip_hash = @storage.mainchain_tip_hash\n\n # Checkpoints check.\n # Since we store around orphan blocks, we need at least to check that POW is good relative to the latest checkpoint.\n # - Find the last checkpoint hash *before this block*\n # - Find the block for this hash.\n # - if this block's previous hash is not the current tip or nil, verify against checkpoints:\n # - timestamp should be >= the checkpoint time\n # - minimal possible work since checkpoint should be satisfied\n checkpoint_hash = self.latest_checkpoint_hash\n\n # Only check if this block is not built on top of the current tip.\n if !@checkpoints_disabled && checkpoint_hash && block.prev_block_hex != (mainchain_tip_hash || (\"00\"*32))\n checkpoint_block = @storage.processed_block_for_hash(checkpoint_hash)\n time_delta = block.time - checkpoint_block.time\n if time_delta < 0\n raise BlockValidationError, \"ProcessBlock() : block with timestamp before last checkpoint\"\n end\n\n base_work = Bitcoin.decode_compact_bits(checkpoint_block.bits).to_i(16)\n max_target = compute_min_work(base_work, time_delta)\n\n if block.decimaltarget > max_target\n raise BlockValidationError, \"ProcessBlock() : block with too little proof-of-work\"\n end\n end\n\n # If block is orphan (for which we don't have the parent yet), store it for later use and return true (if stored succesfully)\n # Bitcoind: \"If we don't already have its previous block, shunt it off to holding area until we get it\"\n\n prev_block_valid = @storage.is_block_valid?(block.prev_block_hex)\n if !prev_block_valid\n # If it's a genesis block, simply save it right away\n # In Bitcoind this is saved apriori, AFAIU.\n if block.hash == Bitcoin.network[:genesis_hash]\n log_raw_block_events(block.hash, \"process_block => genesis (0)\")\n return persist_block_on_main_branch(block, 0)\n end\n\n # It is an orphan block.\n # Note: Bitcoind saves it if there's a node to request missing blocks from.\n\n # FIXME: maybe we can drop height support from here as we'd have to update all heights anyway when processing the orphans.\n # If we have a parent (which is also orphan), increase the height relative to the parent.\n # Otherwise, use height 0.\n height = @storage.height_for_block(block.prev_block_hex)\n height = height ? (height + 1) : 0\n\n log_raw_block_events(block.hash, \"process_block => orphan (#{height})\")\n\n # Store orphan and return.\n return persist_orphan_block(block, height)\n end\n\n measure_method(:process_block, @processing_start_time)\n\n # Reorg happens inside if needed.\n if !self.accept_block(block, state)\n # Note: if accept_block raises exceptions, this exception will never be raised.\n raise BlockValidationError, \"ProcessBlock() : AcceptBlock FAILED\"\n return false\n end\n\n return true\n rescue ValidationError, BlockValidationError, TxValidationError => e\n log_raw_block_events(block.hash, e)\n msg = \"process_block total time: #{(Time.now - @processing_start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n raise if raise_errors\n return false\n end", "title": "" }, { "docid": "b81d1e517d733f5a06dc3f1c6053de4b", "score": "0.60714465", "text": "def load_genesis_block\n self.transaction({}) do\n genesis_hash = Bitcoin.network[:genesis_hash]\n if ([:regtest, :mainnet].include?(Bitcoin.network_name) ||\n ![:test].include?(Toshi.env)) &&\n Toshi::Models::Block.head == nil &&\n Toshi::Models::Block.where(hsh: genesis_hash).empty?\n logger.info{ \"Inserting genesis block #{genesis_hash}\" }\n path_to_genesis_block = \"config/blocks/#{genesis_hash}.json\"\n genesis_block = Bitcoin::Protocol::Block.from_json_file(path_to_genesis_block)\n self.save_block_on_main_branch(genesis_block, 0)\n end\n end\n end", "title": "" }, { "docid": "1980a04544940dbe93015e169ea01a0a", "score": "0.59949756", "text": "def append_verified_block(block)\n @chain << block\n @ledger.write(block)\n\n if block.index % BLOCK_REBALANCE_OFFSET == 0\n rebalance_difficulty\n end\n end", "title": "" }, { "docid": "e92ac062bc61d5b69a7ebcd505bd9d00", "score": "0.5793937", "text": "def accept_block(block, state)\n start_time = Time.now\n\n # If it's a genesis block, it was already saved in process_block, nothing to do here.\n # (In fact, this condition should never happen here.)\n if block.hash == Bitcoin.network[:genesis_hash]\n return true\n end\n\n prev_block_header = @storage.block_header_for_hash(block.prev_block_hex)\n\n # Compute new height as height of the previous block + 1.\n new_height = @storage.height_for_block_header(prev_block_header) + 1\n\n # Check for duplicates once again, like in Bitcoind (but not orphans as we may be processing orphan right now)\n if @storage.is_block_valid?(block.hash)\n raise BlockValidationError, \"AcceptBlock() : block already validated\"\n return false\n end\n\n # Check proof of work\n\n if !@debug_skip_proof_of_work_check\n next_bits = self.block_next_bits_required(block)\n if next_bits != block.bits\n if @verbose_logging\n puts \"block #{block.hash} bits: #{block.bits} (required next bits: #{next_bits})\"\n trace_execution_steps do\n self.block_next_bits_required(block)\n end\n end\n raise BlockValidationError, \"AcceptBlock() : incorrect proof of work. Expected: #{next_bits}. Got: #{block.bits}.\"\n end\n end\n\n # Check timestamp against previous blocks\n if block.time <= self.block_median_timestamp_for_block_header(prev_block_header)\n raise BlockValidationError, \"AcceptBlock() : block's timestamp is too early\"\n end\n\n # Check that all transactions are finalized\n block.tx.each do |tx|\n if !self.tx_is_final?(tx, new_height, block.time)\n raise BlockValidationError, \"AcceptBlock() : contains a non-final transaction\"\n end\n end\n\n # Check that the block chain matches the known block chain up to a checkpoint.\n # If this block's height matches the height of a known checkpoint, make sure it's the same block.\n # See Checkpoints::CheckBlock() in bitcoind.\n checkpoint_hash = !@checkpoints_disabled && new_height && Bitcoin.network[:checkpoints][new_height]\n if checkpoint_hash && block.hash != checkpoint_hash\n raise BlockValidationError, \"AcceptBlock() : rejected by checkpoint lock-in at %d\" % [new_height]\n end\n\n # Don't accept any forks from the main chain prior to last checkpoint\n checkpoint_hash = self.latest_checkpoint_hash\n if !@checkpoints_disabled && checkpoint_hash && new_height < self.height_of_checkpoint(checkpoint_hash)\n raise BlockValidationError, \"AcceptBlock() : forked chain older than last checkpoint (height %d)\" % [new_height]\n end\n\n # BIP34 introduced blocks version 2 that contain their height in the coinbase script.\n # https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki\n\n # BIP34 Part 1. Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:\n if block.ver < 2\n if ((!is_testnet? && verify_block_version_super_majority(2, prev_block_header, 950, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(2, prev_block_header, 75, 100)))\n raise BlockValidationError, \"AcceptBlock() : rejected nVersion=1 block #{block.hash}\"\n end\n end\n\n # BIP66: Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:\n if block.ver < 3\n if ((!is_testnet? && verify_block_version_super_majority(3, prev_block_header, 950, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(3, prev_block_header, 75, 100)))\n raise BlockValidationError, \"AcceptBlock() : rejected nVersion=2 block #{block.hash}\"\n end\n end\n\n # BIP34 Part 2. Enforce block.nVersion=2 rule that the coinbase starts with the serialized block height\n if block.ver >= 2\n # if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet)\n if ((!is_testnet? && verify_block_version_super_majority(2, prev_block_header, 750, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(2, prev_block_header, 51, 100)))\n\n if block.bip34_block_height != new_height\n # DoS 100\n raise BlockValidationError, \"AcceptBlock() : block height mismatch in coinbase\"\n end\n end\n end\n\n # Here bitcoind does three things:\n # 1. WriteBlockToDisk - this is already taken care of by RawBlock\n # 2. AddToBlockIndex - here mainchain is determined and the rest of validations is performed.\n # 3. Relay inventory\n # In our case, we need to compute which is the main chain\n # and disconnect/connect blocks while validating individual transactions.\n\n measure_method(:accept_block, start_time)\n log_raw_block_events(block.hash, \"accept_block processing time: #{(Time.now - start_time).to_f}\")\n\n result = false\n begin\n result = self.add_block(block, state)\n rescue ValidationError => ex\n # We didn't completely succeed in connecting the best chain.\n # We may have now partially disconnected the proper main chain.\n # Perform the below to get us back into a correct state.\n activate_best_chain(state)\n # Re-raise.\n raise ex\n end\n\n if result\n # Relay inventory: the peer manager will enforce that we don't send old blocks.\n relay_block_to_peers(block)\n end\n\n return result\n end", "title": "" }, { "docid": "6c101aa63d44d9e9420acc78ab0a30b8", "score": "0.57379967", "text": "def persist_block_on_side_branch(block, height, prev_work=0)\n start_time = Time.now\n result = false\n @storage.transaction(auto_savepoint: true) do\n result = @storage.save_block_on_side_branch(block, height, prev_work)\n end\n msg = \"persist_block processing time: #{(Time.now - start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n msg = \"process_block total time: #{(Time.now - @processing_start_time).to_f}\"\n log_raw_block_events(block.hash, msg)\n result\n end", "title": "" }, { "docid": "7eafb0bc921090838533dc56d22f21c0", "score": "0.5719608", "text": "def save_block(block)\n db.transaction do\n db[:l] = block.hash\n db[block.hash] = block\n db.commit\n end\n block\n end", "title": "" }, { "docid": "4b542e23f217e8b6e21ddb5556fb845f", "score": "0.56902593", "text": "def add_block(new_block, blockchain)\n blockchain.push(new_block) if valid_new_block?(new_block, latest_block(blockchain))\n end", "title": "" }, { "docid": "fb874e7cb33083b8d76c222f4119df07", "score": "0.5627782", "text": "def add_genesis_block\n\t\tself.add_transaction( to: GENESIS_WALLET, from: GENESIS_WALLET, amount: INITIAL_AMOUNT )\n\t\tsuper\n\tend", "title": "" }, { "docid": "310982e23d3f51bc19a1399d76c5ad60", "score": "0.56141585", "text": "def validate_block_chain()\r\n\t\t# exits if file doesn't exist\r\n\t\tif not File.exist? @path\r\n\t\t\tputs 'The file does not exist, the program will exit' ; exit \r\n\t\tend\r\n\r\n\r\n\t\tfirst_line = File.open(@path).first\r\n\t\t# first line block number must be 0, and must only have one transaction\r\n\t\tfirst_block = parse_info(first_line)\r\n\t\ts, e = validate_first_block(first_block)\r\n\t\tif not s\r\n\t\t\tputs \"Line 0: #{e}\"\r\n\t\t\tputs \"BLOCKCHAIN INVALID\"\r\n\t\t\texit()\r\n\t\tend\r\n\r\n\t\t# update the values\r\n\t\t@prev_hash = first_block['self_hash']\r\n\r\n\t\tFile.readlines(@path).drop(1).each.with_index do |line, line_num|\r\n\t\t\t# line_num will be used to check the block number\r\n\t\t\t# line_num + 1 == block number\r\n\r\n \t\t\tblock = parse_info(line)\r\n \t\t\ts, e = validate_block(block, line_num + 1)\r\n \t\t\tif not s\r\n\t\t\t\tputs \"Line #{line_num + 1}: #{e}\"\r\n\t\t\t\tputs \"BLOCKCHAIN INVALID\"\r\n\t\t\t\texit()\r\n\t\t\tend\r\n\r\n\t\t\t# update the values\r\n\t\t\t@prev_hash = block['self_hash']\r\n\r\n\t\tend\r\n\r\n\t\treturn nil\r\n\tend", "title": "" }, { "docid": "7696230a391ac10b97ee1dc0f3692512", "score": "0.55563456", "text": "def initialize_block\n unless latest_block\n block = Bitcoin.chain_params.genesis_block\n genesis = ChainEntry.new(block.header, 0)\n db.save_entry(genesis)\n end\n end", "title": "" }, { "docid": "cd1db9233412cf8cf456486606244211", "score": "0.5547668", "text": "def save!\n if save\n true\n else\n fail 'InvalidWallet'\n end\n end", "title": "" }, { "docid": "4d4135eb4d3309293081de7e94c91c65", "score": "0.5392508", "text": "def create_block prev, store = true, tx = [], key = @key, coinbase_value = 50e8, opts = {}\n key ||= Bitcoin::Key.generate\n opts[:bits] ||= Bitcoin.network[:proof_of_work_limit]\n block = build_block(Bitcoin.decode_compact_bits(opts[:bits])) do |b|\n b.time opts[:time] if opts[:time]\n b.prev_block prev\n b.tx do |t|\n t.input {|i| i.coinbase }\n t.output {|o| o.value coinbase_value; o.script {|s| s.recipient key.addr } }\n end\n tx.each {|cb| b.tx {|t| cb.call(t) } }\n end\n @store.store_block(block) if store\n block\nend", "title": "" }, { "docid": "6d777a9eff28a81017d3c96c0016d480", "score": "0.5382307", "text": "def new_block(amount, payer, payee, key_private)\r\n timestamp = Time.now.to_i\r\n signature = sign_block(key_private, Time.now)\r\n if ($blockchain.length == 0)\r\n prev_hash = \"0000000000000000000000000000000000000000000000000000000000000000\" # If First Block, No Previous Hash So 64 Zeroes Default\r\n else\r\n prev_hash = $blockchain[$blockchain.length-1].hash # Hash Of Previous Block\r\n end\r\n blob = amount.to_s + payer.to_s + payee.to_s + timestamp.to_s + prev_hash.to_s\r\n begin\r\n if ($blockchain.length > 0) # Send To All Miners If Not Genesis Block\r\n $peers.length.times do |i|\r\n Thread.new { Faraday.post(\"#{URL}:#{$peers[i].port}/mine_block\", amount: amount, payer: payer, payee: payee, timestamp: timestamp, signature: signature, prev_hash: prev_hash) if ($peers[i].port != payer) }\r\n end\r\n else # Send To First Port If Genesis Block\r\n Faraday.post(\"#{URL}:1801/mine_block\", amount: amount, payer: payer, payee: payee, timestamp: timestamp, signature: signature, prev_hash: prev_hash)\r\n end\r\n rescue\r\n # Miner Never Sent Response (Do Nothing)\r\n end\r\nend", "title": "" }, { "docid": "9c0c1692701f4df6322e2cb242bd84d6", "score": "0.536416", "text": "def activate_best_chain(state)\n mostwork_tip_hash = @storage.mostwork_tip_hash\n mainchain_tip_hash = @storage.mainchain_tip_hash\n return unless mostwork_tip_hash\n\n while mostwork_tip_hash != mainchain_tip_hash\n block = @storage.valid_block_for_hash(mostwork_tip_hash)\n self.add_block(block, state)\n mostwork_tip_hash = @storage.mostwork_tip_hash\n mainchain_tip_hash = @storage.mainchain_tip_hash\n end\n end", "title": "" }, { "docid": "60018f14d78f3f86e824a2ff10b440da", "score": "0.5330401", "text": "def save(&block)\n returning = yield if block_given?\n Taco.storage.save\n returning\n end", "title": "" }, { "docid": "1d8763f034ac5147ad826180d28ece44", "score": "0.5297081", "text": "def commit(&block)\n autosave = @autosave\n @autosave = false\n result = nil\n\n reload\n\n begin\n result = block.call\n save\n rescue\n reload\n raise\n ensure\n @autosave = autosave\n end\n\n result\n end", "title": "" }, { "docid": "9bbe069dde8687f8789840e576dac75d", "score": "0.5268839", "text": "def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend", "title": "" }, { "docid": "07058072afa3c3a8f06dd9013c4f73a7", "score": "0.52287686", "text": "def check_block(block, state, check_pow=true, check_merkle_root=true)\n # These are checks that are independent of context that can be verified before saving an orphan block.\n start_time = Time.now\n\n # Size limits\n if (block.tx.empty? || block.tx.size > Bitcoin::MAX_BLOCK_SIZE ||\n (block.payload || block.to_payload).bytesize > Bitcoin::MAX_BLOCK_SIZE)\n raise BlockValidationError, \"CheckBlock() : size limits failed\"\n end\n\n # Check proof of work matches claimed amount\n if check_pow && !check_proof_of_work(block)\n raise BlockValidationError, \"CheckBlock() : proof of work failed\"\n end\n\n # Check timestamp\n if block.time > (@current_time || (NodeTime.adjusted_time + 7200)) # 7200 == 2*60*60\n raise BlockValidationError, \"CheckBlock() : block timestamp too far in the future\"\n end\n\n # First transaction must be coinbase, the rest must not be\n if !block.tx.first.is_coinbase?\n raise BlockValidationError, \"CheckBlock() : first tx is not coinbase\"\n end\n\n # Other transactions must not be coinbases.\n if block.tx[1..-1].any?{|tx| tx.is_coinbase? }\n raise BlockValidationError, \"CheckBlock() : more than one coinbase\"\n end\n\n # Check individual transactions\n block.tx.each do |tx|\n if !check_transaction(tx, state)\n return false\n end\n end\n\n # Check for duplicate txids. This is caught by ConnectInputs(), but catching it earlier avoids a potential DoS attack:\n txids = block.tx.map{|tx| tx.hash }\n if txids.size != txids.uniq.size\n raise BlockValidationError, \"CheckBlock() : duplicate transaction\"\n end\n\n # Check sigops: there's a limit of signature operations per block.\n sigops = 0\n block.tx.each do |tx|\n sigops += tx.legacy_sigops_count\n end\n if sigops > Bitcoin::MAX_BLOCK_SIGOPS\n raise BlockValidationError, \"CheckBlock() : out-of-bounds signature operations count\"\n end\n\n # Check merkle root\n if check_merkle_root && !block.verify_mrkl_root\n raise BlockValidationError, \"CheckBlock() : hashMerkleRoot mismatch\"\n end\n\n msg = \"CheckBlock processing time: #{(Time.now - start_time).to_f}\"\n\n measure_method(:check_block, start_time)\n log_raw_block_events(block.hash, msg)\n true\n end", "title": "" }, { "docid": "95b5d545251bc4173b43fcf30d17af4c", "score": "0.52222", "text": "def block_save_with_params params\n\t\t\t\tassign_attributes_with_params params\n\n\t\t\t\tblock_assign_with_params params[:block]\n\n\t\t\t\tother_params = {\n\t\t\t\t\tis_full: true,\n\t\t\t\t\tis_pending: true\n\t\t\t\t}\n\n\t\t\t\tother_params[:status] = 'unavailable' if self.new_record?\n\n\t\t\t\tassign_attributes other_params\n\n\t\t\t\tif block_floor_id_changed?\n\t\t\t\t\t_re_descriptions = BlockFloorSurfaceRealEstateDescription.where real_estate_id: id\n\n\t\t\t\t\t_re_descriptions.each do |_re_description|\n\t\t\t\t\t\tBlockFloorSurfaceDescription.where(id: _re_description.block_floor_surface_description_id).update_all(description_type: nil)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif save validate: false\n\t\t\t\t\t{ status: 0 }\n\t\t\t\telse \n\t\t\t\t\t{ status: 3, result: errors.full_messages }\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "0b1c863ad695acde4619a6fb62d32f21", "score": "0.520615", "text": "def post_transaction_process\n bet_wallet.persist_wallet!\n end", "title": "" }, { "docid": "d42fd156691cf94ef9a46852c1cabea8", "score": "0.52029824", "text": "def validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n puts \"Validating Block From #{payer}...\".blue\r\n error = \"\"\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n peer = search_peers_by_port(payer)\r\n if (peer != -1)\r\n if (validate_signature(peer.key_public, signature, timestamp))\r\n if $blockchain.length == 0\r\n return true\r\n else\r\n if (peer.balance.to_f >= amount.to_f)\r\n prev_block = $blockchain[$blockchain.length - 1]\r\n prev_block_hash = Digest::SHA256.new.hexdigest(prev_block.amount.to_s + prev_block.payer.to_s + prev_block.payee.to_s + prev_block.miner.to_s + prev_block.timestamp.to_s + prev_block.signature.to_s + prev_block.prev_hash.to_s + prev_block.nonce.to_s)\r\n if (prev_hash == prev_block_hash)\r\n return true\r\n else\r\n error = \"Previous Hash = #{prev_hash}\\nThis Block Has #{prev_block_hash}, Not Matching.\"\r\n end\r\n else\r\n error = \"Payer doesn't have enough Swincoins.\"\r\n end\r\n end \r\n else\r\n error = \"Wrong Signature.\"\r\n end\r\n else\r\n error = \"Peer Not Found.\"\r\n end\r\n else\r\n error = \"Hash #{hash} Not Nonced, no Proof of Work Found.\"\r\n end\r\n # If Payer Sends Invalid Block, Add Them To Rogue List\r\n puts \"INVALID BLOCK... BLACKLISTING PEER #{payer}\".red\r\n puts error.red\r\n $status = \"INVALID BLOCK... BLACKLISTING PEER #{payer} because #{error}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n return false\r\nend", "title": "" }, { "docid": "3cb8ac25924514e2277785823d847611", "score": "0.51942503", "text": "def valid_chain(chain)\n last_block = chain[0]\n current_index = 1\n\n while current_index < chain.length\n block = chain[current_index]\n puts \"Last Block: #{last_block}\"\n puts \"Block: #{block}\"\n puts \"\\n====================\\n\"\n\n # Check if the hash of the block is correct\n return false if block[:hash] != hash(last_block)\n\n # Check that the proof of work is correct\n return false if valid_proof(last_block[:proof], block[:proof])\n\n last_block = block\n current_index += 1\n end\n\n # All blocks in the chain are valid\n return true\n end", "title": "" }, { "docid": "1e98da1a50d209c843a54a6cc4a9de8b", "score": "0.51646185", "text": "def validate(new_block)\n previous_block = find_block_by_height(new_block.height - 1)\n\n # 1. Height.\n if previous_block&.height.to_i + 1 != new_block.height.to_i\n raise \"Height isn't valid\"\n end\n\n if previous_block.nil? == false\n # 2. Previous block hash\n if previous_block.block_header_hash != new_block.previous_block_header_hash\n raise \"Previous block header hash is wrong\"\n end\n\n # 2. Time: Can't be before the previous block.\n if previous_block.time > new_block.time\n raise \"New block can't have been created before the previous one\"\n end\n end\n\n # 3. Transactions: Wallets should only spend fund they own.\n new_block.transactions.each do |transaction|\n if WalletTransfer.find(transaction[\"id\"]).nil? == false\n raise \"A transaction with the same ID already exists on the blockchain\"\n end\n\n case transaction[\"message\"][\"type\"]\n when \"funds_transfer\"\n if valid_cryptography?(transaction) == false\n raise \"Cryptography of the transaction is invalid\"\n end\n\n # The amount + fee needs to be available to the wallet.\n if address_has_enough_funds?(transaction[\"message\"]) == false\n raise \"From address doesn't have enough funds\"\n end\n\n when \"mining_reward\"\n fees = new_block.transactions.reject { |t| t[\"message\"][\"type\"] == \"mining_reward\" }\n .map { |t| BigDecimal(t[\"message\"][\"fee\"]) }\n .reduce(&:+) || BigDecimal(0)\n\n mining_reward = BigDecimal(transaction[\"message\"][\"amount\"])\n if mining_reward != fees + 1\n raise \"Mining reward amount is invalid (#{mining_reward.to_s(\"F\")})\"\n end\n end\n end\n\n # 4. There should be exactly one mining reward transaction.\n mining_rewards = new_block.transactions.reject { |t| t[\"message\"][\"type\"] != \"mining_reward\" }\n if mining_rewards.size != 1\n raise \"Unexpected amount of mining rewards\"\n end\n\n # 5. Merkle tree root: Should be valid.\n merkle_root = MerkleTree.new(*new_block.transactions.map(&:to_json).sort { |a, b| a[\"id\"] <=> b[\"id\"] }).root.value\n if new_block.merkle_root != merkle_root\n raise \"Merkle root is invalid\"\n end\n\n # 6. Block hash: Is it valid and is the level of difficulty what's expected.\n if new_block.compute_block_header_hash != new_block.block_header_hash\n raise \"Block header hash is invalid\"\n end\n\n if new_block.block_header_hash[0, DIFFICULTY_LEVEL] != \"0\" * DIFFICULTY_LEVEL\n raise \"Block doesn't match expected difficulty level\"\n end\n end", "title": "" }, { "docid": "e7d9939e4f3c78628517078d55214b79", "score": "0.51423323", "text": "def save_orphan_block(block, height = 0)\n !!Toshi::Models::Block.create_from_block(block, height, Toshi::Models::Block::ORPHAN_BRANCH, @output_cache)\n @output_cache.flush\n end", "title": "" }, { "docid": "6cc3ba9d0c3e7f8275124badce3e28f6", "score": "0.51321673", "text": "def new_block(proof, previous_hash = hash(last_block))\n block = {\n index: chain.length + 1,\n timestamp: Time.now.to_i,\n transactions: current_transactions,\n proof: proof,\n previous_hash: previous_hash,\n }\n\n # Reset the current transactions\n @current_transactions = []\n\n # Add block to the chain\n chain << block\n\n block\n end", "title": "" }, { "docid": "e59f4446ef918c921960c639024f5396", "score": "0.51046246", "text": "def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end", "title": "" }, { "docid": "5fa2c4934b8086a2f7ee97356e110347", "score": "0.5095836", "text": "def after_save(&block)\n after_saves << block\n end", "title": "" }, { "docid": "7dc6b0cdc49683fb5dd9597f8ed7c428", "score": "0.50896704", "text": "def add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, broadcast)\r\n hash = Digest::SHA256.new.hexdigest(amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s + nonce.to_s)\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES)) # Hash Is Valid\r\n block = Block.new(amount.to_f, signature.to_i, timestamp.to_i, prev_hash.to_s, nonce.to_i, hash.to_s, payer.to_i, payee.to_i, miner.to_i)\r\n $blockchain << block\r\n broadcast_block(block) if (broadcast)\r\n puts $blockchain.length.to_s.green\r\n Thread.new { calc_net_worth } # Calculates net worth of all peers\r\n else\r\n puts \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\".red\r\n $status = \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n end\r\nend", "title": "" }, { "docid": "b48e9d7f6bfa6ebc5a380ee9a4682812", "score": "0.5077051", "text": "def new_block(proof, previous_hash = nil)\n block = {\n index: @chain.length + 1,\n epoch: Time.now.utc.to_f,\n transactions: @current_transactions,\n cost: @current_transactions.length - 1,\n proof: proof,\n previous_hash: previous_hash || Blockchain.hash(@chain.last)\n }\n @current_transactions = []; @chain << block; block\n end", "title": "" }, { "docid": "c0832c6865eff7c48be5a7c70cef8466", "score": "0.5067863", "text": "def save(&block)\n block = nil if redirecting_to_facebook?\n super(&block)\n end", "title": "" }, { "docid": "660651fe2a9f9458569b0feb4e29110d", "score": "0.5010195", "text": "def store_raw_block(block)\n payload = block.payload || block.to_payload\n if Toshi::Models::RawBlock.where(hsh: block.hash).empty?\n Toshi::Models::RawBlock.new(hsh: block.hash, payload: payload).save\n end\n end", "title": "" }, { "docid": "74fcfbebc0e211d47ba1ceea6195092f", "score": "0.50007653", "text": "def record_wallet_transfer(block, transaction)\n WalletTransfer.new(\n id: transaction[\"id\"],\n from_address: transaction[\"message\"][\"from\"] && Digest::SHA256.hexdigest(transaction[\"message\"][\"from\"]),\n destination_address: transaction[\"message\"][\"destination\"],\n amount: transaction[\"message\"][\"amount\"],\n fee: transaction[\"message\"][\"fee\"],\n block_height: block.height,\n ).insert\n end", "title": "" }, { "docid": "30f8c12c9a92290f4df6addee3b0fb9d", "score": "0.4988114", "text": "def test_example\n\n b0 = Block.first( 'Genesis' )\n b1 = Block.next( b0, 'Transaction Data...' )\n b2 = Block.next( b1, 'Transaction Data...', 'Transaction Data...' )\n b3 = Block.next( b2 ) ## no transaction data\n b4 = Block.next( b3, ['Transaction Data...', 'Transaction Data...'] )\n\n blockchain = [b0, b1, b2, b3, b4]\n\n pp blockchain\n\n assert true ## (for now) everything ok if we get here\nend", "title": "" }, { "docid": "194d7d185e8cd3b109b61bbeca543bd0", "score": "0.4960673", "text": "def save_block_and_gradeable(week, block, i)\n block['week_id'] = week.id\n block['order'] = i\n\n if block.key?('graded') && block['graded']\n gradeable_params = {\n points: block['points'] || 10,\n gradeable_item_type: 'block',\n title: ''\n }\n end\n\n attr_keys_to_skip = %w(if unless graded points)\n block_params = block.except(*attr_keys_to_skip)\n block = Block.create(block_params)\n\n return if gradeable_params.nil?\n\n gradeable_params['gradeable_item_id'] = block.id\n gradeable = Gradeable.create(gradeable_params)\n block.update(gradeable_id: gradeable.id)\n end", "title": "" }, { "docid": "c0cceb04e97a10c842839ecf997697c2", "score": "0.49579337", "text": "def update_outputs_on_connect_block(block)\n spent_output_ids, unspent_output_ids = [], []\n block.tx.each do |tx|\n if !tx.is_coinbase?\n tx.inputs.each do |txin|\n if output = self.output_from_model_cache(txin.prev_out, txin.prev_out_index)\n spent_output_ids << output.id\n end\n end\n end\n tx.outputs.each_with_index do |txout, index|\n if output = self.output_from_model_cache(tx.binary_hash, index)\n unspent_output_ids << output.id\n end\n end\n end\n\n mark_outputs_as_unspent(unspent_output_ids, on_disconnect=false) if unspent_output_ids.any?\n mark_outputs_as_spent(spent_output_ids) if spent_output_ids.any?\n end", "title": "" }, { "docid": "18f81012ffeb55875f88e9e46ddce6d3", "score": "0.49531353", "text": "def create\n @block = @site.blocks.build(params[:block])\n @block.user_id = current_user.id\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(one_table_blocks_path(@one_table)) }\n format.xml { render :xml => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1feffedc90870b1ef85f2d5be33a326", "score": "0.4939327", "text": "def save(wallet)\n db.transaction do\n db[wallet.address] = wallet\n end\n end", "title": "" }, { "docid": "79b5d63a43140dccc11c129c3c02c71f", "score": "0.49362814", "text": "def save!\n raise Glueby::Contract::Errors::TxAlreadyBroadcasted if @txid\n\n @tx = create_tx(@wallet, @prefix, Tapyrus.sha256(@content), @fee_provider)\n @txid = @wallet.internal_wallet.broadcast(@tx)\n end", "title": "" }, { "docid": "e38dca901cf36555e56258e4d6a4759a", "score": "0.49303368", "text": "def validate_block(block)\n raise InvalidBlockError.new('invalid header') unless @header_chain.valid?(block.header)\n # valid ommers\n raise InvalidBlockError.new('ommers blocks can not more than 2') if block.ommers.size > 2\n block.ommers.each do |ommer|\n unless is_kin?(ommer, get_block(block.header.parent_hash), 6)\n raise InvalidBlockError.new(\"invalid ommer relation\")\n end\n end\n\n parent_header = @header_chain.get_header(block.header.parent_hash)\n state = State.new(store, state_root: parent_header.state_root)\n evm = EVM.new(state: state, chain: self, fork_schema: @fork_config.choose_fork(block.header.number))\n # valid transactions and gas\n begin\n receipts = evm.transition(block)\n rescue EVM::InvalidTransition => e\n raise InvalidBlockError.new(e.message)\n end\n\n # verify state root\n if evm.state_root != block.header.state_root\n error(\"incorrect state_root, evm: #{Utils.hex evm.state_root}, header: #{Utils.hex block.header.state_root} height: #{block.header.number}\")\n raise InvalidBlockError.new(\"incorrect state_root\")\n end\n\n # verify receipts root\n trie = Trie.new\n receipts.each_with_index do |r, i|\n trie[RLP.encode(i)] = RLP.encode(r)\n end\n\n if trie.root_hash != block.header.receipts_root\n raise InvalidBlockError.new(\"incorrect receipts_root\")\n end\n\n # verify state root\n trie = Trie.new\n block.transactions.each_with_index do |t, i|\n trie[RLP.encode(i)] = RLP.encode(t)\n end\n\n if trie.root_hash != block.header.transactions_root\n raise InvalidBlockError.new(\"incorrect transactions_root\")\n end\n end", "title": "" }, { "docid": "c1823241daaf104d37e2a1268f92a847", "score": "0.49204957", "text": "def create\n @block = Block.new(block_params)\n\n respond_to do |format|\n if @block.save\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render :show, status: :created, location: @block }\n else\n format.html { render :show }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6960a5b358d1e442628a88ca9a5b854", "score": "0.4901227", "text": "def save\n save_last_keychain_id!\n end", "title": "" }, { "docid": "8f90611cdbb02cf1f8d8998f65db4d9e", "score": "0.48878893", "text": "def ver_ledger()\n get_chain()\n Verify.chain($blockchain)\nend", "title": "" }, { "docid": "e9794aa03fb85eb3096c7e50fb5b8fee", "score": "0.48534942", "text": "def after_save(&block)\n @hooks ||= {}\n @hooks[\"after_save\".to_sym] = block\n end", "title": "" }, { "docid": "1aa59861b864c5990fb17afbe3490e9d", "score": "0.4850324", "text": "def create\n\t\t@block = Block.new(block_params)\n\n\t\tif @block.save\n\t\t\tredirect_to blocks_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\n\tend", "title": "" }, { "docid": "976db549c99e71e19a1a94fd911e5b47", "score": "0.483671", "text": "def add_block\n @user = User.current\n @user.pref.add_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end", "title": "" }, { "docid": "9a067c4caa8decbbf99e9bb057847f1d", "score": "0.4830212", "text": "def update_from_blockchain\n # Originally this simply compared current time with order expiry time to decide whether order had expired.\n # The problem with that, is a situation can occur when someone pays before expiry but a problem prevents this\n # routine from running and checking for payment until after expiry.\n # That would result in the order being marked as expired even though payment was received before the expiry time.\n # Therefore, getreceivedbyaddress_at_time() function added to lib/bitcoinrpc.rb to look at the block time the payment(s) got their first confirmation.\n # If the payment(s) got their first confirmation before the expiry time then that is sufficient to avoid expiring.\n # It is possible for the required number of confirmations to occur after expiry time but the order will still be marked as paid\n # provided all the payment(s) got their first confirmation before expiry time. The RPC doesn't easily allow finding the specific\n # block time that a transaction received N confirmations but can easily see when it got one confirmation.\n if payment_method.is_bitcoin?\n rpc = Market_bitcoinrpc\n elsif payment_method.is_litecoin?\n rpc = Market_litecoinrpc\n else\n raise\n end\n confirmations = Rails.configuration.blockchain_confirmations\n expire_at = created_at + Rails.configuration.expire_unpaid_order_duration\n receivedbtc_before_expiry = rpc.getreceivedbyaddress_at_time(btc_address.address, confirmations, expire_at)\n receivedbtc = rpc.getreceivedbyaddress(btc_address.address, confirmations)\n receivedbtc_with_unconfirmed = rpc.getreceivedbyaddress(btc_address.address, 0)\n payments_pending_confirmation = receivedbtc_with_unconfirmed - receivedbtc # any payments that don't have sufficient number of confirmations.\n ScriptLog.info(\"order_id: #{id}, addr: #{btc_address.address} [#{payment_method.code}] receivedbtc_before_expiry: #{receivedbtc_before_expiry}, receivedbtc: #{receivedbtc}\")\n\n # It is possible for a blockchain re-org to cause a balance to reduce. Also if you have confirmations set at zero, the customer may\n # send a payment greater than required, but another smaller payment is the one that gets confirmed in a block, with the first larger payment being discarded.\n # This has happened before where the order was marked paid and payment_received had a much bigger value than what was actually received.\n # The situation is only a problem if balance reduces after order state progressed\n # to/past PAID or EXPIRED because the vendor may ship unpaid product or in case of expired, the buyer could be refunded more than what they paid.\n # In this unusual scenario, lock the order readonly and don't process any payouts of locked orders in order payouts api code.\n # Vendor should be made aware that order is now locked so they don't ship. This is done in views with message saying locked.\n # Admin has a button to unlock orders.\n # If erroneous results are being received from RPC and orders locking, read comment in update_orders_from_blockchain.rb for possible reasons.\n if receivedbtc < payment_received && status != PAYMENT_PENDING && locked == false\n ScriptLog.warn(\"WARNING order_id #{id} balance reduced. Locking order.\")\n update!(locked: true)\n elsif locked == false\n # Whenever order's payment_received is being updated, log the change. Sometimes receivedbtc can go from non-zero to zero and want this logged.\n if receivedbtc != payment_received\n ScriptLog.info(\"order_id #{id} [#{payment_method.code}] balance changed #{btc_address.address}: #{payment_received} -> #{receivedbtc}\")\n end\n\n # Regardless of current state, ensure we update however much was paid because more payments might come in.\n # payment_unconfirmed becomes 0 when payments have sufficient confirmations.\n update!(payment_received: receivedbtc, payment_unconfirmed: payments_pending_confirmation)\n\n # Payments received after expiry need to be refunded. Not interested in handling additional payments received to the order after refund already processed.\n # This should be the only case where an OrderPayout btc_amount changes after creation.\n if status == EXPIRED && receivedbtc > 0 && !buyer_payout.paid\n self.buyer_payout.update!(btc_amount: receivedbtc)\n end\n\n if status == PAYMENT_PENDING\n if receivedbtc_before_expiry >= btc_price\n update_status_paid()\n else\n # We haven't (yet) received sufficient payment before the expiry time.\n if created_at < Time.now - Rails.configuration.expire_unpaid_order_duration\n # The current time is past the expiry time on the order.\n update!(status: EXPIRED)\n ScriptLog.info(\"order_id #{id} is now EXPIRED #{btc_address.address}:#{payment_received}\")\n else\n # Leave it in same state.\n ScriptLog.info(\"order_id #{id} unchanged - status: #{status}\")\n end\n end\n end\n end\n end", "title": "" }, { "docid": "441320cd992325ec95236c0809262994", "score": "0.48263976", "text": "def update_blocks!\n RevisionRegister.new(page, user: author, blocks_attributes: page.blocks_attributes).save!\n\n assign_blocks\n page.save!\n end", "title": "" }, { "docid": "868017c7f18d35b5cfbfe71f60f3f950", "score": "0.47990903", "text": "def test_valid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch77\")\n\n assert_equal 1, block.is_valid\n end", "title": "" }, { "docid": "f2f8b4a8591453d1a921a73a32f20f51", "score": "0.4797093", "text": "def latest_block(blockchain)\n blockchain[-1]\n end", "title": "" }, { "docid": "c216eb19484fef5b35b20604a8cf2d3e", "score": "0.4790245", "text": "def save!(private_key)\n bitcoin.sendrawtransaction to_signed_tx(private_key)\n end", "title": "" }, { "docid": "ac22c822367c3fde7f9438d4dc655191", "score": "0.4781168", "text": "def persist_block(blk)\n raise \"Not implemented\"\n end", "title": "" }, { "docid": "1a71dc592237eefe9e117b931710528b", "score": "0.47774467", "text": "def attach_checkout_wallet\n CheckoutWallet.pew(self)\n end", "title": "" }, { "docid": "1f775d9f69a4d184940a4f8f6140cdcf", "score": "0.4764541", "text": "def validate_block(block)\n # check block ready conditions\n # 1. parent block must already be accepted.\n parent_block = get_block(block.parent_hash)\n raise BlockNotReadyError.new(\"can't find parent block by hash #{block.parent_hash.to_hex}\") unless parent_block\n # TODO 2. pow_chain_ref block must already be accepted.\n # 3. local time must greater or equal than minimum timestamp.\n unless (local_timestamp = Time.now.to_i) >= (minimum_timestamp = genesis_time + block.slot_number * SLOT_DURATION)\n raise BlockNotReadyError.new(\"local_timestamp(#{local_timestamp}) must greater than or equal with minimum_timestamp(#{minimum_timestamp})\")\n end\n end", "title": "" }, { "docid": "a450a639304073c9da75d49145e1c59b", "score": "0.4744757", "text": "def transfer_swincoin(amount, payer, payee, key_private)\r\n payer_peer = search_peers_by_port(payee)\r\n if (payer_peer != -1)\r\n new_block(amount, payer, payee, key_private)\r\n else\r\n puts \"Transaction failed. The payee port does not exist!\".red\r\n $status = \"Transaction failed. The payee port does not exist!\"\r\n end\r\nend", "title": "" }, { "docid": "867a1f0d241afb14dee1bf2514dba797", "score": "0.47445345", "text": "def get_genesis_block\n log.info { \"Asking for genesis block\" }\n pkt = Protocol.getdata_pkt(:block, [Bitcoin::network[:genesis_hash].htb])\n send_data(pkt)\n end", "title": "" }, { "docid": "440984fe04adc73ae2942c6bb9093696", "score": "0.47382018", "text": "def create\n @block = Block.new(block_params)\n\n respond_to do |format|\n if @block.save\n format.html { redirect_to @block, notice: 'Block was successfully created.' }\n format.json { render :show, status: :created, location: @block }\n else\n format.html { render :new }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aaf687e67f7f2348c5718da23a2fcd8b", "score": "0.47320166", "text": "def defineSave(&block)\n\t \traise SwapDmi::CacheReconfigureError.new if @readyFlag\n @save = block\n self\n end", "title": "" }, { "docid": "ff1aa8e217ca236fc415cdbe67b3fce8", "score": "0.4726872", "text": "def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end", "title": "" }, { "docid": "5e0b9c97e4f3ec32705670778509c29d", "score": "0.47267377", "text": "def create\n @block = Block.new(block_params)\n\n respond_to do |format|\n if @block.save\n format.html { redirect_to @block, notice: 'Block was successfully created.' }\n format.json { render action: 'show', status: :created, location: @block }\n else\n format.html { render action: 'new' }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6e1dc9a1b32c58914c82c76ebae8f74", "score": "0.47170767", "text": "def generate_next_block(block_data, blockchain)\n previous_block = latest_block(blockchain)\n p previous_block\n block_index = previous_block.block_index + 1\n timestamp = Time.now.to_i.to_s\n block_hash = Digest::SHA256.hexdigest(block_index.to_s + previous_block.block_hash + timestamp + block_data)\n Block.new(block_index, previous_block.block_hash, timestamp, block_data, block_hash)\n end", "title": "" }, { "docid": "58e08fddc40caab3c5c557d3da95fc52", "score": "0.47130787", "text": "def block_valid?(block, difficulty = 4)\n block.valid?(difficulty) &&\n block.parent_digest == head_digest &&\n balances([block]).none? { |user, balance| balance < 0 }\n end", "title": "" }, { "docid": "a64848dd81cc289cfd6bdc5e0ac6760f", "score": "0.47129312", "text": "def after_saving( &block )\n\t\tdefine_singleton_method( :call_after_saving, &block )\n\tend", "title": "" }, { "docid": "3cf82cd823588bd101fe3bf274f1d4a8", "score": "0.47103697", "text": "def validate_and_switch_to_fork(peer, target_height)\n new_blocks = []\n\n height = target_height\n\n loop do\n new_blocks << Block.initialize_from_json(self, JSON.parse(HTTParty.get(\"http://#{peer}/blocks/#{height}\").body))\n\n # Once we reach the genesis block or a common point, we can stop fetching\n # blocks.\n break if new_blocks.last.height == 0 ||\n new_blocks.last.previous_block_header_hash == find_block_by_height(height)&.previous_block_header_hash\n\n height += -1\n end\n\n # We now reverse our local blockchain before we start applying the fork.\n reverse_blocks_and_transactions_until(new_blocks.last.height - 1)\n\n new_blocks.reverse.each do |block|\n validate_and_apply_block(block)\n end\n end", "title": "" }, { "docid": "105543f8b6459ccc42f8966f54c776c9", "score": "0.4707718", "text": "def save\n wallet.db.save_account(self)\n save_key(0, receive_depth, derive_key(0, receive_depth)) if receive_depth.zero?\n save_key(1, change_depth, derive_key(1, change_depth)) if change_depth.zero?\n end", "title": "" }, { "docid": "9d65fd2874d7d7a54743c7dfcdc3e8cc", "score": "0.46979013", "text": "def save(&block)\n block = nil if redirecting_to_oauth2_server?\n super(&block)\n end", "title": "" }, { "docid": "07ae7179125abb665d0b44c6a0864bcf", "score": "0.46973035", "text": "def check_proof_of_work(block)\n if Bitcoin.network_name == :litecoin\n actual = block.recalc_block_scrypt_hash.to_i(16)\n else\n actual = block.hash.to_i(16)\n end\n\n expected_target = Bitcoin.decode_compact_bits(block.bits).to_i(16)\n max_target = Bitcoin.decode_compact_bits(Bitcoin.network[:proof_of_work_limit]).to_i(16)\n\n # Check the range.\n if expected_target <= 0 || expected_target > max_target\n return false\n end\n\n # Check the POW.\n return (actual <= expected_target)\n end", "title": "" }, { "docid": "12fcbf32d531c89d2cd305e76d027c57", "score": "0.46940562", "text": "def save(&block)\n result = nil\n if valid?\n self.record = attempted_record\n\n before_save\n new_session? ? before_create : before_update\n new_session? ? after_create : after_update\n after_save\n\n save_record\n self.new_session = false\n result = true\n else\n result = false\n end\n\n yield result if block_given?\n result\n end", "title": "" }, { "docid": "0aa7415689716bdb95c1f702ae36f6b8", "score": "0.46931306", "text": "def process( wallet )\n\t\tself.add_block do\n\t\t\tself.add_transaction( from: GENESIS_WALLET, to: wallet, amount: MINING_REWARD )\n\t\tend\n\tend", "title": "" }, { "docid": "1cd668a4b55c616442e18bfe97f34514", "score": "0.46870852", "text": "def create\n @chain = Chain.new(chain_params)\n\n respond_to do |format|\n if @chain.save\n format.html {\n #redirect_to @chain, notice: 'Chain was successfully created.'\n redirect_to test_path(@chain.test, selected_chain_id: @chain), notice: 'Цепочка создана'\n }\n format.json { render :show, status: :created, location: @chain }\n else\n format.html {\n flash[:error] = 'Ошибка при создании цепочки'\n redirect_to :back\n }\n format.json { render json: @chain.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5df96c8a4cf5ab235d839bd95f4f1434", "score": "0.46868733", "text": "def generate_genesis_block\n block = Block.new(0, 'Genesis Block', 0, 5.0)\n block.hash = 'GENESIS'\n\n block\n end", "title": "" }, { "docid": "31ecbf59156771f83463a4b0030c8581", "score": "0.46703708", "text": "def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end", "title": "" }, { "docid": "853cb4a033fc36324802ba2b464b467c", "score": "0.46699923", "text": "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "title": "" }, { "docid": "4c9291a9de18cf8736a343e3d125e239", "score": "0.46658438", "text": "def create\n @block = Block.new(block_params)\n\n respond_to do |format|\n if @block.save\n format.html { render @block, notice: \"#{@block.id}\" }\n format.json { render action: 'show', status: :created, location: @block }\n else\n format.html { render action: 'new' }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65eb448d823498eff7508116a09f91d9", "score": "0.46645638", "text": "def save(options = {}, &block)\n if block.present?\n save_remote(options, &block)\n else\n super\n end\n end", "title": "" }, { "docid": "0d6371e860a778c10a0a77c214750cf6", "score": "0.46642315", "text": "def transaction(&block)\n yield\n commit\n end", "title": "" }, { "docid": "950552a0df4404c338d4e36d66b7d6aa", "score": "0.46491507", "text": "def create\n @block = Block.new(params[:block])\n if @block.save\n redirect_to :controller=>\"blocks\",:action=>\"index\",:pageId=>params[:block][\"pageId\"]\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "deee1b8a768ceb534f0a5d9c9d2590e8", "score": "0.46489844", "text": "def save\n wallet.db.save_account(self)\n end", "title": "" }, { "docid": "534ad06bfbf81c76760892612dffd124", "score": "0.46481815", "text": "def write_block(session_id, block_id, data, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n @storage.write_block block_id, data\n data_hash = @p.hash_engine.hash_block data\n @hash_tree_controller.sign_write_block block_id, data_hash, session_cache_entry, nonce\n end", "title": "" }, { "docid": "6adca1ab5da7497cb9770926cefffc33", "score": "0.46296299", "text": "def check_block_transactions(curr_block)\n # FORMAT:\n # FROM_ADDR > TO_ADDR(NUM_BILLCOINS_SENT)\n curr_block.transactions.each do |transaction|\n if transaction.include? ' '\n @transactions_error = true\n puts \"Line #{@curr_count}: Could not parse transactions list '#{transaction}'\"\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end\n\n # split transaction line to sending/receiving addresses\n transaction_senders = transaction.split(/[>()]/)\n from_addr = transaction_senders[0]\n to_addr = transaction_senders[1]\n coins = transaction_senders[2].to_i\n\n # calculate balance results\n @addresses.handle_billcoins(from_addr, -coins)\n @addresses.handle_billcoins(to_addr, coins)\n end\n end", "title": "" }, { "docid": "f32049d5741c1cdce07dcc4ce24216a8", "score": "0.4610748", "text": "def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end", "title": "" }, { "docid": "80ef21c1ac0944eb96293f43d8304619", "score": "0.4610611", "text": "def save_checkpoint\n @api.send(\"world.checkpoint.save()\")\n end", "title": "" }, { "docid": "3fe211f301a33b7b7fb1963de28effa2", "score": "0.46079382", "text": "def save(options = {}, &block)\n save!(options, &block)\n rescue ZendeskAPI::Error::RecordInvalid => e\n @errors = e.errors\n false\n rescue ZendeskAPI::Error::ClientError\n false\n end", "title": "" }, { "docid": "93763ce3e8a1817736ce27f784f277c6", "score": "0.46052125", "text": "def run!\n start = skip_blocks + 1\n finish = n_blocks ? start + (n_blocks - 1): bitcoin.getinfo['blocks'].to_i\n puts \" -- Starting blockchain exploration of blocks #{start} to #{finish}, make yourself comfortable...\"\n\n n_processed = 0\n total_processing_time ||= 0\n\n # For each block\n (start..finish).each do |i|\n @cache_hit = 0\n @cache_miss = 0\n\n start_time = Time.now.to_f\n\n blk = bitcoin.get_block(bitcoin.get_block_hash(i))\n\n # For each transaction inside this block\n blk['tx'].map { |txid| get_tx(txid) }.each do |tx|\n idxs_with_data = []\n funds_from = []\n funds_to = []\n\n # Look into each input to see if send funds from an address we're interested in\n tx['vin'].each do |vin|\n unless vin['coinbase']\n input = get_tx(vin['txid'])['vout'][vin['vout']]\n addy = input['scriptPubKey'] && input['scriptPubKey']['addresses'].first\n\n if addy && has_address?(addresses, addy)\n addr_idx = addresses.index(addy)\n funds_from[addr_idx] ||= 0\n funds_from[addr_idx] += input['value']\n idxs_with_data << addr_idx\n end\n end\n end\n\n # Look into each out to see if we're paying any of the addresses we're interested in\n tx['vout'].each do |out|\n addy = out['scriptPubKey'] && out['scriptPubKey']['addresses'] && (out['scriptPubKey']['addresses'].first)\n\n if addy && has_address?(addresses, addy)\n addr_idx = addresses.index(addy)\n funds_to[addr_idx] ||= 0\n funds_to[addr_idx] += out['value']\n idxs_with_data << addr_idx\n end\n end\n\n idxs_with_data.uniq.each do |idx|\n addy = addresses[idx]\n net_change = (funds_to[idx] || 0) - (funds_from[idx] || 0)\n\n unless net_change.zero?\n db.query(insert_tx(addy, net_change, tx['txid'], i, blk['hash']))\n end\n end\n end\n\n end_time = Time.now.to_f\n\n n_processed += 1\n total_processing_time += end_time - start_time\n eta = (finish - i) * (total_processing_time.to_f / n_processed)\n elapsed = end_time - start_time\n\n puts \"[#{'%.2f' % (((i - start).to_f * 100) / (finish - start))}%] Block ##{i} <#{blk['hash']}> (#{'%.2f' % elapsed}s, ETA: #{\"%.3f\" % (eta / 3600)} hours), cache efficiency: #{'%.2f' % ((@cache_hit.to_f * 100)/(@cache_hit+@cache_miss))}%, processing speed: #{'%.2f' % ((blk['size'].to_f / (1024 * 1024)) / elapsed)} mb/s\"\n end\n end", "title": "" }, { "docid": "44c207fc0f7f8a4a17158dd2796ab989", "score": "0.46030292", "text": "def tx_commit(&block)\n @connection.send_frame(Protocol::Tx::Commit.encode(@id))\n\n self.redefine_callback :tx_commit, &block\n self\n end", "title": "" }, { "docid": "e2fc2bbd71dc48cbd6c5c21f7ea822c2", "score": "0.46012482", "text": "def update\n @block = @site.blocks.find(params[:id])\n\n respond_to do |format|\n params[:block].delete :user_id\n if @block.update_attributes(params[:block])\n flash[:notice] = 'Block was successfully updated.'\n format.html { redirect_to([@site, @block]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39180c387303b4c3643bade153141af8", "score": "0.45951042", "text": "def transaction(&block)\n block.call\n end", "title": "" }, { "docid": "b8aec06f9ebc417fac7c062dc0469546", "score": "0.459161", "text": "def latest\n uri = Iri.new('https://chain.api.btc.com/v3/block/latest')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n data = json['data']\n raise Sibit::Error, 'The latest block not found' if data.nil?\n hash = data['hash']\n @log.info(\"The hash of the latest block is #{hash}\")\n hash\n end", "title": "" }, { "docid": "0e0015d8f3a7bcfde978da61a797d418", "score": "0.45873213", "text": "def create\n @block = Block.new(params[:block])\n\n respond_to do |format|\n if @block.save\n format.html { redirect_to @block, :notice => 'Block was successfully created.' }\n format.json { render :json => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6237e232ac613e8cb986f4e05cefc10a", "score": "0.4585862", "text": "def create\n @block = Block.new(params[:block])\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(@block) }\n format.xml { render :xml => @block, :status => :created, :location => @block }\n format.json { render :json => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n format.json { render :json => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91b628d862fe18073c63efe1c9d9b0f5", "score": "0.458134", "text": "def create\n @block = Block.new(params[:block])\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(@block) }\n format.xml { render :xml => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87383194c46fcc93bed1bb1b4103867f", "score": "0.45802644", "text": "def accept_orphan orphan\n new_parent = []\n begin\n # Use a dummy ValidationState so someone can't setup nodes to counter-DoS based on orphan resolution\n # (that is, feeding people an invalid block based on LegitBlockX in order to get anyone relaying LegitBlockX banned)\n dummy_state = ValidationState.new\n log_raw_block_events(orphan.hash, \"recursively processing orphan block\")\n if self.accept_block(orphan, dummy_state)\n # Orphan is no longer an orphan and now becomes another parent to process.\n new_parent << orphan.hash\n else\n # rollback invalid orphan db transaction\n raise BlockValidationError, \"accept_block failed for orphan block with unknown reason\"\n end\n rescue ValidationError, BlockValidationError, TxValidationError => e\n # Failed to accept_block because orphan is invalid. Move on with other orphans.\n log_raw_block_events(orphan.hash, \"accept_block failed for orphan block: #{e.message()}\")\n # Note that we're keeping the block in our db. This is strictly different from bitcoind's\n # handling of orphan blocks. We do so for archival purposes. We may re-think that at some point.\n end\n new_parent\n end", "title": "" }, { "docid": "fdec58d3eee1d42170d6135f6abe4314", "score": "0.457346", "text": "def create\n\t\t@block = Block.new(block_params)\n\n\t\trespond_to do |format|\n\t\t\tif @block.save\n\t\t\t\tformat.html { redirect_to @block, notice: 'El bloque fue creado correctamente.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @block }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @block.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "77818aea16db37616e3d05dcb6fc0dcc", "score": "0.45728782", "text": "def save(validate: true)\n ActiveRecord::Base.transaction do\n main_model = _get_main_model\n\n valid = true\n if validate\n valid = self.valid?\n if valid\n before_save\n save = main_model.save\n after_save\n end\n else\n before_save\n save = main_model.save\n after_save\n end\n valid && save\n end\n end", "title": "" }, { "docid": "54c40326514427387ec443ab57a705c9", "score": "0.45699254", "text": "def record_block\n @block = true\n end", "title": "" }, { "docid": "0694b6cdc48f365a6f6c38a5500e692c", "score": "0.4561806", "text": "def block_params\n params.require(:block).permit(:previous_block, :nonce, :prev_timestamp, :success)\n end", "title": "" } ]
763b033d41133ed420071129d895c474
Generate a authorization request url
[ { "docid": "d9393093394d26c2e759a0c03d3e76b9", "score": "0.6564917", "text": "def get_authorize_url\n @request_token = @consumer.get_request_token\n return @request_token.authorize_url\n end", "title": "" } ]
[ { "docid": "25494a477dea4ee0e50e28c80541e023", "score": "0.8014142", "text": "def authorization_url\n \"https://\" + auth_host + authorize_path + \"?\" + authorize_url_params\n end", "title": "" }, { "docid": "84e2003627164368f181b9acc0ea96b1", "score": "0.7729414", "text": "def withings_generate_authorization_url\n\t\tconsumer_token = ConsumerToken.new(WITHINGS_OAUTH_CONSUMER_KEY, WITHINGS_OAUTH_CONSUMER_SECRET)\n\t\trequest_token_response = Withings::Api.create_request_token(consumer_token, \"http://localhost:3000/withings_receive_tokens\")\n\t\trequest_token = request_token_response.request_token\n\n\t\t#save request token secret in session data\n\t\tsession[:request_token_secret] = request_token.secret\n\n\t\t@withings_authorization_url = request_token_response.authorization_url\n\tend", "title": "" }, { "docid": "f274c8e9cfd272fc143ae753b0045cca", "score": "0.77233094", "text": "def authorization_url\n raise FireEagle::ArgumentError, \"call #get_request_token first\" if @request_token.nil?\n request_token.authorize_url\n end", "title": "" }, { "docid": "a5f3d132bc8840f0b4af6105aca6ea05", "score": "0.7683031", "text": "def authorization_url auth_token\n \"https://\" + auth_host + auth_path + \"?oauth_token=\" + auth_token\n end", "title": "" }, { "docid": "a5f3d132bc8840f0b4af6105aca6ea05", "score": "0.7683031", "text": "def authorization_url auth_token\n \"https://\" + auth_host + auth_path + \"?oauth_token=\" + auth_token\n end", "title": "" }, { "docid": "a264e5fcd12787b00cd09df53631b91d", "score": "0.7577165", "text": "def authorization_url()\n params = {\n \"client_id\" => @provider.client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @provider.redirect_uri\n }\n \"#{@provider.authorization_uri}?#{build_url_parameters(params)}\"\n end", "title": "" }, { "docid": "3a34a4ae4d03db7e69929524781329cc", "score": "0.7568526", "text": "def get_authorization_url(oauth_callback = \"oob\")\n $LOG.i \"requesting autorization token\"\n @consumer=OAuth::Consumer.new @config.consumer_key, \n @config.consumer_secret, \n {:site => Upwork::Api::BASE_HOST,\n :request_token_path => '/' + Upwork::Api::DEFAULT_EPOINT + URI_RTOKEN,\n :access_token_path => '/' + Upwork::Api::DEFAULT_EPOINT + URI_ATOKEN,\n :authorize_path => URI_AUTH,\n :signature_method => @config.signature_method}\n \n @request_token = @consumer.get_request_token({:oauth_callback => oauth_callback})\n $LOG.i \"got request token pair\", @request_token\n \n $LOG.i \"building authorization url, which is\", @request_token.authorize_url\n @request_token.authorize_url\n end", "title": "" }, { "docid": "b4335f77cefebca1331a39cd11bc1cb1", "score": "0.73504573", "text": "def authorize_url\n @client.authorization_uri\n end", "title": "" }, { "docid": "1454e9b8bfd098d94e78e873d6d60506", "score": "0.72304577", "text": "def authorize_url(token=get_request_token)\n proxy_for(config.merge(:token=>token[\"oauth_token\"], :token_secret=>token[\"oauth_token_secret\"])).signed_url(:get, \"/oauth/tokens/new\", :oauth_callback=>token[\"oauth_callback\"])\n end", "title": "" }, { "docid": "c78495addfb607f36d035d275036e56a", "score": "0.72297865", "text": "def authorization_url(requested_scopes = [\"public\"])\n @oauth.auth_code.authorize_url(redirect_uri: Unsplash.configuration.application_redirect_uri,\n scope: requested_scopes.join(\" \"))\n end", "title": "" }, { "docid": "ecfdc7fbd3f61cc72aa348020ba236e9", "score": "0.7204393", "text": "def authorize_url\n @request_token.authorize_url\n end", "title": "" }, { "docid": "a7b0e1cc7ac347d5fa04461b2bc9f68a", "score": "0.7162499", "text": "def authorize_url(*args)\n if authorized? then\n raise AlreadyAuthorizedError, \"You have already been authorized; no need to get an authorization URL.\"\n else\n return @request_token.authorize_url(*args)\n end\n end", "title": "" }, { "docid": "8b15291f6b63565a62493889a9093647", "score": "0.7161141", "text": "def authorization_uri\n uri.path = AUTHORIZE_PATH\n uri.query_values = {\n response_type: :code,\n client_id: client_id,\n redirect_uri: redirect_uri\n }\n uri.to_s\n end", "title": "" }, { "docid": "95f2fe913fa6bb47fb66a280efe7a03a", "score": "0.7160172", "text": "def oauth_url\n \"https://my.ecwid.com/api/oauth/authorize?\" + oauth_query\n end", "title": "" }, { "docid": "62ee280f4415ccd231c68ab6992737d6", "score": "0.7149852", "text": "def build_auth_url(base_url, _args)\n base_url\n end", "title": "" }, { "docid": "851fc5a715a2f3018384599e86f6f0b5", "score": "0.71352184", "text": "def authorization_url(requested_scopes: [\"public\"])\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: requested_scopes.join(\"\")\n )\n end", "title": "" }, { "docid": "c3f28bcd5285f49ac4e241378ff2c278", "score": "0.71260774", "text": "def auth_url\n auth_call = prepare_api_call(\"\", :params=>{:api_key=>@api_key},\n :base_url=>ODESK_AUTH_URL, :format=>nil, :method=>:get, :auth=>false)\n data = auth_call[:params].to_a.map{|pair| pair.join '='}.join('&')\n return auth_call[:url]+\"?\"+data\n end", "title": "" }, { "docid": "19f6472816702c4ba4847fa02ba23cb0", "score": "0.712162", "text": "def authentication_url\n validate_authentication_url\n query_params = {\n client_id: @api_key,\n redirect_uri: @redirect_uri,\n response_type: 'code'\n }\n query_params[:state] = @state if @state\n query_params_string = URI.encode_www_form(query_params)\n Napster::Request::HOST_URL + '/oauth/authorize?' + query_params_string\n end", "title": "" }, { "docid": "5030272d018dd92b71ffe16f8858bc2a", "score": "0.7108819", "text": "def url\n PagSeguro.site_url(\"#{api_version}/authorization/request.jhtml?code=#{code}\") if code\n end", "title": "" }, { "docid": "afcf5f3409c820453276766e2eca1aa7", "score": "0.7103464", "text": "def authorize_url\n raise OAuthTestWrapper::ArgumentError, \"call #get_request_token first\" if @request_token.nil?\n @request_token.authorize_url\n end", "title": "" }, { "docid": "171d94d08151b73c2a9d5aa77f9a1c53", "score": "0.71014374", "text": "def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end", "title": "" }, { "docid": "547d273190b7d9adcacbc09cc79ef71d", "score": "0.7100364", "text": "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "title": "" }, { "docid": "b793175e86fe92c9651ac964916e0e05", "score": "0.7098648", "text": "def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "title": "" }, { "docid": "0f8208fc730a40ae86580ae466b40827", "score": "0.7098106", "text": "def authentication_url\n req_params = {\n response_type: 'code',\n client_id: @client_id,\n redirect_uri: @redirect_uri,\n scope: @scope,\n }\n @auth_uri + '?' + req_params.to_query\n end", "title": "" }, { "docid": "62f3b8c666b362e39d282a21f0390888", "score": "0.7086492", "text": "def authorize_url(options = {})\n send('endpoint=', OAUTH_ENDPOINT)\n options[:response_type] ||= 'code'\n options[:redirect_uri] ||= options[:redirect_uri]\n options[:scope] ||= scope\n params = authorization_params.merge(options)\n connection.build_url('/oauth/authorize/', params).to_s\n end", "title": "" }, { "docid": "8dee7c93de84a34efcf47f5e611ae47d", "score": "0.7065609", "text": "def authentication_url(params={})\n params = {:oauth_callback => @oauth_callback}.update(params)\n request_token.authorize_url params\n end", "title": "" }, { "docid": "216b72e6b7ce17c3e3583b7ab10892b4", "score": "0.70642567", "text": "def build_authorization_link\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: 'read_write'\n )\n end", "title": "" }, { "docid": "21bdfb9f666b954614e0786f5be6b269", "score": "0.70624745", "text": "def authorize_url(uri, options={})\n token = @authentication.try(:get_fresh_token)\n p \"** token - #{token}\"\n unless (token)\n raise CCMeetup::ApiError.new(\"Could not get fresh token from authentication\")\n end\n \tadd_to_query_string(uri, access_token: token)\n end", "title": "" }, { "docid": "29e6e2a4e8ddf380d43f24b2e4a13036", "score": "0.7058876", "text": "def authorization_url\n auth_client.auth_code.authorize_url(:redirect_uri => options[:redirect_uri])\n end", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "d8cbb9ea8f0a9830666fbbe31cdcbe42", "score": "0.7055306", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "e09f33ebad8da580e2d68c9c4287f420", "score": "0.70446765", "text": "def get_authorization_url(state = nil)\n response_type = Util::Config.get('auth.response_type_code')\n params = {\n :response_type => response_type,\n :client_id => @client_id,\n :redirect_uri => @redirect_uri\n }\n if state\n params[:state] = state\n end\n [\n Util::Config.get('auth.base_url'),\n Util::Config.get('auth.authorization_endpoint'),\n '?',\n Util::Helpers.http_build_query(params)\n ].join\n end", "title": "" }, { "docid": "bdfb9ab9514042918bd261a7a0ae9cf8", "score": "0.70439184", "text": "def authorize_url\n \"#{Default::AUTH_URL}?client_id=#{@client_id}&redirect_uri=#{@callback_url}&response_type=code\"\n end", "title": "" }, { "docid": "de098934d9e6bc7de588602c074401a3", "score": "0.7030097", "text": "def oob_auth_url\n @authorizer.get_authorization_url(login_hint: @user_id,\n scope: @scope,\n base_url: @base_url)\n end", "title": "" }, { "docid": "fc91b6386ba0ef28267151353cef31f7", "score": "0.7029897", "text": "def get_authorization_url(request_token, callback_url)\r\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\r\n end", "title": "" }, { "docid": "764fa5d025429d5fb5ad074a5c5713b1", "score": "0.7029312", "text": "def authorize_url\n body = { response_type: 'code', client_id: @oauth_id, redirect_uri: @redirect_uri, scope: @scope, state: @state }\n connection(@authorize_site).build_url(@authorize_path, body).to_s\n end", "title": "" }, { "docid": "a1b40b51952b644a506adea8a4c9465a", "score": "0.7024299", "text": "def authorize_url(scope='profile') \n \"#{Att.base_uri}/oauth/authorize?scope=#{escape(scope)}&client_id=#{@client_id}&response_type=code&redirect_uri=#{escape(@redirect_uri)}\"\n end", "title": "" }, { "docid": "a715ae2b84be47c1a0ff095ff95ae5b6", "score": "0.70162714", "text": "def get_oauth2_authorization_url\n client = get_signet_client\n client.grant_type = 'authorization_code'\n\n state = (0...13).map{('a'..'z').to_a[rand(26)]}.join\n client.state = state\n session[:state] = state\n\n client.authorization_uri.to_s\n end", "title": "" }, { "docid": "f7ecc1a9dcd7606189d917d1528c6e3b", "score": "0.7016073", "text": "def authorization\n \"OAuth #{normalized_protocol_params_string}\"\n end", "title": "" }, { "docid": "61ea3a87137cd81ac1602f07fd817fd5", "score": "0.7014157", "text": "def build_auth_url\n @base_url = \"https://accounts.spotify.com/authorize\"\n @redirect_uri = ENV['REDIRECT_URI']\n\n @scope = \"playlist-modify-public playlist-modify-private playlist-read-private playlist-read-collaborative\"\n\n @url = \"#{@base_url}?client_id=#{ENV['CLIENT_ID']}&response_type=code&redirect_uri=#{@redirect_uri}&show_dialog=true&scope=#{@scope}\"\n end", "title": "" }, { "docid": "4ea1409666ac2273d9123f00ba1bc8a7", "score": "0.700003", "text": "def fetch_authorization_url(opts={})\n opts[:params] = opts.fetch(:params, {}).merge(authorization_params)\n method = opts.delete(:method) || :get\n make_request(method, @authorize_path, opts)\n end", "title": "" }, { "docid": "803c1ebe9cdde7be06fc728800eb9b32", "score": "0.69994015", "text": "def authorize_url(state)\n url = URI::join(@endpoint, 'authorize')\n\n url.query = {\n scope: 'deposit:write deposit:actions',\n state: state,\n redirect_uri: @redirect_uri,\n response_type: 'code',\n client_id: @client_id\n }.to_param\n\n url.to_s\n end", "title": "" }, { "docid": "05a28e36c9b12f70ea2391212def3ad0", "score": "0.69938684", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "05a28e36c9b12f70ea2391212def3ad0", "score": "0.69938684", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "05a28e36c9b12f70ea2391212def3ad0", "score": "0.69938684", "text": "def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend", "title": "" }, { "docid": "339158af5b749b674764cc580c3ea3f9", "score": "0.69648063", "text": "def authorization_request_url(\n resource, client_id, redirect_uri, extra_query_params = {}\n )\n @authority.authorize_endpoint(\n extra_query_params.reverse_merge(\n client_id: client_id,\n response_mode: FORM_POST,\n redirect_uri: redirect_uri,\n resource: resource,\n response_type: CODE\n )\n )\n end", "title": "" }, { "docid": "cf75e0fc5fc2e1ef42b0891b58d10459", "score": "0.6964539", "text": "def authorize_url(options = {})\n params = {}\n params[:scope] = options[:scope] || default_scopes\n params[:redirect_uri] = options[:redirect_uri] || redirect_uri\n params[:client_id] = options[:client_id] || client_id\n params[:response_type] = options[:response_type] || response_type\n URI.parse(auth_uri).tap do |uri|\n uri.query = URI.encode_www_form params\n end.to_s\n end", "title": "" }, { "docid": "d0354773d399da2a01fea02437c83785", "score": "0.69581246", "text": "def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n params = {\n client_id: client_id,\n scope: \"openid profile\",\n redirect_uri: redirect_uri,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce\n }.to_a\n # preserve existing URL params\n if uri.query\n params += URI.decode_www_form(String(uri.query))\n end\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "title": "" }, { "docid": "ea8ffc71f4efbf03c920926ba3ead53f", "score": "0.6954924", "text": "def authorize_url(uri, options = {})\n opts = { key: @api_key }\n if options[:get_signed_url]\n opts.merge!( { sign: \"true\"})\n end\n \tadd_to_query_string(uri, opts)\n end", "title": "" }, { "docid": "aede0c1989f334516a8c207609a239fd", "score": "0.6921981", "text": "def authorization_uri\n @oauth_client.authorization_uri\n end", "title": "" }, { "docid": "f013befc252588bf78ff094e765d1c09", "score": "0.69074047", "text": "def authorize_url(state_payload:)\n URI(authorization_endpoint).tap do |uri|\n uri.query = {\n client_id: client_id,\n redirect_uri: Rails.application.routes.url_helpers.launch_callback_url,\n scope: 'openid profile email phone address',\n response_type: 'code',\n state: Keypair.jwt_encode(state_payload),\n nonce: SecureRandom.uuid\n }.to_query\n end\n end", "title": "" }, { "docid": "f4281ff537eeaac760aafbd6af4f0159", "score": "0.6891208", "text": "def authorize_url(options = {})\n query = options.merge(\n client_id: client_id || raise(ArgumentError, 'Missing Strava client id.'),\n response_type: options[:response_type] || 'code',\n redirect_uri: options[:redirect_uri] || 'http://localhost',\n approval_prompt: options[:approval_prompt] || 'auto',\n scope: options[:scope] || 'read'\n )\n\n [endpoint, \"authorize?#{query.to_query}\"].join('/')\n end", "title": "" }, { "docid": "382c774d4bac454b91735ca051b71587", "score": "0.6888642", "text": "def authorize_url(params = {})\n @client.authorize_url(authorize_params.merge(params))\n end", "title": "" }, { "docid": "382c774d4bac454b91735ca051b71587", "score": "0.6888642", "text": "def authorize_url(params = {})\n @client.authorize_url(authorize_params.merge(params))\n end", "title": "" }, { "docid": "a177dec9c6de0ea3017db713f94c31a7", "score": "0.6886503", "text": "def auth_url\n # url = authenticator.authorize_url(:scope => 'email,user_birthday,user_likes,offline_access,photo_upload', :display => 'page')\n # Permissions ,manage_pages,offline_access,publish_stream\n authenticator.authorize_url(:scope => 'email,user_birthday,user_likes', :display => 'page')\n end", "title": "" }, { "docid": "954931a9bd03802afede9cfb15d4bb27", "score": "0.68553114", "text": "def authorization_url(options = {})\n initialize_auth_parameters(options)\n add_single_select_options(options[:single_select])\n client.auth_code.authorize_url(@auth_parameters)\n end", "title": "" }, { "docid": "861943bbcfe84f98d532a81399b8ca2d", "score": "0.68382543", "text": "def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end", "title": "" }, { "docid": "da51e08fc50fe339259664651411ad20", "score": "0.6828255", "text": "def build_sso_auth_url\n # Get the base URL:\n sso_url = @url.to_s[[email protected]_s.rindex('/')]\n\n # The SSO access scope:\n scope = 'ovirt-app-api'\n\n # Set the grant type and entry point to request from SSO:\n if @kerberos\n grant_type = 'urn:ovirt:params:oauth:grant-type:http'\n entry_point = 'token-http-auth'\n else\n grant_type = 'password'\n entry_point = 'token'\n end\n\n # Build and return the SSO URL:\n return \"#{sso_url}sso/oauth/#{entry_point}?grant_type=#{grant_type}&scope=#{scope}\"\n end", "title": "" }, { "docid": "886e210d435bfed59049537323a8984b", "score": "0.68222296", "text": "def authorize_url(params = {})\n params = (params || {}).merge(redirection_params)\n connection.build_url(options[:authorize_url], params).to_s\n end", "title": "" }, { "docid": "98fc0c59c3fd4e74c744b7b958f0dc3e", "score": "0.67807406", "text": "def url\n url = session_data[:auth_service][:host_uri]\n url += '/v2.0' if (URI(url).path =~ /^\\/?\\w+/).nil?\n url += \"/tokens\"\n \n url\n end", "title": "" }, { "docid": "176b0b325d6e6a47b93991e933037b6c", "score": "0.675529", "text": "def create_permission_url(mode = 'w')\n \"http://#{url}/admin/api/auth?api_key=#{api_key}&mode=#{mode}\"\n end", "title": "" }, { "docid": "3ae4df02c55b139a9241bef5478badb0", "score": "0.6748106", "text": "def oauth_url\n next_oauth_url + \"?\" + oauth_query\n end", "title": "" }, { "docid": "9ac25f3c2a1521591cd9823804e4f753", "score": "0.6738841", "text": "def authorization_url(options = {})\n Application.new.authorization_url(options)\n end", "title": "" }, { "docid": "cfe73e502dcfa7ea32586f302a3a6b77", "score": "0.673037", "text": "def auth_url\n @client.auth_code.authorize_url(redirect_uri: @redirect_uri, scope: format_scope(@scope))\n end", "title": "" }, { "docid": "21db2ad9745468d94e98170bf466feab", "score": "0.6718546", "text": "def authorize_url\n @scope = access_permissions.present? ? access_permissions.join(',') : scope\n super\n end", "title": "" }, { "docid": "21db2ad9745468d94e98170bf466feab", "score": "0.6718546", "text": "def authorize_url\n @scope = access_permissions.present? ? access_permissions.join(',') : scope\n super\n end", "title": "" }, { "docid": "2520b266785820f58909cad86ce2ac8f", "score": "0.67136323", "text": "def authorize_url(opts={})\n if oauth?\n @consumer.web_server.authorize_url({:redirect_uri => @auth[:redirect_uri]}.merge(opts))\n else\n nil\n end\n end", "title": "" }, { "docid": "ed36d3781d3f522b00ba0a4cef826b9e", "score": "0.67067087", "text": "def authorize_url(opts = {})\n @scope = access_permissions.present? ? access_permissions.join(' ') : scope\n super(opts.merge(token_url: @token_url))\n end", "title": "" }, { "docid": "1cdc0eddab06eab8bb5884998211d55c", "score": "0.6702658", "text": "def authorize_url(params = {})\n self.verify_oauth!\n self.oauth.auth_code.authorize_url(params)\n end", "title": "" }, { "docid": "b0f00c47511cc59e13404a87bf48dfde", "score": "0.6677352", "text": "def device_authorization_url(params={})\n params[:scope] = normalize_scope(params[:scope]) if params[:scope]\n device.authorization_url(params)\n end", "title": "" }, { "docid": "66d30aed9da26da494e6c4896e4f8681", "score": "0.66766065", "text": "def get_authorize_url(token, args = {})\n @oauth_consumer.authorize_url(FLICKR_OAUTH_AUTHORIZE, args.merge(:oauth_token => token))\n end", "title": "" }, { "docid": "a36687025a565787f4bb036dcecee3bb", "score": "0.66684824", "text": "def authorize_url(opts = {})\n opts[:redirect_uri] ||= DEFAULT_REDIRECT_URI\n # scope:非必须参数,以空格分隔的权限列表,若不传递此参数,代表请求用户的默认权限。关于权限的具体信息请参考“权限列表”。\n opts[:scope] ||= \"basic netdisk super_msg\"\n oauth_client.auth_code.authorize_url(scope: opts[:scope], redirect_uri: opts[:redirect_uri])\n end", "title": "" }, { "docid": "d86884a7000fafc4671f9fe98f1f99a0", "score": "0.66580063", "text": "def build_code_url(params={})\n url = URI::HTTPS.build(:host => host,\n :path => authorize_path,\n :query => encoded_body(params))\n\n url.to_s\n end", "title": "" }, { "docid": "0c8b754f451b3afe1ed3e4a0f595a4a0", "score": "0.6655556", "text": "def get_authorize_url(callback=nil, *args)\n get_request_token(*args)\n\n url = @request_token.authorize_url\n if callback\n url += \"&oauth_callback=\" + URI.escape(callback)\n end\n\n \"https://www.dropbox.com\" + url\n end", "title": "" }, { "docid": "400c1332b8a344591571cb8063c55e3d", "score": "0.66553193", "text": "def authorize_url(state: nil, scope: nil)\n uri = URI.parse(self.authorize_endpoint)\n uri.query = URI.encode_www_form(\n {\n response_type: 'code',\n client_id: client_id,\n scope: scope || userinfo_scope,\n state: state,\n redirect_uri: callback_url\n }.reject {|_,v| v.nil? }\n )\n uri.to_s\n rescue => ex\n error ex\n end", "title": "" }, { "docid": "7c1ba9b836758aced103f52edfe8f4a8", "score": "0.66337717", "text": "def par_authorization_url(request_uri)\n raise Auth0::InvalidParameter, 'Must supply a valid request_uri' if request_uri.to_s.empty?\n\n request_params = {\n client_id: @client_id,\n request_uri: request_uri,\n }\n\n URI::HTTPS.build(host: @domain, path: '/authorize', query: to_query(request_params))\n end", "title": "" }, { "docid": "9a1d46a04fdfa7498f8925d2c4a94e87", "score": "0.6622436", "text": "def get_authorize_url(token, args = {})\n @oauth_consumer.authorize_url(FLICKR_OAUTH_AUTHORIZE, args.merge(:oauth_token => token))\n end", "title": "" }, { "docid": "d00915a7ef5e5e3abda69240bd55a352", "score": "0.66213423", "text": "def authorize_url\n @client.auth_code.authorize_url(redirect_uri: @redirect_uri)\n end", "title": "" }, { "docid": "ae111be46c2cac7a583c4acee4c6206c", "score": "0.660862", "text": "def authorize_url(params = {})\n _verify_client(params.delete(:endpoint))\n oauth_client.auth_code.authorize_url(params)\n end", "title": "" }, { "docid": "1e27379b4585e2a784203e8d6ab33e71", "score": "0.6607318", "text": "def auth_url\n url = authenticator.authorize_url(:scope => 'user_birthday,user_likes', :display => 'page')\n logger.info \"redirecting to \" + url\n return url\n end", "title": "" }, { "docid": "84f7304d434ac7754b49f3966f44e4cf", "score": "0.66066265", "text": "def auth_url\n url = authenticator.authorize_url(:scope => 'publish_stream,email', :display => 'page')\n logger.info \"redirecting to \" + url\n return url\n end", "title": "" }, { "docid": "d03a05a02a22603de1ca412066351ca2", "score": "0.6604821", "text": "def authorize_url\n authorization_parameters = {\n response_type: 'code',\n redirect_uri: instagram_o_auth_url,\n state: 'authorize_strava',\n access_type: 'offline'\n }\n config.auth_code.authorize_url(authorization_parameters)\n end", "title": "" }, { "docid": "5c9695c540bcefd0fd2cb00f3e567c9d", "score": "0.65974164", "text": "def oauth2_authorize_url(redirect_uri, user_email = false, user_name = false, permissions = \"manage_accounts,collect_payments,view_user,send_money,preapprove_payments,manage_subscriptions\")\n url = @ui_endpoint + '/oauth2/authorize?client_id=' + @client_id.to_s + '&redirect_uri=' + redirect_uri + '&scope=' + permissions\n url += user_name ? '&user_name=' + CGI::escape(user_name) : ''\n url += user_email ? '&user_email=' + CGI::escape(user_email) : ''\n end", "title": "" }, { "docid": "0014ab1e9861e8cadd0a514d6f9e8ced", "score": "0.6595802", "text": "def auth_url(for_what, parameters=\"\")\n\t\t\tparameters = \"\" if parameters.nil?\n\n\t\t\tif parameters != \"\"\n\t\t\t\tparameters = \"?#{parameters.to_query}\"\n\t\t\tend\n\t\t\t\"/auth/#{for_what}#{parameters}\"\n\t\tend", "title": "" }, { "docid": "d64f67c8f3e24e150459a29987c79b58", "score": "0.6595561", "text": "def oauth_authorization_url (client_id, redirect_uri, scope)\n \"https://api.instagram.com/oauth/authorize/?client_id=#{client_id}&redirect_uri=#{redirect_uri}&response_type=code&scope=#{scope}\"\n end", "title": "" }, { "docid": "ef8a5b7904a78fb94222c4a520fbf973", "score": "0.6592532", "text": "def authorization_url\n endpoint = \"#{connection.url_prefix}/o/oauth2/auth\"\n\n scopes = \"https://www.googleapis.com/auth/gmail.readonly \"\n scopes << \"https://www.googleapis.com/auth/userinfo.profile \"\n scopes << \"https://www.googleapis.com/auth/userinfo.email\"\n\n response_type = \"code\"\n access_type = \"offline\"\n approval_prompt = \"force\"\n\n redirect_uri = ENV['GMAIL_AUTHORIZATION_CALLBACK']\n\n \"#{endpoint}?scope=#{scopes}&response_type=#{response_type}&access_type=#{access_type}&redirect_uri=#{redirect_uri}&approval_prompt=#{approval_prompt}&client_id=#{client_id}\"\n end", "title": "" }, { "docid": "f2b5724c46ec9dd08a96c92a12cf66bc", "score": "0.6585544", "text": "def authorize_url(params = {})\n @oauth.auth_code.authorize_url(@default_params.merge(params))\n end", "title": "" }, { "docid": "19b299950ac320790074250386bb18c3", "score": "0.6581502", "text": "def requestAuth\n uri = URI @auth_url\n uri.query = uri_encode_form({\n :client_id => @client_id,\n :response_type => 'code',\n :redirect_uri => @callback_url\n })\n uri\n end", "title": "" }, { "docid": "dbaade9c8803c9a29af86b962920d32b", "score": "0.65779704", "text": "def authorize_path\n session[:state] = \"#{Time.now.to_i}/#{SecureRandom.hex(18)}\"\n\n auth_server_config[\"authorization_endpoint\"] + \"?\" +\n \"response_type=code&\" +\n \"client_id=#{client_options.client_id}&\" + \n \"redirect_uri=#{generate_callback_path}&\" +\n \"state=#{session[:state]}\"\n end", "title": "" }, { "docid": "b69991be58fd4938b4d51ed621aa2701", "score": "0.65778846", "text": "def authorization_code_url(options)\n URL.new(options.merge(\n path: \"/api/v1/oauth2/authorize\",\n params: {\n response_type: \"code\",\n approve: \"true\",\n client_id: client_id,\n },\n )).to_s\n end", "title": "" }, { "docid": "dffd952e5be02c26d42ed9bc609637a7", "score": "0.65687805", "text": "def authorize_url(redirect_uri, params={})\n query = authorize_query.update params\n query.update({ client_id: self.client.client_id, redirect_uri: redirect_uri })\n query.update({ force_login: 1 }) if params[:force_login]\n query.update({ confirm_login: 1 }) if params[:confirm_login]\n Util.clean_params query\n uri = URI(self.client.site)\n uri.path = Baidu::OAuth::AUTHORIZATION_ENDPOINT\n uri.query = Util.encode_params(query) unless Util.blank? query\n uri.to_s\n end", "title": "" }, { "docid": "e49e0171fa230cb11be2e74028766cb3", "score": "0.6557442", "text": "def oauth2_authorize_url(redirect_uri, user_email = false, user_name = false, permissions = \"manage_accounts,collect_payments,view_user,send_money,preapprove_payments,manage_subscriptions\")\n\t\turl = @ui_endpoint + '/oauth2/authorize?client_id=' + @client_id.to_s + '&redirect_uri=' + redirect_uri + '&scope=' + permissions\n\t\turl += user_name ? '&user_name=' + CGI::escape(user_name) : ''\n\t\turl += user_email ? '&user_email=' + CGI::escape(user_email) : ''\n\tend", "title": "" }, { "docid": "6605874432ed6368dcb09c022a607465", "score": "0.65545887", "text": "def auth_url(args={})\n full_args = {:api_key => FlickRaw.api_key, :perms => 'read'}\n args.each {|k, v| full_args[k.to_sym] = v }\n full_args[:api_sig] = api_sig(full_args) if FlickRaw.shared_secret\n\n 'http://' + FLICKR_HOST + AUTH_PATH + full_args.collect { |a, v| \"#{a}=#{v}\" }.join('&')\n end", "title": "" }, { "docid": "478e407c13fe6d755b12992208598f3a", "score": "0.65392256", "text": "def authorize_url(app_id = client_id, options = {})\n opts = options.dup\n if app_id.to_s.empty?\n raise Octokit::ApplicationCredentialsRequired, \"client_id required\"\n end\n authorize_url = opts.delete(:endpoint) || Octokit.web_endpoint\n authorize_url << \"login/oauth/authorize?client_id=#{app_id}\"\n\n require 'cgi'\n opts.each do |key, value|\n authorize_url << \"&#{key}=#{CGI.escape value}\"\n end\n\n authorize_url\n end", "title": "" }, { "docid": "2cdb84b27241d6ae09e1757a6f75997c", "score": "0.65379125", "text": "def authorize_url\n get_client().auth_code.authorize_url(:redirect_uri => APP_CONFIG['redirect_uri'])\n end", "title": "" } ]
688dcc1e8dc321b0569e507a84d103bc
Returns the value of attribute bugsnag_user_id. source://bugsnag//lib/bugsnag/meta_data.rb4
[ { "docid": "b3236cafc6c084a77b314e7d8742b9a6", "score": "0.7757908", "text": "def bugsnag_user_id; end", "title": "" } ]
[ { "docid": "9302c93f76eba9a19d9e3da189f70c56", "score": "0.7262656", "text": "def user_id()\n\t\t\treturn @user_data['user_id']\n\t\tend", "title": "" }, { "docid": "1301a863940de7dd3e35e522e6a78d9f", "score": "0.72044086", "text": "def user_id\n data[:user_id]\n end", "title": "" }, { "docid": "6668a3d24079d5fe96f2cb4efb2c943b", "score": "0.7105039", "text": "def user_id\n @variables[\"user\"][\"userId\"]\n end", "title": "" }, { "docid": "5d3b467710d00bbf783a5d95a711791e", "score": "0.7045212", "text": "def bugsnag_user_id=(_arg0); end", "title": "" }, { "docid": "fa8387c3fb2a6540a055a7bb190ffe9d", "score": "0.7014173", "text": "def user_id\n data.user_id\n end", "title": "" }, { "docid": "fa8387c3fb2a6540a055a7bb190ffe9d", "score": "0.7014173", "text": "def user_id\n data.user_id\n end", "title": "" }, { "docid": "f06dbcc08b17fb301b46e2b91f0c721f", "score": "0.6863286", "text": "def user_id\n @user_data.user_id\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "534dad6e19e1ce806529192c8042fe3a", "score": "0.68465316", "text": "def user_id\n @attributes[:user_id]\n end", "title": "" }, { "docid": "f0fb5fa51b58d5fc418e1f645cb7c679", "score": "0.683266", "text": "def userid\n attributes['userid']\n end", "title": "" }, { "docid": "3bd77ba440c0e6cd3ad8bf96eefdc38c", "score": "0.668748", "text": "def user_id\n return @raw['user']['id'] if @raw\n @raw_detail_hash['user']['id']\n end", "title": "" }, { "docid": "8f3f4022ec9321b1cb9ce2563649c212", "score": "0.65739197", "text": "def user_id\n\t\tdata[:current_user_id]\n\tend", "title": "" }, { "docid": "d9ad800741716f1f19effd374350db2b", "score": "0.65197617", "text": "def get__user_data_id(_user_data)\n user_node_key = @my_GlueEnv.node_key\n _user_data[user_node_key]\n end", "title": "" }, { "docid": "d3633e4659140e47ef243d6bbb66bbc7", "score": "0.64846367", "text": "def user_id\n payload_user(:id)\n end", "title": "" }, { "docid": "8b37925b91947150c0f2652134407557", "score": "0.6482995", "text": "def uidnumber\n attributes['uidnumber']\n end", "title": "" }, { "docid": "0114053df000789b9a0df987b7081c38", "score": "0.63596", "text": "def user_id\n @env[:user_id]\n end", "title": "" }, { "docid": "d871162e87b6a5c57c910e37a3add4ea", "score": "0.6348178", "text": "def userid\n user_id\n end", "title": "" }, { "docid": "d871162e87b6a5c57c910e37a3add4ea", "score": "0.6348178", "text": "def userid\n user_id\n end", "title": "" }, { "docid": "d871162e87b6a5c57c910e37a3add4ea", "score": "0.6348178", "text": "def userid\n user_id\n end", "title": "" }, { "docid": "fc6beb266dc4cac09b32543bb711dcfa", "score": "0.63013035", "text": "def id\n @user['user_id'].to_i\n end", "title": "" }, { "docid": "5de689e8b404c60c2230fe8cc1bd39fd", "score": "0.6289008", "text": "def uid\n read_attribute :uid\n end", "title": "" }, { "docid": "e8c57102d2c7b6d1f151d9568da256bb", "score": "0.628375", "text": "def uidnumber\n parser_for(:user_uidnumber, user_attributes)\n end", "title": "" }, { "docid": "511c4dfb199da689c3edfa5abe472bc8", "score": "0.6269762", "text": "def user_id\n Cproton.pn_message_get_user_id(@impl)\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "48225f4ab282761b1bca769fa5e8721e", "score": "0.62571144", "text": "def user_id\n return @user_id\n end", "title": "" }, { "docid": "b36d47f90904ff929d0b2ac0c45d6a6a", "score": "0.62538815", "text": "def user_id\n @user_id\n end", "title": "" }, { "docid": "018f0e5ea8744fd69ccc8da51eb094da", "score": "0.61744016", "text": "def get_user_id!(params)\n get_value_for_key(params, \"user_id\")\n end", "title": "" }, { "docid": "9189774d3e2a945c6c4670a3d666f955", "score": "0.6166565", "text": "def primary_userid\n string_property(:rnp_key_get_primary_uid)\n end", "title": "" }, { "docid": "283c149dd33290a76f1fe626b6ad7388", "score": "0.61376154", "text": "def get_user_id!(params)\n get_value_for_key!(params, \"user_id\")\n end", "title": "" }, { "docid": "278f043ced55daaff189847e35a5373b", "score": "0.6099052", "text": "def user_id\n self[:user_id] or APP_CONFIG['default_user_id']\n end", "title": "" }, { "docid": "20170cec72edeea7c80348a56ac98ec2", "score": "0.60926026", "text": "def uid\n uid_property ? uid_property.ruby_value : nil\n end", "title": "" }, { "docid": "20170cec72edeea7c80348a56ac98ec2", "score": "0.60926026", "text": "def uid\n uid_property ? uid_property.ruby_value : nil\n end", "title": "" }, { "docid": "0218072ff7ccb4f0c67a5bd048d49584", "score": "0.6091276", "text": "def UserId\n\t\tend", "title": "" }, { "docid": "3d350e5e61a9e307c5b90e40fa26e177", "score": "0.60904634", "text": "def user_id\n config.present? ? config[:user_id] : nil\n end", "title": "" }, { "docid": "65bf775d4dd08429740086b2084edaa2", "score": "0.6083354", "text": "def user_id\n if auth\n auth[\"user\"]\n end\n end", "title": "" }, { "docid": "3ea2f1a106e7148ab4a0bc9ab5878c43", "score": "0.6082319", "text": "def uid\n @data[\"rawId\"]\n end", "title": "" }, { "docid": "6a61e9827f0c7d4cad27ac8c02871952", "score": "0.60536045", "text": "def jira_username\r\n datastore['JIRAUSER']\r\n end", "title": "" }, { "docid": "9926218d681fcdd17880eabf0fc183cf", "score": "0.59948426", "text": "def query_user_id\n @attributes[:query_user_id]\n end", "title": "" }, { "docid": "bc597f5133213be41593a30edd58d9ea", "score": "0.5993392", "text": "def get_username\n env[settings.uid_attr]\n end", "title": "" }, { "docid": "5cc7cb6b90cccd432131e957257c52aa", "score": "0.59807664", "text": "def get_user_info\n return User.find_by_id(self.user_id)\n end", "title": "" }, { "docid": "2101b2920b14f7a182668641fe7d5b34", "score": "0.5974957", "text": "def site_user_info\n site_info[:user_info]\n end", "title": "" }, { "docid": "3261277eb81b07618ea1f11af0040ee3", "score": "0.5966535", "text": "def get_UserID()\n \t return @outputs[\"UserID\"]\n \tend", "title": "" }, { "docid": "3261277eb81b07618ea1f11af0040ee3", "score": "0.5966535", "text": "def get_UserID()\n \t return @outputs[\"UserID\"]\n \tend", "title": "" }, { "docid": "3261277eb81b07618ea1f11af0040ee3", "score": "0.5966535", "text": "def get_UserID()\n \t return @outputs[\"UserID\"]\n \tend", "title": "" }, { "docid": "cf8b1d0a07ed55504b462cd595b305f1", "score": "0.5948209", "text": "def target_user_id\n @attributes[:target_user_id]\n end", "title": "" }, { "docid": "00313f208711ad993006eabd5963f91c", "score": "0.5930567", "text": "def uid_property\n @uid_property\n end", "title": "" }, { "docid": "00313f208711ad993006eabd5963f91c", "score": "0.5930567", "text": "def uid_property\n @uid_property\n end", "title": "" }, { "docid": "8f1361295002dbec14abd6adeb5d0844", "score": "0.59193766", "text": "def user_data_from_cookie\n if @uid_hash && @uid_hash[:value]\n return @uid_hash[:value]\n end\n \n uid_cookie = user_id_cookie\n if uid_cookie\n value = uid_cookie.is_a?(Hash) ? uid_cookie[:value] : uid_cookie\n return value\n end\n end", "title": "" }, { "docid": "eccdb5904fbcef82d9982e5b883b1937", "score": "0.59095776", "text": "def get_user_id\n @user_id ||= self.user.id\n end", "title": "" }, { "docid": "76d5ba55ad2cdfa8be161db0ce2f8694", "score": "0.5903772", "text": "def id\n @user['id'].to_i\n end", "title": "" }, { "docid": "d7285fb4a94281b843f47644889396ff", "score": "0.5891787", "text": "def user_id\n @browser.frame(:index=>0).table(:class=>\"itemSummary\", :index=>0)[0][1].text\n end", "title": "" }, { "docid": "5985092dc1cc8e3327ae9134f8117a82", "score": "0.5883286", "text": "def known_user_id(user)\n user.display_name\n end", "title": "" }, { "docid": "2861b2a4f652010233f3fbec5f9443e3", "score": "0.5876033", "text": "def uid\n proptext 'UID'\n end", "title": "" }, { "docid": "b4be499758f0e470dfb0644fc00fd366", "score": "0.58710134", "text": "def user_experience_analytics_metric_id\n return @user_experience_analytics_metric_id\n end", "title": "" }, { "docid": "27a1bc5ead18006b53d0b1a64f840a7a", "score": "0.5864193", "text": "def user_id\n if Volt.client?\n user_id_signature = $page.cookies._user_id\n else\n # Check meta for the user id and validate it\n meta_data = Thread.current['meta']\n if meta_data\n user_id_signature = meta_data['user_id']\n else\n user_id_signature = nil\n end\n end\n\n if user_id_signature.nil?\n return nil\n else\n index = user_id_signature.index(':')\n user_id = user_id_signature[0...index]\n\n if RUBY_PLATFORM != 'opal'\n hash = user_id_signature[(index+1)..-1]\n\n # Make sure the user hash matches\n if BCrypt::Password.new(hash) != \"#{Volt.config.app_secret}::#{user._id}\"\n # user id has been tampered with, reject\n raise \"user id or hash has been tampered with\"\n end\n\n end\n\n return user_id\n end\n end", "title": "" }, { "docid": "f0a738337e728c54c5fcc388424e47de", "score": "0.5851382", "text": "def get_uid_int\n self.uid.to_i\n end", "title": "" }, { "docid": "b28c7538e63a9b49d0590c6d5e20e244", "score": "0.5848321", "text": "def applicationUserID()\n\treturn ENV[\"APPLICATION_USERID\"]\nend", "title": "" }, { "docid": "b28c7538e63a9b49d0590c6d5e20e244", "score": "0.5848321", "text": "def applicationUserID()\n\treturn ENV[\"APPLICATION_USERID\"]\nend", "title": "" }, { "docid": "185ebe61b01f10d91ad301746fef27f9", "score": "0.58419144", "text": "def ig_user_id\n @changes['ig_user_id']\n end", "title": "" }, { "docid": "ed505c46f19f6fcf20a379eaf17cb6d0", "score": "0.58261657", "text": "def GetUserID(useremail)\n getuserdata(useremail)[\"userid\"].to_i\n end", "title": "" }, { "docid": "9a3d40082d6f53f59176bcee070025eb", "score": "0.5813138", "text": "def get_user_id\n params[\"session\"][\"user\"][\"userId\"]\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "2cc74a88ae2b38555bc0b84d41c4494a", "score": "0.5809256", "text": "def user_id=(value)\n @user_id = value\n end", "title": "" }, { "docid": "427966f368aa267a514f9255b40667dc", "score": "0.58087224", "text": "def user_id\n claims = JsonWebToken.get_userid(request.headers)\n \n claims[0][\"id\"].to_i\n end", "title": "" }, { "docid": "c66b1a0560a4e5e8f237fc609f20924b", "score": "0.5799213", "text": "def uid\n return nil unless user\n\n user.is_a?(Integer) ? user : Etc.getpwnam(user.to_s).uid\n end", "title": "" }, { "docid": "4455b8743eb88893dc6cc1804292d190", "score": "0.5796822", "text": "def user_id\n id\n end", "title": "" }, { "docid": "15569be3437b9bd6a4ed90c9142b335d", "score": "0.57907784", "text": "def hubssolib_get_user_id\n user = self.hubssolib_current_user\n user ? user.user_id : nil\n end", "title": "" }, { "docid": "8bcd0fd29781c45798460efa50fd5de3", "score": "0.57830274", "text": "def get_user_id(src)\n User.id_value(src)\n end", "title": "" }, { "docid": "d9de165656f2f920749395816754c2fd", "score": "0.5777632", "text": "def bugsnag_meta_data; end", "title": "" }, { "docid": "4b3b83b4167cf3e53ba8e5ab76585e36", "score": "0.5771284", "text": "def uid\n getUID\n end", "title": "" }, { "docid": "f4b976c367486a11e926c40449b6a393", "score": "0.5763032", "text": "def id\r\n @usr_id\r\n end", "title": "" }, { "docid": "fb35caf5cb275a6338eceb4080be09d1", "score": "0.5759223", "text": "def get_user_id(user_name)\n # tbd\n 17\n end", "title": "" }, { "docid": "3c1fe44e78ebde983e73b06c8f7363bb", "score": "0.57587695", "text": "def user_name\n @data[:user_name]\n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "472c5d0d56f82f2064401ccb984c1c1d", "score": "0.0", "text": "def defensive_back_stat_params\n params.require(:defensive_back_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :win, :loss, :wins, :losses, :tackles, :sacks, :fumbles, :interception, :score, :opponent_score, :user_id, :stat_id, :sport_id, :position_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79428834", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6957111", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6887561", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.6766709", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.67342883", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.6713181", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.67062396", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6660948", "text": "def filtered_parameters; end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.66161835", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.661588", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6588555", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6575046", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6572021", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.65718234", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f5e3a87909b3e5022047b4b0a64ca154", "score": "0.65324724", "text": "def parameter_params\n params.require(:parameter).permit(:name, :code, :description, :user_id, :value, :cargapp_model_id, :active)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6513014", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "58d1451e57b0e767db2fc6721dfaa6be", "score": "0.6511699", "text": "def allowed_parameters\n parameters.keys\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.649953", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "52d4c66cc205503f7ad6a4feaedab9b8", "score": "0.64914954", "text": "def parameter_params\n params.require(:parameter).permit(:name, :value, :description)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.64891934", "text": "def need_params\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6476081", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "e64490ed35123aafa1b4627bd165517d", "score": "0.64570445", "text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.64390707", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6431231", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.6424368", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.64205074", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.64205074", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6379847", "text": "def filter_parameters; end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.6372981", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6353668", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6353668", "text": "def check_params; true; end", "title": "" }, { "docid": "cac0774e508766d2f487cbca3db95df0", "score": "0.6335459", "text": "def allow_params?\n definition[:param_tokens]\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6319115", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "55aa899fab0dfa44916f71c499998ca8", "score": "0.6311747", "text": "def parameter_params\n params.require(:parameter).permit(:key, :value)\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.62927073", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.62927073", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6290553", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6290553", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "64ea65f903dbe0c9c0cc0e9a20ed2e7f", "score": "0.6290082", "text": "def good_option_params\n permit_params\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.62725514", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6265403", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "572f75fa86537d103ddf7b5503f06515", "score": "0.6265316", "text": "def parameter_params\n params.require(:parameter).permit(:title)\n end", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6260525", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "b4ac8bc6941a87425ac2dc42a226295f", "score": "0.6258935", "text": "def filtered_params_config; end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6242261", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "63944d10aa4cde014b8332874db87cb9", "score": "0.62379485", "text": "def excluded_from_filter_parameters=(_arg0); end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6226217", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "6fc2bac4c842e4285d685333ba68e5e9", "score": "0.6225818", "text": "def admin_parameter_params\n params.require(:admin_parameter).permit(:name, :inss_hour_price, :private_hour_price, :is_eval)\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.62242866", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "d8b02fce801fc219417d86d0ca117836", "score": "0.62242866", "text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6224025", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "6008e8707eafce375988b3c7ccf098c3", "score": "0.6214176", "text": "def original_params; end", "title": "" }, { "docid": "4ba8f5cdb0399571d60b7242794ce47f", "score": "0.6203018", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "356c5fd5dcbe9214f1330792fa2e18b5", "score": "0.6192316", "text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b977c2daceb28f26ee659336b2b98aa9", "score": "0.61882526", "text": "def params\n raise \"Override protected method `params'.\"\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6180885", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "706df0e25391ed2b932f54a646bb0a10", "score": "0.61774665", "text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6175604", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "8e54eaded22dd280d836e96375fed9a4", "score": "0.61732554", "text": "def paramun_params\n params.require(:parametre).permit!\n end", "title": "" }, { "docid": "d3732ff42abd0a618a006d1f24e31e38", "score": "0.6172096", "text": "def add_to_filter_parameters; end", "title": "" }, { "docid": "19080b9212dc7ba3727f80cc9430e426", "score": "0.61713403", "text": "def special_params\n params.require(:special).permit(:name, :description, :function)\n end", "title": "" }, { "docid": "f8c05c05fb596260a51d3ab4fb42243d", "score": "0.6171246", "text": "def required_parameters\n [ ]\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.61633885", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "3da9117a80cdfd040f0f0ed9d3ffed55", "score": "0.61464053", "text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end", "title": "" }, { "docid": "b9e34b5ac2955add85639f9ca0a07b7f", "score": "0.61445874", "text": "def resource_params\n permits = resource_whitelist\n params.require(model_symbol).permit(permits)\n end", "title": "" }, { "docid": "d646c7ba579499db9edadb606c8b9910", "score": "0.6144435", "text": "def permitted_params\n logger.warn \"#{self}: please override `permitted_params` method.\"\n params.require(resource_request_name).permit!\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143871", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "4425e2f97b4355b14334b9744f19c412", "score": "0.6143871", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6136693", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "c4a951d3ba89c6d098a96d3d5a2b8643", "score": "0.61282265", "text": "def collection_permitted_params\n params.permit(:format, :page, :per_page, :sort, :include, :locale, fields: {}, filter: {})\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61135775", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "34fb76d8decc10cd29ada824ff70ae63", "score": "0.6110938", "text": "def permitted_resource_params\n p params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6107067", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "11f5f8959aba1f4022c60509f20e40af", "score": "0.61054254", "text": "def permit_params\n params[:permit]\n end", "title": "" }, { "docid": "45791845cef485d15b7014088dd0be8d", "score": "0.6103165", "text": "def allowed_params\n %i[title body]\n end", "title": "" }, { "docid": "4632c7949842c8534d66b50254032add", "score": "0.6091798", "text": "def parameterization_params\n params.permit(:name, :user_id, :number_value, :money_value)\n end", "title": "" }, { "docid": "bfa951108b69c8eed106b7ad8acbcbfd", "score": "0.609143", "text": "def data_param\n params.permit(:value)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.60889095", "text": "def filter_params\n end", "title": "" }, { "docid": "63f5e4e9733f9e6b3f98d5e069440292", "score": "0.6082187", "text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.608015", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.60787827", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "44a1ec524e77d2a2c4b85e8341df27db", "score": "0.6077342", "text": "def product_params\n params.permit(:visible)\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.6076884", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "c31ef48e8fd467d94158d7ac7f405a3f", "score": "0.60729754", "text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6070705", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.6069212", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6068677", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "c1f13277dbc8ff3a9f65df027f9d915a", "score": "0.60636085", "text": "def permitted_params(unpermitted_params)\n unpermitted_params.permit(\n :controller,\n :action,\n :site_id,\n :format,\n :type,\n :path_contains,\n :new_url_contains,\n :tagged,\n )\n end", "title": "" }, { "docid": "cf963fb451b51d62fcc986deb020a044", "score": "0.60466236", "text": "def permit_params\n\t\t\t\teval(@configuration.get_params)\n\t\t\tend", "title": "" }, { "docid": "77b78ffc267fcf03379cf09c63ad361c", "score": "0.6039494", "text": "def gallery_params\n params.require(:gallery).permit(:name, :white_list)\n end", "title": "" }, { "docid": "be92e82ba93b35cac91b7c02d6a445f7", "score": "0.60318094", "text": "def get_params\r\n #params.require(:view_adm).permit(:name, :action_scope,:caps,:cols)\r\n params.require(:view_adm).permit!\r\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.60285264", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "5b72cb3f5ae45681ff116df46f5da01b", "score": "0.60250574", "text": "def provider_params\n params.permit(:name)\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60180295", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60180295", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.60172004", "text": "def params; end", "title": "" } ]
c3b18403d8faa6898d77031636bd697b
Get a specific token
[ { "docid": "e83bad629ecefadddfd6cc85a59c5584", "score": "0.7012112", "text": "def token(id, options = {})\n objectify get(\"/token/#{id}\", options)['token']\n end", "title": "" } ]
[ { "docid": "cd40cacb5445164819aafb95f0743bf3", "score": "0.84879774", "text": "def get_token\n token\n end", "title": "" }, { "docid": "baca167289dda1324ca0bf835f00e13c", "score": "0.807553", "text": "def get_token\n return @token\n end", "title": "" }, { "docid": "fd8ef647881da2c90dd92450d250d433", "score": "0.79926044", "text": "def get_token\n read_cache['token']\n end", "title": "" }, { "docid": "77ccd4c60a3e9811dc2ad99351599257", "score": "0.7957618", "text": "def get_token\n @settings.get 'token'\n end", "title": "" }, { "docid": "af8c217aef5f91a249a0150855b33d40", "score": "0.77672446", "text": "def get_token\n @_token\n end", "title": "" }, { "docid": "9dfac1ee8b6f4cf01879b44011851838", "score": "0.7758445", "text": "def get_token\n if params.has_key?(:token) && params[:token] != ''\n return params[:token]\n end\n return nil if !request || !request.headers\n token_response = request.headers['Authorization']\n return nil if !token_response\n token_response[/^Token (.*)/,1]\n end", "title": "" }, { "docid": "9dfac1ee8b6f4cf01879b44011851838", "score": "0.7758445", "text": "def get_token\n if params.has_key?(:token) && params[:token] != ''\n return params[:token]\n end\n return nil if !request || !request.headers\n token_response = request.headers['Authorization']\n return nil if !token_response\n token_response[/^Token (.*)/,1]\n end", "title": "" }, { "docid": "5fda56f5753c1bd56e24975a01166b7c", "score": "0.77090603", "text": "def token\n @token\n end", "title": "" }, { "docid": "311b7a43ee9abb440b52c73d0f9d5842", "score": "0.77016854", "text": "def getToken\n @@token\n end", "title": "" }, { "docid": "862b4cf0d70021dfe8c22ec8362c3426", "score": "0.7701094", "text": "def token\n @data['token']\n end", "title": "" }, { "docid": "a80d32dd07e28183ca1b506ebefc9a78", "score": "0.76919514", "text": "def token\n read_token\n end", "title": "" }, { "docid": "9f681499296737a6e41f6a60733e438e", "score": "0.7618285", "text": "def token\n @token\n end", "title": "" }, { "docid": "9f681499296737a6e41f6a60733e438e", "score": "0.7618285", "text": "def token\n @token\n end", "title": "" }, { "docid": "20357049545f69a58ed17e2fc55be798", "score": "0.7598392", "text": "def get_token(token_name)\n REPOSITEXT_TOKENS.detect { |e| token_name == e.name }\n end", "title": "" }, { "docid": "97ba8076da0d0870c669c9ee8b92d551", "score": "0.7591181", "text": "def retrieve_token\n new.retrieve_token\n end", "title": "" }, { "docid": "80a80dcd848edbc726d8a470bcc147f6", "score": "0.75865096", "text": "def token; token_data[:token]; end", "title": "" }, { "docid": "5fe4f383c49b099f354eab73375a5fff", "score": "0.75837666", "text": "def token\n item[:token][0]\n end", "title": "" }, { "docid": "68a09a529fc7a17647e820fce50e6502", "score": "0.75829536", "text": "def token\n @token = Labtech.get_token\n end", "title": "" }, { "docid": "9ff2ee7ec618180cec3ee4403f9f7f1f", "score": "0.75556934", "text": "def get_token\n xml = XmlSimple.xml_in(TOKEN_FILE)\n content = xml['head'][0]['meta'][0]['content']\n File.delete(TOKEN_FILE) if File.exists?(TOKEN_FILE)\n content.match(/auth_token=(\\w+)/)[1]\nend", "title": "" }, { "docid": "1a1a6e4e1d4bce02ee8f7eec91fa869f", "score": "0.75310004", "text": "def token\n self[:token]\n end", "title": "" }, { "docid": "d00c08c4a41465b0a93abee72f7f81dd", "score": "0.75029373", "text": "def token\n info\n end", "title": "" }, { "docid": "d009c36e5100da39418428a634dcd8f3", "score": "0.7502802", "text": "def token\n return @token\n end", "title": "" }, { "docid": "97efc4473ee0caa4d1cb109d00b8da00", "score": "0.7462133", "text": "def get_token(type)\n form_data = {\"action\" => \"tokens\", \"type\" => type}\n res = make_api_request(form_data)\n token = res[\"tokens\"][type + \"token\"]\n raise Unauthorized.new \"User is not permitted to perform this operation: #{type}\" if token.nil?\n token\n end", "title": "" }, { "docid": "7d41ca3b17d7684a5b797d3113216a57", "score": "0.74596506", "text": "def token\n @token ||= params.split(' ', 2).first\n end", "title": "" }, { "docid": "3f07052e3e539852b621eddb54f84189", "score": "0.73944783", "text": "def getToken\n return @tokens[@index]\n end", "title": "" }, { "docid": "106f071e0583f07a99304ff083b2875c", "score": "0.73850703", "text": "def token()\n @token\n end", "title": "" }, { "docid": "06690d3ad555d1aec99b2ed2b6cfca89", "score": "0.73785466", "text": "def get_token\n authenticate_with_http_token do |token, options|\n @token = token\n end\n end", "title": "" }, { "docid": "196dcc47f4180b323e5df31b194ad6c0", "score": "0.73511493", "text": "def token\n ensure_token\n @token\n end", "title": "" }, { "docid": "196dcc47f4180b323e5df31b194ad6c0", "score": "0.73511493", "text": "def token\n ensure_token\n @token\n end", "title": "" }, { "docid": "f492a284c7d2f3955d7df1d567cd6fec", "score": "0.7318017", "text": "def token\n @Token\n end", "title": "" }, { "docid": "a5c770580746b78ac65356a2e2782f63", "score": "0.731111", "text": "def token(req)\n dao = Lynr::Persist::Dao.new\n dao.read(token_id(req))\n end", "title": "" }, { "docid": "e67ab4768630288b443bf95c4c198f92", "score": "0.7305623", "text": "def token\n @settings[:token]\n end", "title": "" }, { "docid": "1fe94ef16e65b17c22b129bfdf6932bd", "score": "0.72984064", "text": "def token\n @attributes[:token]\n end", "title": "" }, { "docid": "b83ed06fba08a9684723276718071106", "score": "0.72940606", "text": "def get_token\n object_from_response(Token, :post, \"authToken\")\n end", "title": "" }, { "docid": "95ce5c5eab86e7210a37f129b0195322", "score": "0.7280698", "text": "def token\n attributes[:token]\n end", "title": "" }, { "docid": "f4785c6acfd1f4651c083af378859df5", "score": "0.72776973", "text": "def token\n return @options[:token]\n end", "title": "" }, { "docid": "498010ec26f308e4a71af61d53e8ddf4", "score": "0.7268422", "text": "def getToken(token)\n\tresponse = RestClient.get(\"https://api.trello.com/1/tokens/\"+token+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend", "title": "" }, { "docid": "5cbc9233345e2115df1c5a1f2bfc810f", "score": "0.72662264", "text": "def get_token # rubocop:disable Style/AccessorMethodName\n response = get_token_call\n response.code == 200 ? parse_response(response.body) : ''\n end", "title": "" }, { "docid": "5af6c0dca67fdbc825c4613ecf82e532", "score": "0.72557235", "text": "def token\n @token ||= self.login\n end", "title": "" }, { "docid": "d93ca4365450d352e5b2b402d8a28683", "score": "0.72545236", "text": "def get_token\n return Token.new(@value)\n end", "title": "" }, { "docid": "bbbb461a513331a3e7c871310d0acf86", "score": "0.7239772", "text": "def token\n user_token\n end", "title": "" }, { "docid": "2e4b52e125b062ec4c8f3f3f765b4b99", "score": "0.7229265", "text": "def token\n attributes.fetch(:token)\n end", "title": "" }, { "docid": "2e4b52e125b062ec4c8f3f3f765b4b99", "score": "0.7229265", "text": "def token\n attributes.fetch(:token)\n end", "title": "" }, { "docid": "38b5078a5e7b2812520a6f06a4432e6f", "score": "0.72246695", "text": "def token\n end", "title": "" }, { "docid": "ba7d4511f8acaa26959009e4d5dfdbbc", "score": "0.72137153", "text": "def jwt_token\n local_var_path = 'token'\n body = @api_client.call_api(:GET, local_var_path)\n body['token']\n end", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "89e0c7f8f031bf57366a9a8d9cdbc941", "score": "0.7192093", "text": "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "title": "" }, { "docid": "5bcf257350d58d4e0dcbd4f690b65b7a", "score": "0.7179735", "text": "def token\n if token_present?\n request.env['HTTP_AUTHORIZATION'].scan(/Bearer (.*)$/).flatten.last\n else\n params[:t]\n end\n end", "title": "" }, { "docid": "9676646e38fdff7d95cfc3ba55764f92", "score": "0.7130301", "text": "def auth_token_get(args = { }, options = { })\n _token = args[:token] || token\n _token = token.to_s if _token.respond_to?(:to_s)\n http(:get, 'auth/v1/auth/token/', { :headers => { http_client.header_auth_key => _token } })\n end", "title": "" }, { "docid": "56f86c4bc3978763c2d5dd012f92f46f", "score": "0.7120511", "text": "def token\n self.class.id_to_token self.id\n end", "title": "" }, { "docid": "8a12458c29aea355c3f02b9781e28332", "score": "0.71056616", "text": "def get_token\n response = @endpoint.call_method('rtm.auth.getToken', { 'frob' => @frob }, false)\n response['auth']['token']\n end", "title": "" }, { "docid": "90c2456da42e58e25cc07bd38fd83acc", "score": "0.7081423", "text": "def get_by_token(organization, token)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('token', token, String)\n r = @client.request(\"/#{CGI.escape(organization)}/customer/tokens/#{CGI.escape(token)}\").get\n ::Io::Flow::V0::Models::CustomerToken.new(r)\n end", "title": "" }, { "docid": "7350f1f10d2d7c704ea806f61d63646d", "score": "0.70713127", "text": "def token\n tokens.count > 0 ? tokens.first : generate_token\n end", "title": "" }, { "docid": "8c39af62d3e1122b601a46ab8d31c06f", "score": "0.7069362", "text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/tokens/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Token.from_json(r)\n end", "title": "" }, { "docid": "8c39af62d3e1122b601a46ab8d31c06f", "score": "0.7069362", "text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/tokens/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Token.from_json(r)\n end", "title": "" }, { "docid": "1a17b3695cab7c8b121ad58cc1a02005", "score": "0.7064946", "text": "def get_token(timestamp = nil)\n self.class.get_token(secret, timestamp)\n end", "title": "" }, { "docid": "1a17b3695cab7c8b121ad58cc1a02005", "score": "0.7064946", "text": "def get_token(timestamp = nil)\n self.class.get_token(secret, timestamp)\n end", "title": "" }, { "docid": "1e5e7801cc7846ee8a5b6bcd01716be9", "score": "0.70465463", "text": "def token\n MagicAdmin::Resource::Token.new\n end", "title": "" }, { "docid": "8eda678f9a6099e8d383505c457fea2e", "score": "0.7046166", "text": "def getTokenMember(token)\n\tresponse = RestClient.get(\"https://api.trello.com/1/tokens/\"+token+\"/member/?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend", "title": "" }, { "docid": "1630675c9bb01163deab8305b9210a51", "score": "0.7034882", "text": "def get_token\n self.token = @client.get_token(token)\n save\n end", "title": "" }, { "docid": "9c03305116c668259322bd7851e881ac", "score": "0.7032539", "text": "def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'j_sakidmj')\n return token_resp unless token_resp.success?\n\n @token_id = token_resp.data[:id]\n\n success\n\n end", "title": "" }, { "docid": "385aac401029f04b251e2939730f217c", "score": "0.7015457", "text": "def retrieve_token!\n token, expires = request_token.fetch_values('token', 'expires')\n expires_at = Time.zone.at(expires / 1000)\n Rails.cache.write(API_TOKEN_CACHE_KEY, token, expires_at: expires_at)\n token\n end", "title": "" }, { "docid": "1b9366dd529a0b301516a3dc4fa85439", "score": "0.7014016", "text": "def token\n \"#{id}.#{digest}\"\n end", "title": "" }, { "docid": "ebe6a77d956f3bbd8b5de6a89bd25c3e", "score": "0.7010509", "text": "def token\n @token ||= @doc.at(\"/user\").attributes[\"token\"] rescue nil\n end", "title": "" }, { "docid": "a26fe060d6fb6eea585343f10cd329ea", "score": "0.7003518", "text": "def token\n @msg['Token']\n end", "title": "" }, { "docid": "a26fe060d6fb6eea585343f10cd329ea", "score": "0.7003518", "text": "def token\n @msg['Token']\n end", "title": "" }, { "docid": "2034af00633bf02ae406bd6a4e862c6b", "score": "0.69985676", "text": "def received_token\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n else\n errors.add(:token,'Missing token')\n end\n nil\n end", "title": "" }, { "docid": "96651f852fdc631a09293c7f2176ddb7", "score": "0.69788295", "text": "def token\n\t\tt = REDIS.get(token_redis_key)\n\t\tunless t\n\t\t\tt = generate_token\n\t\t\tself.token = t\n\t\tend\n\t\tt\n\tend", "title": "" }, { "docid": "1327366e40d82e40f38e143bd8ba3634", "score": "0.6973788", "text": "def token\n @token ||= decode(bearer_token(request.headers['AUTHORIZATION'])).first['user']\n end", "title": "" }, { "docid": "861129d9458178ea1fb4576d186a8769", "score": "0.6958289", "text": "def token\n request.headers['Authorization'].to_s.split.last\n end", "title": "" }, { "docid": "8ee8a7e61cb68334de801c853a2c1898", "score": "0.6951432", "text": "def find_token(user_id)\n record =\n model(:tokens)\n .select(:token)\n .where(user_id: user_id)\n .first\n\n record[:token]\n end", "title": "" }, { "docid": "a8a632f80dda5a9cbab1d9f08f7ce32f", "score": "0.694906", "text": "def fetch_token_details\n @token = Token.where(client_id: @client_id).first\n @token_id = @token[:id]\n\n success\n end", "title": "" }, { "docid": "9c87e9f6e668917a0eea70841d6de2fe", "score": "0.6936345", "text": "def obtain_token\n response = client.request(@domain + '/login/token.php', {\n :username => @username, \n :password => @password, \n :service => @service\n })\n\n parsed = JSON.parse(response)\n parsed['token']\n end", "title": "" }, { "docid": "8c228eea6fdeb4b71dc43d93baddb368", "score": "0.6932236", "text": "def token\n return @token if @token\n return nil if request.authorization.blank?\n\n request.authorization.to_s.match(/\\ABearer (.+)\\z/) do |match|\n return @token = ETModel::EngineToken.decode(match[1])\n end\n end", "title": "" }, { "docid": "1b4efa340e46fab439ac43931cfbae45", "score": "0.693054", "text": "def get_token\n response = @http.post(\n ENV['LOGIN_URL'],\n {\n username: @username,\n apikey: @key\n }.to_json, content_type: 'application/json'\n )\n @token = JSON.parse(response.body)['token']\n end", "title": "" }, { "docid": "39c08d9ab76c4699d7c99f93d29af835", "score": "0.69261694", "text": "def get_token\n @logger.debug \"GET #{ROOT + '/?method=auth.gettoken&api_key=' + API_KEY}\"\n xml = parse_response( @client.get_content(ROOT + '/?method=auth.gettoken&api_key=' + API_KEY) )\n xml.token.text\n end", "title": "" }, { "docid": "dbb3c520e94b38b2499cd26ebbf5cdae", "score": "0.6917", "text": "def fetch_token\n \t@github_api.get_token(params[:code])\n end", "title": "" }, { "docid": "713770481111113d9e4b1a3eb4b180ac", "score": "0.6916062", "text": "def token\r\n\t\t@i_token\r\n\tend", "title": "" }, { "docid": "066c06ba2c4b5885ad6c1318bc2badca", "score": "0.6904087", "text": "def get_token\n\t\t\tpage = @agent.get(\"https://torrentapi.org/pubapi_v2.php?get_token=get_token&app_id=DownloadTV\").content\n\t\t\t\n\t\t\tobj = JSON.parse(page)\n\n\t\t\t@token = obj['token']\n\n\t\tend", "title": "" }, { "docid": "9ae29fdbb9c0bf6c0217698c3524598a", "score": "0.6897538", "text": "def token\n if Rubicon.configuration.flyingdog_enabled\n identity && identity.token\n else\n @token\n end\n end", "title": "" }, { "docid": "8c68abbf773a1f44d8b44bb29e0a1ebf", "score": "0.68846977", "text": "def auth_token\n return NilToken if token_param.nil? || stored_token.nil?\n stored_token\n end", "title": "" }, { "docid": "fcdef87c0e9e8f4e4fecf3fdc73d59ff", "score": "0.68816155", "text": "def token_string\n @token\n end", "title": "" }, { "docid": "90332f3df328d1d666687b3e1e55fe8d", "score": "0.68730474", "text": "def token_by_token\n User.find_by(authentication_token: user_params[:authenticity_token])\n end", "title": "" }, { "docid": "a561c72e73d7e545a7f1290560dcbc02", "score": "0.6872777", "text": "def token_id\n @hook.params[\"token_id\"]\n end", "title": "" }, { "docid": "2f569a413ede60cc7deaf4746901bd13", "score": "0.68681544", "text": "def token\n if bearer_token = request.headers[\"Authorization\"]\n jwt_token = bearer_token.split(\" \")[1]\n end\n end", "title": "" }, { "docid": "70bb6dfaf38ff824f0daba255dd84157", "score": "0.6852726", "text": "def obtain_token\n response = RestClient.get(@domain + '/login/token.php', {\n :username => @username,\n :password => @password,\n :service => @service\n })\n\n JSON.parse(response)['token']\n end", "title": "" }, { "docid": "2ad45631e5f334cdbb3b1849c9296c90", "score": "0.68525493", "text": "def get(login)\n row = @pgsql.exec('SELECT token FROM token WHERE login = $1', [login])[0]\n return row['token'] unless row.nil?\n reset(login)\n end", "title": "" }, { "docid": "7756f0900d0fd6ac4a0900ea7a6878a8", "score": "0.6834601", "text": "def token\n validate_arguments!\n result = email_address_and_api_key[1]\n if result\n puts result\n else\n error 'not logged in'\n end\n end", "title": "" }, { "docid": "6b9b5defd8a9182a44a4fa57ed3185e6", "score": "0.6833732", "text": "def token\n unless request.headers['Authorization'].nil?\n request.headers['Authorization'].split.last\n end\n end", "title": "" }, { "docid": "548cd2c7c5b0f3c48f17dd2d06ca11de", "score": "0.6831918", "text": "def lookup(token, options = {})\n headers = extract_headers!(options)\n json = client.post(\"/v1/auth/token/lookup\", JSON.fast_generate(\n token: token,\n ), headers)\n return Secret.decode(json)\n end", "title": "" }, { "docid": "4be1698f8dd95db0c2adc03bd4e06876", "score": "0.6829415", "text": "def get(token)\n @redis.get(token)\n end", "title": "" }, { "docid": "2fe0478f7e11133e52f44e7c92b32852", "score": "0.68193054", "text": "def token\n @token = @client.auth_code.get_token(params[:code])\n\n App.stripe do\n @account = Stripe::Account.retrieve(@token.params['stripe_user_id'])\n end\n end", "title": "" }, { "docid": "9f839aab153932125217852f7ccfee1d", "score": "0.68045557", "text": "def token\n @token = request.headers[:Authorization] || params[:Authorization] if @token.nil?\n @token = @token.split[1] if @token.start_with?('Bearer ') unless @token.nil?\n @token\n end", "title": "" }, { "docid": "bace590b017e5899d33bac87c7116b3b", "score": "0.6799349", "text": "def get_token\n puts \"Please enter your Authentication token: \"\n gets.chomp\n end", "title": "" }, { "docid": "dd4a86b2754435c88bf35752bd9161bf", "score": "0.6797588", "text": "def get_token\n test_token= '5j1znBVAsnSf5xQyNQyq'\n get_config('PM25_IN_TOKEN', test_token)\n end", "title": "" }, { "docid": "dde02928c5cd6d60959d46be8d015674", "score": "0.67899793", "text": "def getToken\n\t\tunless Rails.cache.exist?('token')\n\t\t\ttoken = getTokenFromAPI\n\t\t\tRails.cache.write('token', token)\t\n\t\tend\n\t\ttoken = Rails.cache.read('token');\n\t\treturn token\n\tend", "title": "" } ]
4cef4412cc2badbc81a659490d0720c8
Get all settings, sorted by key, as ConfigSetting objects.
[ { "docid": "5577cd82358203d188e870c2697162b0", "score": "0.83033025", "text": "def all_settings\n @settings.values.sort_by(&:key)\n end", "title": "" } ]
[ { "docid": "0cec64804434e99630af27cb2d3678a6", "score": "0.6496622", "text": "def get_all_keys\n settings, _ = _get_settings()\n if settings === nil\n @log.error(1000, \"Config JSON is not present. Returning empty list.\")\n return []\n end\n return settings.keys\n end", "title": "" }, { "docid": "a93f2666ed9425e490ef5205059da566", "score": "0.6417973", "text": "def get_names\r\n\t\tsettings = []\r\n\t\[email protected] { |key, value|\r\n\t\t\tsettings.push(key)\r\n\t\t}\r\n\t\treturn settings\r\n\tend", "title": "" }, { "docid": "77e1d233b9db36c2d8e6881372381d5c", "score": "0.6411674", "text": "def settings_list\n setting.list\n end", "title": "" }, { "docid": "c9f11fc546d7758b600d2e02af3a307f", "score": "0.6368072", "text": "def settings(*keys)\n return @settings.dup if keys.empty?\n entries = @settings.reject {|k, v| !keys.include?(k)}\n keys.size == 1 ? entries.values.first : entries\n end", "title": "" }, { "docid": "2d47883090b91d32c0175f907726e007", "score": "0.5995426", "text": "def get_all_settings\n return @db[:settings].as_hash(:name, :body) if onblock(:u, -1, @client).admin?\n end", "title": "" }, { "docid": "3737e54f4767c6e07f085590d1cb3ccb", "score": "0.5971435", "text": "def settings(options = {})\n ensure_config_loaded!\n setting_class.all_keys(options)\n end", "title": "" }, { "docid": "d9244d82e71c9a47aa99aad279be4a52", "score": "0.5853349", "text": "def all_defaults\n @defaults.values.sort_by(&:name)\n end", "title": "" }, { "docid": "b4c25a644c9724f8e079fccce1d070d4", "score": "0.5738652", "text": "def all\n JSON.parse(@client.call('config.get'))\n end", "title": "" }, { "docid": "22cec829b587c3fb07b780bfdc258645", "score": "0.5680981", "text": "def list_settings(opts = {})\n data, _status_code, _headers = list_settings_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "0711fb6ee52940ea8d160a81ff96ec5d", "score": "0.5609025", "text": "def keys\n configs.keys | store.keys\n end", "title": "" }, { "docid": "aecdb5fd66740eef67a751d1abd3ddac", "score": "0.56043446", "text": "def index\n @configuration_keys = ConfigurationKey.all\n end", "title": "" }, { "docid": "c163ef499d2cdd7631f8ff14e8be822a", "score": "0.5550765", "text": "def get_all_values(user = nil)\n settings, _ = _get_settings()\n if settings === nil\n @log.error(1000, \"Config JSON is not present. Returning empty dictionary.\")\n return {}\n end\n\n all_values = {}\n for key in settings.keys\n value = get_value(key, nil, user)\n if !value.equal?(nil)\n all_values[key] = value\n end\n end\n return all_values\n end", "title": "" }, { "docid": "ce9e4aae8a70d1cbb64c3afc6c93dd83", "score": "0.5543003", "text": "def [](k)\n keys = k.to_s.split('/')\n result = read_settings(keys.shift)\n while result && keys.any?\n result = result[keys.shift]\n end\n result\n end", "title": "" }, { "docid": "c9579db2fc2b51f9975f2efc844f3b30", "score": "0.55272686", "text": "def settings_list_settings(request, opts = {})\n data, _status_code, _headers = settings_list_settings_with_http_info(request, opts)\n data\n end", "title": "" }, { "docid": "0b589e3fdf0a4c8840c6865fd79c4947", "score": "0.55249417", "text": "def all\n unless @all_loaded\n @all = keys.map { |key| get(key) }\n @all_loaded = true\n end\n\n @all\n end", "title": "" }, { "docid": "5f786058a80bdb02421cd3805ecb5327", "score": "0.55212545", "text": "def all_options\n Config::Options.all\n end", "title": "" }, { "docid": "f06701c417502d3c29850cc56b3419cf", "score": "0.5502516", "text": "def index\n @settings = Setting.all\n end", "title": "" }, { "docid": "f06701c417502d3c29850cc56b3419cf", "score": "0.5502516", "text": "def index\n @settings = Setting.all\n end", "title": "" }, { "docid": "f06701c417502d3c29850cc56b3419cf", "score": "0.5502516", "text": "def index\n @settings = Setting.all\n end", "title": "" }, { "docid": "98fab4842ff590cb745bb7d079104da9", "score": "0.5491729", "text": "def index\n @application_settings = ApplicationSetting.all\n end", "title": "" }, { "docid": "fb807142c4c43abcd8b0e44579e7469f", "score": "0.5436216", "text": "def get_keys()\n\t\t\treturn @config.keys\n\t\tend", "title": "" }, { "docid": "04bf7bf052b2268f1a3c6721c81f60ca", "score": "0.54240954", "text": "def keys\n @config.keys\n end", "title": "" }, { "docid": "25aa3b49ea42da2240bdeb1b3a5dae63", "score": "0.5422863", "text": "def get_all\n verify_connection_url\n\n output = {}\n list.each { |key| output[key.to_sym] = get key }\n output\n end", "title": "" }, { "docid": "847325a81f885fa5c4a8ad4f148ea8c0", "score": "0.5417118", "text": "def available_settings\n []\n end", "title": "" }, { "docid": "dfd9b0b543a5e9c24f63eb2c90b91177", "score": "0.53927153", "text": "def index\n @api_settings = ApiSetting.all\n end", "title": "" }, { "docid": "c36c53cc1ff70c905f254775ef52eca1", "score": "0.5382754", "text": "def all_configurations\n @all_configuration ||= Configuration.new(:all)\n end", "title": "" }, { "docid": "1a45ad8d1fe8720a43dfd8db3227cdd0", "score": "0.538139", "text": "def get_all(key)\n configuration.hpath(key)\n end", "title": "" }, { "docid": "4121f6cde3bf3c2bdd6344a3d5d5dc15", "score": "0.5369593", "text": "def [](key)\n initialize_cache unless @initialized\n return @settings[key]\n end", "title": "" }, { "docid": "e30dc9a04ccc320d5c48dcad13199bc9", "score": "0.53582513", "text": "def keys\n configuration.keys\n end", "title": "" }, { "docid": "a3a5ce702e0dd78fe5fc0890bfd5e654", "score": "0.5356775", "text": "def keys\n\n (@services.keys + conf.keys).uniq.sort\n end", "title": "" }, { "docid": "d0c96163f75a0fbab23bf341b98cb8a5", "score": "0.53483665", "text": "def find_configurations\n @configurations = @user.configurations\n @config_by_key = @configurations.inject({}) do |map, cfg|\n values = map[cfg.api_key] || []\n values << cfg\n map[cfg.api_key] = values\n map\n end\n end", "title": "" }, { "docid": "56bacb9ad1b5b637c551ba3a803366c8", "score": "0.5344251", "text": "def all\n @keys\n end", "title": "" }, { "docid": "a81ebeb593d5ab788a65cf69e33faa09", "score": "0.53287596", "text": "def settings\n\t\tlast_settings = Setting.where(\"dtCreated IN (SELECT MAX(dtCreated) FROM settings GROUP BY name)\")\n\t\treturn render_json_response(last_settings, :ok)\n\tend", "title": "" }, { "docid": "3b7043daf3680c6670f09be0833a22d0", "score": "0.5314208", "text": "def index\n @section_configurations = SectionConfiguration.all.sort\n end", "title": "" }, { "docid": "cb65422c187ca9d9205da7e9fd1a0055", "score": "0.5278691", "text": "def rendersettingkeys()\r\n return @settings_render.keys\r\n end", "title": "" }, { "docid": "61375e6ca26a57d7f510bb09c4570b23", "score": "0.5265954", "text": "def find_all\n find_all_redis_keys.map do |redis_key|\n find_by_redis_key(redis_key)\n end\n end", "title": "" }, { "docid": "7e7f10cb7fdc386e453a5a95b4dcafd8", "score": "0.52239114", "text": "def all(params = {})\n response, status = BeyondApi::Request.get(@session, \"/order-settings\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "3d6a39c68fd0eb19dc237f46efcff166", "score": "0.5222165", "text": "def list_settings\n configure do |settings|\n settings.reject { |_, setting| setting.internal? }.each do |name, setting|\n @env.ui.info \"#{name}\\t#{setting.description}\", bold: true\n @env.ui.info indent(setting.help, 2) unless setting.help.nil?\n value_info = \"Current value: #{setting.value}\"\n value_info += ' (default)' unless setting.set?\n @env.ui.info indent(value_info, 2)\n @env.ui.info ''\n end\n end\n end", "title": "" }, { "docid": "8ddfc7278b9272790c7a3af9b7204044", "score": "0.52203816", "text": "def settings\n # JSONSettingDataSource.file_semaphore.synchronize do\n return @settings\n # end\n end", "title": "" }, { "docid": "92e1da3191673fa5ba5b1129f3721845", "score": "0.5186884", "text": "def all\n response, status = BeyondApi::Request.get(@session, \"/checkout-settings\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "a1553aba7fd08b7683cf868bdf0bf842", "score": "0.51802695", "text": "def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end", "title": "" }, { "docid": "983e73da89d38ec3194fa77ecfdadbce", "score": "0.5163684", "text": "def list\n to_hash.keys.sort\n end", "title": "" }, { "docid": "e1960cd0776559e9f3bcf539e9c1b7a2", "score": "0.5156815", "text": "def index\n @user_settings = UserSetting.all\n end", "title": "" }, { "docid": "9cd6b2115f30c07bd42320e9b0337989", "score": "0.51409006", "text": "def index\n @app_settings = AppSetting.all\n end", "title": "" }, { "docid": "72408c8b6150d0b50de54c01ceafc8ec", "score": "0.51241803", "text": "def index\n @settings = Setting.all\n respond_with(@settings)\n end", "title": "" }, { "docid": "faa9ebfe53b45dab851b991466d59258", "score": "0.5124173", "text": "def settings\n adapter_id = self.const_get(:ADAPTER_ID)\n @adapter_settings = []\n Octo::Enterprise.all.each do |enterprise|\n opt = {\n enterprise_id: enterprise.id,\n adapter_id: adapter_id,\n enable: true\n }\n @adapter_settings << Octo::AdapterDetails.get_cached(opt)\n end\n end", "title": "" }, { "docid": "69335ea22a95d1842602248bf4aef18e", "score": "0.51105", "text": "def get_settings_items(controller)\n return [] unless settings_proc\n\n controller.instance_exec(&settings_proc)\n end", "title": "" }, { "docid": "c873615f5c65f6b0da08477d77c241ca", "score": "0.5110358", "text": "def all\n\t\t@data_base.keys.dup || []\n\tend", "title": "" }, { "docid": "8114bd0a9d2ca9f54ed021f02c7ce49a", "score": "0.5110252", "text": "def list_cache_settings(opts = {})\n data, _status_code, _headers = list_cache_settings_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "2b089fe4f8e2198cf6767292660f3120", "score": "0.5108358", "text": "def index\n # @adm_set = Setting.all\n end", "title": "" }, { "docid": "d8945f11b800edf905f3944762e2e4ff", "score": "0.51078963", "text": "def settings_groups\n @settings_groups ||= {}\n end", "title": "" }, { "docid": "bdbfb9c94951c0728627486d60d0c9b7", "score": "0.51068753", "text": "def index\n @scrape_configs = ScrapeConfig.all.order(year: :desc, week: :desc)\n end", "title": "" }, { "docid": "03228afd18e2a98d627f0b9924c1f32c", "score": "0.5091724", "text": "def index\n @settings_types = SettingsType.order('description asc')\n end", "title": "" }, { "docid": "57e31b89d3a6b33e0c8fdfc09ebd3b08", "score": "0.50896126", "text": "def names\n @configs.keys\n end", "title": "" }, { "docid": "57e31b89d3a6b33e0c8fdfc09ebd3b08", "score": "0.50896126", "text": "def names\n @configs.keys\n end", "title": "" }, { "docid": "2216e56769e8bb4faa8b3ccc4c480bc4", "score": "0.50874734", "text": "def setting_for(key)\n ensure_config_loaded!\n setting_class.find_by_key(key.to_s)\n end", "title": "" }, { "docid": "2f2493cd7e4d2f15659c9377f6006b2b", "score": "0.50850123", "text": "def config_for_key(key)\n settings.config[key]\n end", "title": "" }, { "docid": "e49ce09300741162ced8fed7f3667532", "score": "0.5077113", "text": "def index\n @settings = Setting.all_cached\n respond_to do |format|\n format.html{}\n format.json { render json: @settings }\n end\n end", "title": "" }, { "docid": "ecb4c784a68719ebaf739059fda976ae", "score": "0.5057514", "text": "def list()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('registrysettings', 'list', 'KalturaRegistrySettingsListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "title": "" }, { "docid": "436ffd012dd037c354982b2e492acd5b", "score": "0.505001", "text": "def index\n @admin_settings = AdminSetting.all\n end", "title": "" }, { "docid": "179de4e1188dba5bae7899e20107e835", "score": "0.50380975", "text": "def list\n run do\n print_config_table(columns: %i[key value], skip_blanks: true)\n end\n end", "title": "" }, { "docid": "ad161bc8026afa6cb9016691b43ef2e2", "score": "0.50322765", "text": "def all\n @@directory_lock.synchronize { @@directory.keys }\n end", "title": "" }, { "docid": "5f3927b751d059449382ec67463583d0", "score": "0.5030652", "text": "def load_settings\n @settings = Setting.all(:order => 'id')\n @settings.each do |setting|\n # set instance variables\n instance_variable_set(\"@#{setting.slug}\", setting.instance_value)\n end\n end", "title": "" }, { "docid": "2876e49b65c40f8f30113ee08a9b8cb9", "score": "0.50149286", "text": "def index\n @title = t('view.settings.index_title')\n @settings = Setting.order('created_at ASC').paginate(\n page: params[:page], per_page: lines_per_page\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settings }\n end\n end", "title": "" }, { "docid": "9380679d135ac86aafeaf75af44b0791", "score": "0.5002743", "text": "def all_keys\n map(&:all_keys).flatten.uniq.sort\n end", "title": "" }, { "docid": "8e06ed0ebd27b583649235b4fb96b79a", "score": "0.49979565", "text": "def all\n @hash.values\n end", "title": "" }, { "docid": "b1418f84f9b0b52ab5d0f8e0309e46f9", "score": "0.49958903", "text": "def get_settings\n settings.get\n end", "title": "" }, { "docid": "aad88f49710a3b1bdf63e455d8eb16c6", "score": "0.49944577", "text": "def index\n @config_set_values = ConfigSetValue.all\n end", "title": "" }, { "docid": "f48886c720f96e38582c7c7614af279c", "score": "0.49840456", "text": "def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end", "title": "" }, { "docid": "10f2809823a10e34b5212e5e9793f378", "score": "0.49822986", "text": "def index\n @setting_types = SettingType.all\n end", "title": "" }, { "docid": "e7a15951e61b8260543bf460cd399da8", "score": "0.49791262", "text": "def get_all_value_details(user = nil)\n settings, fetch_time = _get_settings()\n if settings.nil?\n @log.error(1000, \"Config JSON is not present. Returning empty list.\")\n return []\n end\n\n details_result = []\n for key in settings.keys\n details = _evaluate(key, user, nil, nil, settings, fetch_time)\n details_result.push(details)\n end\n\n return details_result\n end", "title": "" }, { "docid": "067644fb920f93fa2e9a70da637d1917", "score": "0.49616024", "text": "def index\n @configs = Config.all\n end", "title": "" }, { "docid": "f9e293c443591511308a714b8f02c6ae", "score": "0.49550188", "text": "def models\n Typus::Configuration.config.map { |i| i.first }.sort\n end", "title": "" }, { "docid": "fbe93faaadcc05a8f5d4a379c6f6122f", "score": "0.4952975", "text": "def key_order\n # order(key: :asc)\n all.to_a.sort_by {|n| n.key }\n end", "title": "" }, { "docid": "f20a634cf12f99ed1d96d924afbf9b18", "score": "0.49460158", "text": "def index\n @project_settings = ProjectSetting.all\n end", "title": "" }, { "docid": "c982057d97426ac04507d924c02229d2", "score": "0.4936568", "text": "def index\n @config_values = ConfigValue\n .page(params[:page])\n .per(10)\n end", "title": "" }, { "docid": "b07f69c8a286804a440382be58385358", "score": "0.49344978", "text": "def settings( key )\n if @settings[key].is_a? Proc\n @settings[key] = @settings[key].call\n end\n\n @settings[key]\n end", "title": "" }, { "docid": "b0507ec96225ca1f62ee7e997dca0b46", "score": "0.49317905", "text": "def all\n return [self] + @options_collectors.inject([]) { |a, c| a + c.all }\n end", "title": "" }, { "docid": "c3e5c280b2466e64a1f1fd7077603329", "score": "0.49246138", "text": "def index\n @settings = Setting.all\n respond_with @settings\n end", "title": "" }, { "docid": "b9386b36f45feca0bbd2fc5c7bf1928f", "score": "0.49229184", "text": "def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n\n if self.pref.present?\n existing = self.pref.settings[key.to_s].deep_symbolize_keys\n \n # Check for new preferences \n defaults.keys.each do |grp| \n defaults[grp].keys.each do |pref, v|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end", "title": "" }, { "docid": "a761eaa8ee3fd00b3175dea29773ab0f", "score": "0.49029505", "text": "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "title": "" }, { "docid": "a31f2c8405b6d8d569e285e4fca90f99", "score": "0.489591", "text": "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "title": "" }, { "docid": "a31f2c8405b6d8d569e285e4fca90f99", "score": "0.489591", "text": "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "title": "" }, { "docid": "a31f2c8405b6d8d569e285e4fca90f99", "score": "0.489591", "text": "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "title": "" }, { "docid": "55102a227b4192c6f1fb19a86f29dab0", "score": "0.48843876", "text": "def index\n order = \"var ASC\"\n per_page = 50\n current_page = (params[:page] ||= 1).to_i\n @settings = Setting.paginate :page => current_page, :per_page => per_page, :order => order\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @settings.to_xml }\n end\n end", "title": "" }, { "docid": "264941f47d87a273eaaf389dd19c4c52", "score": "0.4869964", "text": "def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n defaults = defaults.with_indifferent_access if defaults.present?\n\n if pref.present?\n existing = pref.settings[key.to_s].deep_symbolize_keys\n existing = existing.with_indifferent_access if existing.present?\n\n # Check for new preferences\n defaults.each_key do |grp|\n defaults[grp].each_key do |pref|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end", "title": "" }, { "docid": "793e2e46f5515f697372c3a3dda259f3", "score": "0.48680204", "text": "def get_all\n vars = getter\n result = {}\n vars.each do |s|\n result[s.name] = YAML::load(s.value.to_s)\n end\n result\n end", "title": "" }, { "docid": "d52675f755b7537bd736464e1076aa1e", "score": "0.48670056", "text": "def index\n @configurations = ::Configuration.all\n end", "title": "" }, { "docid": "0bd288d94d55b4fa3526974d7e72344c", "score": "0.486525", "text": "def sorted_keys\n keys=nil\n transaction{\n keys=@@global_state.keys.sort\n }\n return keys\n end", "title": "" }, { "docid": "f9ee27c58202af7e67d8a967a8fec7b6", "score": "0.48616675", "text": "def get_settings(opts = {})\n data, _status_code, _headers = get_settings_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "3b7cf6d28493ded4646592a91ade47df", "score": "0.48532292", "text": "def all\n self::OPTIONS.map {|e| build(e) }\n end", "title": "" }, { "docid": "8ae2ca50918565a26f232e55b9bd4a8c", "score": "0.48527554", "text": "def all\n @zones ||= zones_map.values.sort\n end", "title": "" }, { "docid": "4a08d16a5c0a3f9fabfb8aa9767ae8ad", "score": "0.48485214", "text": "def sort_keys\n sort_definitions.keys\n end", "title": "" }, { "docid": "d7d38030b1448625fcc59d0cc9a82142", "score": "0.4833705", "text": "def index\n @api_configs = ApiConfig.all\n end", "title": "" }, { "docid": "3cfea42f3b3532901cd805b120b797d1", "score": "0.48268232", "text": "def get_related_task_configs\n TaskConfig.all.collect do |tc|\n [tc.name, tc.id]\n end\n end", "title": "" }, { "docid": "276e74826dc0bfabd34d0dc022ec245c", "score": "0.48259422", "text": "def configurations\n return @configurations if @configurations\n \n configurations = CONFIGURATIONS_CLASS.new\n configurations.extend(IndifferentAccess) if @use_indifferent_access\n \n ancestors.reverse.each do |ancestor|\n next unless ancestor.kind_of?(ClassMethods)\n ancestor.config_registry.each_pair do |key, value|\n if value.nil?\n configurations.delete(key)\n else\n configurations[key] = value\n end\n end\n end\n \n configurations\n end", "title": "" }, { "docid": "59f7fadd74ab40cf2fee1102724339dc", "score": "0.48183763", "text": "def to_settings\n files.inject(Settings.new) do |settings, file|\n settings.merge(file.to_settings).tap do |merged|\n yield merged if block_given?\n end\n end\n end", "title": "" }, { "docid": "bc02411bbb14c262551d50d834bfa6de", "score": "0.48168188", "text": "def index\n @acc_settings = AccSetting.all\n end", "title": "" }, { "docid": "02a89232f66385539f90290c672c43df", "score": "0.481318", "text": "def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end", "title": "" }, { "docid": "f5e0f7f32cc94f4bd290ac64e33bfed6", "score": "0.4805145", "text": "def index\r\n @site_configs = SiteConfig.all\r\n end", "title": "" } ]
d6956ba276d8ec02a7133a99252769b8
multiplies each element by a scalar
[ { "docid": "6c5c9e20890a77d5b0a186bf771cd75a", "score": "0.7376853", "text": "def scalar_multiply!(to_multiply)\n collect! { |e| e * to_multiply }\n end", "title": "" } ]
[ { "docid": "62c4a25c827b7875639fd9350b92e7ad", "score": "0.7939319", "text": "def scalar_multiple!(array, multiplier)\n array.map! { |ele| ele * multiplier }\nend", "title": "" }, { "docid": "c75307357c2d0ab7a8524ca93ec24870", "score": "0.790554", "text": "def multiply valArray\n total = 1\n for i in valArray\n total *= i \n end\n total\nend", "title": "" }, { "docid": "bcf534777870a1ca27282684c0400511", "score": "0.78892934", "text": "def scalar_multiple!(array, multiplier)\n (0...array.length).each { |i| array[i] *= multiplier }\n array\nend", "title": "" }, { "docid": "74d7005a904d9191e9ced7663dcea61f", "score": "0.7777632", "text": "def scalar_multiply!(i)\n @elements.each_key do |key|\n @elements[key] = @elements[key] * i\n end\n end", "title": "" }, { "docid": "0963d9afbaf2a8973c469b8acedae6e8", "score": "0.7743333", "text": "def scalar_multiple!(array, multiplier)\n (0...array.length).each do |i|\n array[i] = array[i] * multiplier\n end\n array\nend", "title": "" }, { "docid": "17a7a1c0f8e0fab99094e556334e10e7", "score": "0.7722166", "text": "def scalar_multiple!(array, multiplier)\n array.map! { |num| num * multiplier }\nend", "title": "" }, { "docid": "7b4a195db30912c4eb7bcd454eab174c", "score": "0.7654344", "text": "def scalar_multiply(i)\n call_method_immutably(__method__, i)\n end", "title": "" }, { "docid": "54f708d679acb5c14aac9b79ea23447b", "score": "0.7603845", "text": "def multiply(array)\n m = 1\n array.each{|x| m *= x}\n m\nend", "title": "" }, { "docid": "81029d53c257d5900a1b1cd836bf4d23", "score": "0.7559478", "text": "def multiply(array)\n\ttotal = 1\n\tarray.each { |x|\n\t\ttotal *= x\n\t}\n\treturn total\nend", "title": "" }, { "docid": "028da988932cca7c9cdace09090e5303", "score": "0.7516012", "text": "def multiply(arr)\n res = 1\n arr.each{|e| res*=e}\n res\n end", "title": "" }, { "docid": "028da988932cca7c9cdace09090e5303", "score": "0.7516012", "text": "def multiply(arr)\n res = 1\n arr.each{|e| res*=e}\n res\n end", "title": "" }, { "docid": "ab1974df23853abd110cb0f29b7237ef", "score": "0.7422098", "text": "def multiply(*nums)\n total = 1\n nums.each { |x| \n total *= x\n }\n return total\nend", "title": "" }, { "docid": "3af935131003ef73cc59cbb3c25a84cc", "score": "0.73915726", "text": "def multiply_els \n\t\tself.my_inject(1) {|first,second| first * second}\n\tend", "title": "" }, { "docid": "3434f50912adf549192370c34c078ce5", "score": "0.739036", "text": "def multiply(*n)\n total = 1\n n.each {|i| total *= i}\n total\nend", "title": "" }, { "docid": "6723c49b0472de6f4014cf349e0c5e35", "score": "0.73842996", "text": "def multiply\n inject(1){|e,r|e*r}\n end", "title": "" }, { "docid": "6723c49b0472de6f4014cf349e0c5e35", "score": "0.73842996", "text": "def multiply\n inject(1){|e,r|e*r}\n end", "title": "" }, { "docid": "8bc1f3191a3786ce73e2e0d64e4e8b11", "score": "0.7381391", "text": "def custom_multiply(array, number)\n result = []\n number.times { array.each { |elem| result << elem } }\n result\nend", "title": "" }, { "docid": "767cba1a763bdb03d0cb945382e070e5", "score": "0.7377783", "text": "def product\n self.inject{|i,j| i.to_f * j.to_f}\n end", "title": "" }, { "docid": "0d1f1c3c17c36080fcd3daadf38c5322", "score": "0.7349552", "text": "def custom_multiply(array, number)\n result = []\n number.times do \n array.each { |elem| result << elem }\n end\n result\nend", "title": "" }, { "docid": "581f09726d1aa12fba0bbf04d867afa0", "score": "0.7337236", "text": "def multiply (arr)\n\tif !arr\n\t\treturn 0\n\tend\n\n\tproduct = 1\n\n\tarr.each do |i|\n\t\tproduct *= i\n\tend\n\n\treturn product\nend", "title": "" }, { "docid": "c2ee93bbde34e91fc5ee0dfaf2bced1d", "score": "0.73277813", "text": "def multiplyAll\n return @arr.inject(1) {|result, x| result * x}\n end", "title": "" }, { "docid": "292d7b559718a48c35ecfd8beca7daa2", "score": "0.730934", "text": "def product(ints)\n\ttotal = 1\n\tints.each {|i| total *= i}\n\ttotal\nend", "title": "" }, { "docid": "f36a4d9c4f1745d9728c2f0dc0529416", "score": "0.72916687", "text": "def mult(arr)\n do_math(arr) do |a, b|\n a * b\n end\n end", "title": "" }, { "docid": "669d9dfe68ae368edecc21f8d576b31b", "score": "0.72754115", "text": "def multiply(array)\n\tproduct = 1\n\tarray.each{ |num|\n\t\tproduct *=num\n\t}\n\treturn product\nend", "title": "" }, { "docid": "b213889498ce730e68f357242e2effd2", "score": "0.72673315", "text": "def multiply *args\n\tthe_product = 1\n\tif args == nil\n\t\treturn 0\n\tend\n\targs.each do |i|\n\t\tthe_product *= i\n\tend\n\tthe_product\nend", "title": "" }, { "docid": "1e1d362132d7d3195579963432e91d98", "score": "0.7263483", "text": "def multiply(*nums)\n\tnums.reduce(1,:*)\nend", "title": "" }, { "docid": "0a216db58226fbf9a362a91f9352c626", "score": "0.7260071", "text": "def scalar_multiply(arg)\n call_method_immutably(__method__, arg)\n end", "title": "" }, { "docid": "ebce814fd6ee2c9a3fe338ee9d74d2b8", "score": "0.72389054", "text": "def mul(*args)\n\t\targs.inject(:*)\n\tend", "title": "" }, { "docid": "7e47749a46c9085647ef9132248191f7", "score": "0.7227117", "text": "def multiply(*args)\n result = 1\n args.each {|arg| result *= arg }\n result\nend", "title": "" }, { "docid": "fe1c465b1823703c78ad373db3404975", "score": "0.7206164", "text": "def mult(arr)\n out = 1\n arr.each do |num|\n out = out * num\n end\n return out\nend", "title": "" }, { "docid": "fbfe564214d333990eb8d5ac8b02501d", "score": "0.71914876", "text": "def multiply(*numbers)\n numbers.reduce(:*)\n end", "title": "" }, { "docid": "7631c37fdb85bd8d6e3a28fbf8588c98", "score": "0.719112", "text": "def multiply(*array)\n\tres = 1\n\tif array.size > 1\n\t\tarray.each{|i| res *= i}\n\telse\n\t\tarray[0].each{|i| res *= i}\n\tend\n\tres\nend", "title": "" }, { "docid": "0c60a2e036c93e52fb361e0134a4f757", "score": "0.71741796", "text": "def multiply(a)\n a.inject(1){|mult, i| mult * i}\nend", "title": "" }, { "docid": "c058432f094efd2bd48c416ffc442d26", "score": "0.717206", "text": "def scale_with(ary)\n val = []\n self.map_with_index { |e, i| val << e * ary[i] }\n val\n end", "title": "" }, { "docid": "4629f9e713910e9689d79e85f0ac508b", "score": "0.71690387", "text": "def multiply (a)\n product_of_a = 1\n a.each do |number|\n product_of_a = product_of_a * number\n end\n product_of_a\nend", "title": "" }, { "docid": "fc58d6d64ce03c1369d1ee2d399b2f3c", "score": "0.7157392", "text": "def multiply(*val)\n\t\tval.flatten.inject(1, :*) \n\tend", "title": "" }, { "docid": "8587c71f723963da94e7fe2b4302fb9b", "score": "0.71520346", "text": "def multiply(*numbers)\n product = 1\n numbers.each { |number| product *= number }\n product\nend", "title": "" }, { "docid": "51b30e0c4580cefb9b4787aba948ff0d", "score": "0.7151295", "text": "def * (x) (!numeric?&&x.is_a?(Integer))?mult(x):to_f*x.to_f end", "title": "" }, { "docid": "4162886c5c99ecab1c7d1fd8676318b2", "score": "0.71509653", "text": "def multipy(scalar)\r\n\t\tvect_list_temp = Array.new\r\n\t\tvect_save = Array.new\r\n\t\tn = 6\r\n\t\tcounter = 0\r\n\t\tfor vect in @vec_list\r\n\t\t\tarrayVector = vect.getVect\r\n\t\t\tresults = Array.new\r\n\t\t\tfor i in 0..n -1\r\n\t\t\t\tresult = arrayVector[i] * scalar.to_i\r\n\t\t\t\tresults[i] = result\r\n\t\t\tend \t\r\n\t\tresultsStr = results.map(&:to_s)\r\n\t\tstr = \"(\" + resultsStr.map{ |i| %Q(#{i}) }.join(',') + \")\"\r\n\t\ttv = TVector.new(str)\r\n\t\tvect_list_temp.push(tv)\r\n\t\tend\t\r\n\t\tfor i in 0...vect_list_temp.length\r\n\t\t\tnum = vect_list_temp.at(i).to_s \r\n\t\t\ttvSave = TVector.new(num)\r\n\t\t @vec_list[i] = tvSave\r\n\t\tend\r\n\t\tputs \"The new vector list: \"\r\n\t\tfor vect in @vec_list\r\n\t\t\tputs vect.to_s\r\n\t\tend\t\r\n\tend", "title": "" }, { "docid": "d5abee34ad50dab55ad0de28efec7aed", "score": "0.71402884", "text": "def product(array)\n total = 1\n array.each { |x| total *= x }\n \n return total\nend", "title": "" }, { "docid": "d63e1ab3c9f8a1590be4d0935dc74407", "score": "0.7135408", "text": "def multiply_all(r)\n nums = r.to_a\n nums.inject(1) do |prod, mult|\n prod * mult\n end\nend", "title": "" }, { "docid": "ba7dda9497c102aed98b8701db95ce66", "score": "0.7132512", "text": "def multiply(*num)\n result = 1\n num.each {|n| result *= n}\n result\nend", "title": "" }, { "docid": "e4b084cbd028d64bdfb85632de542383", "score": "0.71150583", "text": "def multiply_els(array)\n\n return my_inject(array) do |result, n| \n result * n\n end\n\n end", "title": "" }, { "docid": "4ee137afcfa451dd2e8aa1dd383bc5f8", "score": "0.7062168", "text": "def multiply(*numbers)\n product = 1\n numbers.each { |num| product *= num }\n product\nend", "title": "" }, { "docid": "569263ff42cac29a9024c180f54b553e", "score": "0.7059764", "text": "def multiply_els(list)\n\tlist.my_inject(1) {|sum, num| sum * num}\nend", "title": "" }, { "docid": "5687287e0224e9509cf447f9c353e5b2", "score": "0.70567244", "text": "def multiply(*numbers)\n result = 1\n numbers.each do |num|\n result *= num\n end\n result\nend", "title": "" }, { "docid": "5687287e0224e9509cf447f9c353e5b2", "score": "0.70567244", "text": "def multiply(*numbers)\n result = 1\n numbers.each do |num|\n result *= num\n end\n result\nend", "title": "" }, { "docid": "66d6f98266a6777dbfca71a4a5e71ffc", "score": "0.70536155", "text": "def multiply(*args)\n\ttotal = 1\n\targs.each do |num|\n\t\tif num.kind_of?(Array)\n\t\t\tif num.length == 0; return 0 end\n\n\t\t\tar_total = num[0]\t\t\t\n\t\t\ti = 1\n\t\t\tuntil i == num.length \n\t\t\t\tar_total = multiply(ar_total, num[i])\t\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\t\tnum = ar_total\n\t\tend\n\t\ttotal = total * num\n\tend\n\treturn total\nend", "title": "" }, { "docid": "81ff1d2b1a2b156e5cdc0a75793bce82", "score": "0.70493066", "text": "def multiply(*num)\n\t \n\t num.flatten.inject(1, :*)\n\tend", "title": "" }, { "docid": "3ad2e70a75dab678416c99c63e1fbef1", "score": "0.70441204", "text": "def multiply(array)\n\tarray.inject { |sum, x| sum * x }\nend", "title": "" }, { "docid": "12a8d5d032264ed85466efe1f7842e1f", "score": "0.703531", "text": "def multiply(*nums)\n\tproduct = 1\n\tnums.each{|num| product *= num}\n\tproduct\nend", "title": "" }, { "docid": "3552d59b32dc7a3bbf4b4d06b974adc0", "score": "0.70319664", "text": "def multiply(numbers)\n product = 1\n numbers.each do |number|\n product = product * number\n end\n product\nend", "title": "" }, { "docid": "46d44ce0eee6ae2897867a1cf73e6fb2", "score": "0.7020768", "text": "def product(numbers)\n result = 1\n numbers.each do |number|\n result *= number\n end\n result\nend", "title": "" }, { "docid": "1cc7ba26df21967e0e61e0d25cd0c4ca", "score": "0.70194", "text": "def PRODUCT(*values) \n values.flatten!\n values.compact!\n values.inject(1) {|total,value| total = total * value}\n end", "title": "" }, { "docid": "7e4add8fa99a544daf1f0969dae8875e", "score": "0.70149857", "text": "def multiply_els array\n\treturn array.my_inject(1) {|x, y| x * y}\nend", "title": "" }, { "docid": "1a45b5adcd19586d9360f7540e142eba", "score": "0.6994528", "text": "def multiply(*nums)\n\t# inject(1) to make result start at 1, otherwise we'd always be multiplying by zero!\n\tnums.inject(1) { |result, num| result * num}\nend", "title": "" }, { "docid": "d1e360c06177ea76fa4ae4ce4c4aa5e0", "score": "0.69766617", "text": "def product(ary)\n return nil if ary == []\n\n product = 1\n ary.each do |integer|\n product *= integer\n end\n\n return product\nend", "title": "" }, { "docid": "2b3df6f8cc11a189a092be739d2e461a", "score": "0.69656026", "text": "def product(numbers)\n product = 1\n numbers.each { |number| product *= number }\n return product\nend", "title": "" }, { "docid": "9a1899d7d1f6d15978dca66812b46aea", "score": "0.6964982", "text": "def multiply(numbers)\n numbers.inject(1) { |num, x| (num.to_i) * (x.to_i) }\n\nend", "title": "" }, { "docid": "ce50bde84afdefdcd308586ddb70e09a", "score": "0.69642866", "text": "def multiply(array)\n\tarray.inject(1){|product,x| product * x}\nend", "title": "" }, { "docid": "20c76bda4b993a811a8a0d6116c69489", "score": "0.6963067", "text": "def custom_multiply(array,number)\n # return a new array with the array that's passed in\n # as an argument multiplied by the number argument\n result = []\n number.times { array.each { |elem| result << elem } }\n result\nend", "title": "" }, { "docid": "46600de2c86a930bcb8a64baeec46b5d", "score": "0.6948739", "text": "def scalar_product(vector)\n to_a.zip(vector.to_a).map { |a, b| a * b }.reduce(:+)\n end", "title": "" }, { "docid": "9250941ba0893d81649ed59dddcbfe18", "score": "0.694808", "text": "def multiply_els\n my_inject(1) { |product, n| product * n }\n end", "title": "" }, { "docid": "1ce63e3f7bc0e76e50ea858974280396", "score": "0.69467074", "text": "def multipyArray( numArray )\n product = 0\n for element in 0..numArray.length - 1\n product *= numArray[ element ]\n end\n product\nend", "title": "" }, { "docid": "58b8156a5b6e095f3e08312c2a43e444", "score": "0.6946426", "text": "def multiply(nums)\n product = 1\n nums.each do |a|\n product = product * a\n end\n product\nend", "title": "" }, { "docid": "7183123a6d96a4324b5597a1496fecd2", "score": "0.69450504", "text": "def multiply(*numbers)\n sum = 1\n numbers.each do |num|\n sum = sum * num\n end\n sum\nend", "title": "" }, { "docid": "75b6a715291d11a704190f5475f53442", "score": "0.6929029", "text": "def mult\n\t\t\t@value *= @interpreter.memory.get(@interpreter.memory_position)\n\t\tend", "title": "" }, { "docid": "9e20b8aa03c665ae73710996414b8dfb", "score": "0.69225824", "text": "def multiply(numbers)\n # Using inject\n # numbers.inject{|product, number| product * number}\n\n # Old Fashioned Way\n product = 1\n numbers.each do |number|\n product *= number\n end\n product\nend", "title": "" }, { "docid": "53252960217ea2dcb341dfcf9825688b", "score": "0.6919312", "text": "def scalar_multiply(value)\n\n # Check pre-conditions: value must be an Integer\n if !(value.is_a? Integer) and !(value.is_a? Float)\n raise TypeError, \"The input object is not an Integer or Float. It is a #{value.class}.\"\n end\n product_matrix = self.get_copy\n @sparse_hash.each { |key, hashValue|\n product_matrix.set_element(key, hashValue * value )\n }\n\n return product_matrix\n end", "title": "" }, { "docid": "bcac620eb853e6fdedafeaf753293141", "score": "0.6918956", "text": "def multiply(*num)\n\tresult = 1\n\tnum.each {|x| result = result * x}\n\tresult\nend", "title": "" }, { "docid": "9161deef258879da2852692969440acc", "score": "0.6914988", "text": "def multiply_alt(*num)\n\tnum.inject(:*)\nend", "title": "" }, { "docid": "fe94c45ecdfba057d9a84a7c7aae1cca", "score": "0.6904663", "text": "def multiply(data, n)\n data.collect {|x| x*n }\nend", "title": "" }, { "docid": "9b4f6dbfa95e3517d3c9e72a984fb746", "score": "0.69039696", "text": "def multiply(*nums)\n nums.reduce(1, :*)\n end", "title": "" }, { "docid": "2f47e5bd497be3713de3ec8982b71b13", "score": "0.690307", "text": "def arrMultiply(arr)\n arr.map(&:to_i).reduce(:*).to_s\nend", "title": "" }, { "docid": "439f72d7aaed2bed6f89c44548b03ff0", "score": "0.68998015", "text": "def multiply(*numbers)\n numbers.inject(1) { |product, number| product * number }\nend", "title": "" }, { "docid": "b2774b26e795d108e7b24f1f6584f942", "score": "0.6895584", "text": "def multiplied(arr)\narr.map do |value|\nvalue*2\nend\nend", "title": "" }, { "docid": "83ce31a611a2cf39e6074324519a8e62", "score": "0.68925196", "text": "def multiply_els\n self.my_inject{|product, n| product * n}\n end", "title": "" }, { "docid": "d980a117bb7ba7797c0a2679eff0ed25", "score": "0.68863344", "text": "def mult\n\t\ta = @stack[@stack_index].pop || 0\n\t\tb = @stack[@stack_index].pop || 1\n\t\t@stack[@stack_index]<< a*b\n\tend", "title": "" }, { "docid": "a49e39fdc393a5b0a9fe9888a725882e", "score": "0.6885714", "text": "def multiply_me(array, int)\n\n result = Array.new\n array.each {|x| result << x*int }\n\n result\nend", "title": "" }, { "docid": "77def3673dc5e5224b0ca406416f0e74", "score": "0.6872561", "text": "def multiplier (array, num)\n array.map {|a| 2*a}\nend", "title": "" }, { "docid": "7c3a0f8d5e7336d96464eae2ade40fb9", "score": "0.68652606", "text": "def multiply_els(array)\n array.my_inject { |mem, num| mem * num }\n end", "title": "" }, { "docid": "c19f365262f4d2c283e68eaa5121596f", "score": "0.6861793", "text": "def multiply_arr array\n if array.empty?\n product = 0\n else\n product = 1\n array.each do |x|\n product *= x\n end\n end\n product\nend", "title": "" }, { "docid": "e4180a31f7acfa5a3b3c3206f3030d1b", "score": "0.68511313", "text": "def multiply(nums)\n nums.inject{|product, n| product *= n}\nend", "title": "" }, { "docid": "23d5c7a3b673c26f55601efc7701286c", "score": "0.68454874", "text": "def multiply_els(array)\n\tarray.my_inject { |product, n| product * n }\nend", "title": "" }, { "docid": "4123b9532321fd7daa9b293728b9c860", "score": "0.68429184", "text": "def multiplier(*tokens)\n case tokens.flatten.uniq.length\n when 1 then 3.0\n when 2 then 2.0\n else 0.0\n end\n end", "title": "" }, { "docid": "c46a4e786c19467f1303e2c7b0e17ec7", "score": "0.68353015", "text": "def multiply_els(arr)\n arr.my_inject(1) { |accum, item| accum * item }\nend", "title": "" }, { "docid": "70ca8816e7b4c1b391379605bdf0f0e3", "score": "0.682605", "text": "def multiply(array, num)\n array * num\nend", "title": "" }, { "docid": "eb336a59e37f5a7865b1e1ce6f546759", "score": "0.6825541", "text": "def *(x)\n case x\n when Numeric\n els = @elements.collect{|e| e * x}\n Vector.elements(els, false)\n when Matrix\n Matrix.column_vector(self) * x\n else\n s, x = x.coerce(self)\n s * x\n end\n end", "title": "" }, { "docid": "e7f51fb3f75b8359d72c4ddc4542e8b1", "score": "0.68237007", "text": "def *(m)\r\n multiply(m)\r\n end", "title": "" }, { "docid": "66e75b95525be1a0a4069c10f0b672e9", "score": "0.6815498", "text": "def multiply_els(arr)\n arr.my_inject(1) { |total, x| total * x }\nend", "title": "" }, { "docid": "5d63a92661929e3f44d9df06babd2164", "score": "0.6809289", "text": "def mul!(s); muli(s); end", "title": "" }, { "docid": "00a956534f53ec7b6de8bb12d53fbb4a", "score": "0.6809129", "text": "def multiply(*number)\n\tresult = 1\n\tnumber.each {|n| result = result * n}\n\tresult\nend", "title": "" }, { "docid": "a865d13393644aa8356b2385f5d3158f", "score": "0.680235", "text": "def mul_row_vector!(s); muli_row_vector(s); end", "title": "" }, { "docid": "3712e39222755bf4b9f160e6e2e283d2", "score": "0.6796516", "text": "def multiply(arr, b)\n arr * b\nend", "title": "" }, { "docid": "4a6350e4d7541af8c7044259b7d425cc", "score": "0.6783366", "text": "def scalar_mult(scalar, matrix)\n \tresult = []\n \tfor i in 0...matrix.length\n \t\tresult.push []\n \t\tfor j in 0...matrix.first.length\n \t\t\tresult[i].push(matrix[i][j] * scalar)\n \t\tend\n \tend\n \treturn result\t\t\n end", "title": "" }, { "docid": "d4a069a06f9f6ef8a4b9903df3ec7cc9", "score": "0.67826986", "text": "def multiply(source, times)\n source * times\nend", "title": "" }, { "docid": "e7b35708fb630956de23c3bb97f7a99b", "score": "0.67730963", "text": "def product_without_i(numbers)\n return numbers if numbers.empty?\n\n total = numbers.reduce(:*)\n\n numbers.map do |n|\n total / n\n end\nend", "title": "" }, { "docid": "4cf7b2508fc548a767e6c2d0357c5228", "score": "0.67720956", "text": "def multiply(nums)\n product = 1\n i = 0\n while i < nums.length\n product *= nums[i]\n i += 1\n end\n return product\n end", "title": "" }, { "docid": "9a14817d5d31600540d7e2e4e3c70829", "score": "0.67700297", "text": "def calculate_product (array)\n array.inject(:*)\nend", "title": "" }, { "docid": "378d7431340bb58ced1b56df35201f34", "score": "0.6758896", "text": "def productify(array)\n product = array.inject(:*)\n array.map { |el| product / el }\nend", "title": "" } ]
6d2967265a2b06d6266b75525781c932
functonality can be called on a model object and it will update the title in real time
[ { "docid": "cec04a0eed7140c6a5f58213b885ec88", "score": "0.0", "text": "def update_title!\n title = Nokogiri::HTML.parse(open(full_url)).title\n self.update(title: title)\n end", "title": "" } ]
[ { "docid": "bbced04eca409b5b944c5a33141471f8", "score": "0.7822056", "text": "def update_title(new_title)\n \t@title = new_title\n end", "title": "" }, { "docid": "24d92ff32ed82cee2dfbddb4a66e59b6", "score": "0.7759977", "text": "def update_title!\n self[:title] = reload.title\n save!\n end", "title": "" }, { "docid": "47c579a781d8f8795a2b4712a654660c", "score": "0.7476217", "text": "def generate_title\n self.title = mets_object.title\n end", "title": "" }, { "docid": "6f07196db41b23894bce68e086433da4", "score": "0.7470005", "text": "def update_title(new_title)\n @title = new_title\n end", "title": "" }, { "docid": "241bc3447452611e1bb7ebf8057e8985", "score": "0.74689114", "text": "def title(value)\n model.title = value\n model.title\n end", "title": "" }, { "docid": "90e924e0e6af042f30d1e61205e7da87", "score": "0.7465998", "text": "def set_title\n self.title = display.title\n end", "title": "" }, { "docid": "fa61b8b9724fa5dca0b0ad94e5e30da1", "score": "0.7456002", "text": "def update_title!\n return if id.blank?\n\n reload.title\n end", "title": "" }, { "docid": "03df034b640f6770c62d68e133b7aa4e", "score": "0.7355124", "text": "def title\n obj.title\n end", "title": "" }, { "docid": "e6d095db3b863a80e95e8b34d7b7788e", "score": "0.73330855", "text": "def title= new_title\n @title = String new_title\n end", "title": "" }, { "docid": "9cf89fee1456c769b94ae39cba02aebd", "score": "0.73019946", "text": "def change_title\n self.title = self.title + \"_\" + Show.find(:id => self.show_id).title\n self.save\n end", "title": "" }, { "docid": "26532729925e94dbfe8d15b6894f2c42", "score": "0.7279028", "text": "def change_title(new_song_title)\n @title = new_song_title\n end", "title": "" }, { "docid": "a51d28d63243f273b8cc73a0cb9529c9", "score": "0.72491693", "text": "def title=(title); end", "title": "" }, { "docid": "e688423abbf12e7f74c945c3d53b32fd", "score": "0.7214039", "text": "def setTitle(s)\n @title = s\nend", "title": "" }, { "docid": "851555e568767c1ab61ab54bc7c2dd00", "score": "0.71928704", "text": "def set_title( title ) \n @title = title\n end", "title": "" }, { "docid": "54dece7f1d821e9344ec458e54d3a52e", "score": "0.7181509", "text": "def title= title\n \n end", "title": "" }, { "docid": "54dece7f1d821e9344ec458e54d3a52e", "score": "0.7181509", "text": "def title= title\n \n end", "title": "" }, { "docid": "eacb1d658094e3e5c1cee90e388a8dcd", "score": "0.71601796", "text": "def rtitle(title)\n self.title = title\n end", "title": "" }, { "docid": "e59e911f289579d0aa05a7b5e9288d9f", "score": "0.7157365", "text": "def title=(new_title)\n @title = new_title\n end", "title": "" }, { "docid": "2aa53682d15d2070bc0ca0d35a8f32f2", "score": "0.71552974", "text": "def change\n @changed = true\n display_title\n end", "title": "" }, { "docid": "279517a97247d3f315b3182b64f0074c", "score": "0.7154312", "text": "def title=(new_title)\n end", "title": "" }, { "docid": "4c24752d0f39470c96f7f625d65d713f", "score": "0.71382993", "text": "def set_title\n self.title.capitalize!\n end", "title": "" }, { "docid": "c0cbd6bf80bd1274a64f714e1feec7df", "score": "0.7127853", "text": "def edit_title; end", "title": "" }, { "docid": "088089250b26f75429397652ff4ce45d", "score": "0.71214056", "text": "def title\n object.title.titleize\n end", "title": "" }, { "docid": "a86a34df736aae900f705c59f7848820", "score": "0.71167433", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "4b506d7b9184d79e9b53fbfeb277ff98", "score": "0.71116585", "text": "def title\n object.name\n end", "title": "" }, { "docid": "56f4379c7ae4391b212186f74f37f952", "score": "0.7107877", "text": "def title=(title)\n @title = title\n end", "title": "" }, { "docid": "aa849c49c4027a9c4bfeddfac5f9cede", "score": "0.70992094", "text": "def title \n self.name\n end", "title": "" }, { "docid": "a5171d6ae2c3b0fb060d1175b05d7e6a", "score": "0.70863134", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "05982734533ac329324c0a71c89d9c13", "score": "0.70810974", "text": "def title\n end", "title": "" }, { "docid": "05982734533ac329324c0a71c89d9c13", "score": "0.70810974", "text": "def title\n end", "title": "" }, { "docid": "05982734533ac329324c0a71c89d9c13", "score": "0.70810974", "text": "def title\n end", "title": "" }, { "docid": "816fe11d3c146874f83bda459f5dab6a", "score": "0.7078047", "text": "def title\n self.name\n end", "title": "" }, { "docid": "816fe11d3c146874f83bda459f5dab6a", "score": "0.7078047", "text": "def title\n self.name\n end", "title": "" }, { "docid": "4c4029f3647482a4e77c940fd5c2f94b", "score": "0.70733774", "text": "def title(text)\n @title = text\n end", "title": "" }, { "docid": "cd33e67a4801c216ef99f85d2e7d0647", "score": "0.7072279", "text": "def set_title(title)\n @title = title\n end", "title": "" }, { "docid": "cd33e67a4801c216ef99f85d2e7d0647", "score": "0.7072279", "text": "def set_title(title)\n @title = title\n end", "title": "" }, { "docid": "cd33e67a4801c216ef99f85d2e7d0647", "score": "0.7072279", "text": "def set_title(title)\n @title = title\n end", "title": "" }, { "docid": "0441a6a319424829f4008c6a89f2bf8f", "score": "0.70655316", "text": "def title\n model.title.first\n end", "title": "" }, { "docid": "7d39794e39b12538acf614d3f601cca2", "score": "0.7051608", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "486ec9f630cee5cf96b00279ef26dd16", "score": "0.7049225", "text": "def title_name(title_name)\n @title = title_name\n end", "title": "" }, { "docid": "cf8f3a7cb3fa081945d8690042b74732", "score": "0.7045369", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "cf8f3a7cb3fa081945d8690042b74732", "score": "0.7045369", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "cf8f3a7cb3fa081945d8690042b74732", "score": "0.7045369", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "cf8f3a7cb3fa081945d8690042b74732", "score": "0.7045369", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "cf8f3a7cb3fa081945d8690042b74732", "score": "0.7045369", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "1ed569a6999f5594a993fe204cb81400", "score": "0.7037832", "text": "def set_title\n @title = Title.find(params[:id])\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "80d5d9459cacdcde745c681ae49ce914", "score": "0.70348364", "text": "def title=(value)\n @title = value\n end", "title": "" }, { "docid": "480a18c3de30991d4c13851317c68474", "score": "0.70324373", "text": "def title=( new_title ) \n if @writable \n @title = new_title \n end \n end", "title": "" }, { "docid": "aa16cc5d3ab86f4bdf899f94c6f470e4", "score": "0.70285356", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "861c0f2339706203242f947394a8742f", "score": "0.70275587", "text": "def title\n @title\n end", "title": "" }, { "docid": "a3a853d72df67da4024de8538bb13575", "score": "0.7010184", "text": "def set_title\n @title = 'Gene M. Angelo, Jr.'\n end", "title": "" }, { "docid": "07ebbdafc29fecae2c454f31a3c30ee6", "score": "0.7004703", "text": "def title=(title)\n @title = title\n end", "title": "" }, { "docid": "07ebbdafc29fecae2c454f31a3c30ee6", "score": "0.7004703", "text": "def title=(title)\n @title = title\n end", "title": "" }, { "docid": "07ebbdafc29fecae2c454f31a3c30ee6", "score": "0.7004703", "text": "def title=(title)\n @title = title\n end", "title": "" }, { "docid": "b006ef82e8db4951a4aca9a2a6055a27", "score": "0.6992618", "text": "def title\n\t\t@title \n\tend", "title": "" }, { "docid": "092ad9a0392dfd62a95945412cb0ac9f", "score": "0.6989274", "text": "def set_title\n @title = \"展会管理\"\n end", "title": "" }, { "docid": "033e98f7c1c3b52f60b7198d66fb332a", "score": "0.6986403", "text": "def title\n #return instance variable in this method title\n @title\n end", "title": "" }, { "docid": "8dbf99c7c0e171b05b2f1b45c5c2157b", "score": "0.69794226", "text": "def title=(title) # a setter method always takes an argument\n @title = title # don't forget to set the instance variable\n end", "title": "" }, { "docid": "3ae544b17c50af83818bb8e657995b66", "score": "0.6973692", "text": "def setTitle (title)\n @title = title.to_s\n end", "title": "" }, { "docid": "1d5d2458d5c3c7cb2a715994e55480b3", "score": "0.6969524", "text": "def title(new_title)\n if @writable\n @title = new_title\n end\n end", "title": "" }, { "docid": "d7893e251dd92abab87d808b0250aa40", "score": "0.69685686", "text": "def set_title\n @title = FortyTwo::Title.find(params[:id])\n end", "title": "" }, { "docid": "0cc7f83524a641149c5a6a5ad0ae42f0", "score": "0.69596374", "text": "def created()\n self.retitle()\n end", "title": "" }, { "docid": "0cc7f83524a641149c5a6a5ad0ae42f0", "score": "0.69596374", "text": "def created()\n self.retitle()\n end", "title": "" }, { "docid": "b292784428108438a8a5ac551af3a309", "score": "0.6958326", "text": "def update_title!\n UpdateTitleJob.perform_later self\n end", "title": "" }, { "docid": "2a2c6f519325ff4028cabfedf187267e", "score": "0.6942977", "text": "def rename_title(edited_title)\n \t@title = edited_title\n end", "title": "" }, { "docid": "8842d4c63fa33dd8dda73f869eb92a6d", "score": "0.6938251", "text": "def title\n \t\t@title\n\tend", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "63f295cf74a10c8dbdb05a178c828ccc", "score": "0.69322073", "text": "def title\n name\n end", "title": "" }, { "docid": "1cd82fd77d2463c8706422758cadec3a", "score": "0.6927479", "text": "def title\n\t@title\nend", "title": "" }, { "docid": "fc09ed44b007e456849bdb7c782cfc16", "score": "0.6924657", "text": "def title\n @name\n end", "title": "" }, { "docid": "be6d9edb4ba4046ea3b09f4f527772df", "score": "0.69241226", "text": "def title\n return @title\n end", "title": "" }, { "docid": "af4ccf03abf6a4f5b9d7a30f65f8d3c9", "score": "0.69235355", "text": "def set_title(new_title)\n @title = new_title\n end", "title": "" }, { "docid": "b14de4cf8c9aab37ba1050801c7ca2c5", "score": "0.69203675", "text": "def title=(title)\n @title = title\n @meta_modified = true\n end", "title": "" } ]